summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-04-24 12:04:15 +0300
committerIlia Motornyi <elmot@vaadin.com>2017-04-24 11:04:15 +0200
commitbb46fff4376095fb52443973577767026807a7ea (patch)
tree815dcd357f856174e52c21d554e1b1f9b98fad22 /uitest
parent70a3a105b22a01ee1114b40e50c18cdd5b194e50 (diff)
downloadvaadin-framework-bb46fff4376095fb52443973577767026807a7ea.tar.gz
vaadin-framework-bb46fff4376095fb52443973577767026807a7ea.zip
Add support for frontend:// using separate es5 and es6 folders
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/resources/FrontendInitialResourceUI.java35
-rw-r--r--uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java42
-rw-r--r--uitest/src/main/webapp/VAADIN/frontend/es5/logFilename.js1
-rw-r--r--uitest/src/main/webapp/VAADIN/frontend/es6/logFilename.js1
-rw-r--r--uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java43
-rw-r--r--uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java45
6 files changed, 167 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/resources/FrontendInitialResourceUI.java b/uitest/src/main/java/com/vaadin/tests/resources/FrontendInitialResourceUI.java
new file mode 100644
index 0000000000..cf90591eb8
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/resources/FrontendInitialResourceUI.java
@@ -0,0 +1,35 @@
+/*
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.resources;
+
+import com.vaadin.annotations.JavaScript;
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+
+@JavaScript("frontend://logFilename.js")
+@Widgetset("com.vaadin.DefaultWidgetSet")
+public class FrontendInitialResourceUI extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ getPage().getJavaScript()
+ .execute("document.body.innerHTML=window.jsFile;\n");
+
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java b/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java
new file mode 100644
index 0000000000..6fc1338e28
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.resources;
+
+import com.vaadin.annotations.JavaScript;
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+
+@Widgetset("com.vaadin.DefaultWidgetSet")
+public class FrontendLaterLoadedResourceUI extends AbstractTestUIWithLog {
+
+ @JavaScript("frontend://logFilename.js")
+ public static class MyButton extends Button {
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button b = new MyButton();
+ b.addClickListener(e -> {
+ getPage().getJavaScript()
+ .execute("document.body.innerHTML=window.jsFile;\n");
+ });
+ addComponent(b);
+ }
+
+}
diff --git a/uitest/src/main/webapp/VAADIN/frontend/es5/logFilename.js b/uitest/src/main/webapp/VAADIN/frontend/es5/logFilename.js
new file mode 100644
index 0000000000..7dd7eaea60
--- /dev/null
+++ b/uitest/src/main/webapp/VAADIN/frontend/es5/logFilename.js
@@ -0,0 +1 @@
+window.jsFile = "/VAADIN/frontend/es5/logFilename.js";
diff --git a/uitest/src/main/webapp/VAADIN/frontend/es6/logFilename.js b/uitest/src/main/webapp/VAADIN/frontend/es6/logFilename.js
new file mode 100644
index 0000000000..db154ac218
--- /dev/null
+++ b/uitest/src/main/webapp/VAADIN/frontend/es6/logFilename.js
@@ -0,0 +1 @@
+window.jsFile = "/VAADIN/frontend/es6/logFilename.js";
diff --git a/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java b/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java
new file mode 100644
index 0000000000..555e286427
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/resources/FrontendInitialResourceUITest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.resources;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class FrontendInitialResourceUITest extends MultiBrowserTest {
+
+ @Test
+ public void correctEs5Es6FileImportedThroughFrontend() {
+ openTestURL();
+ String es;
+ if (BrowserUtil.isIE(getDesiredCapabilities())
+ || BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
+ es = "es5";
+ } else {
+ es = "es6";
+ }
+ testBench().disableWaitForVaadin(); // For some reason needed by IE11
+
+ Assert.assertEquals("/VAADIN/frontend/" + es + "/logFilename.js",
+ findElement(By.tagName("body")).getText());
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java b/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java
new file mode 100644
index 0000000000..9d8d75b715
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUITest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.resources;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class FrontendLaterLoadedResourceUITest extends MultiBrowserTest {
+
+ @Test
+ public void correctEs5Es6FileImportedThroughFrontend() {
+ openTestURL();
+ $(ButtonElement.class).first().click();
+ String es;
+ if (BrowserUtil.isIE(getDesiredCapabilities())
+ || BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
+ es = "es5";
+ } else {
+ es = "es6";
+ }
+ testBench().disableWaitForVaadin(); // For some reason needed by IE11
+
+ Assert.assertEquals("/VAADIN/frontend/" + es + "/logFilename.js",
+ findElement(By.tagName("body")).getText());
+ }
+
+}