summaryrefslogtreecommitdiffstats
path: root/uitest/src/com
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-05-06 13:05:22 +0300
committerVaadin Code Review <review@vaadin.com>2015-05-18 13:45:31 +0000
commit05d294e6152963d45262d06c727f977e0901d723 (patch)
tree0e6f356edc0cb52391d65c72998b82a4e28c84e6 /uitest/src/com
parent10b81b13814d345c3c273999ebb4af21b7dafa35 (diff)
downloadvaadin-framework-05d294e6152963d45262d06c727f977e0901d723.tar.gz
vaadin-framework-05d294e6152963d45262d06c727f977e0901d723.zip
Convert theme tests from TB2 to TB4
This change makes FixedNotificationElement work with notifications and rounded edges. Change-Id: I8e682fab471aa89bef5fc67d5aafdc3e37333a17
Diffstat (limited to 'uitest/src/com')
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/BaseThemeTest.java23
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/ChameleonThemeTest.java33
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/LiferayThemeTest.java23
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/ReindeerThemeTest.java34
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/RunoThemeTest.java33
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/ThemeTest.java209
-rw-r--r--uitest/src/com/vaadin/tests/tb3/newelements/FixedNotificationElement.java2
7 files changed, 356 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/tests/components/uitest/BaseThemeTest.java b/uitest/src/com/vaadin/tests/components/uitest/BaseThemeTest.java
new file mode 100644
index 0000000000..6a7174bf99
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/uitest/BaseThemeTest.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2000-2014 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.components.uitest;
+
+public class BaseThemeTest extends ThemeTest {
+ @Override
+ protected String getTheme() {
+ return "base";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/ChameleonThemeTest.java b/uitest/src/com/vaadin/tests/components/uitest/ChameleonThemeTest.java
new file mode 100644
index 0000000000..8c4349ad5f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/uitest/ChameleonThemeTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 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.components.uitest;
+
+import java.io.IOException;
+
+public class ChameleonThemeTest extends ThemeTest {
+ @Override
+ protected String getTheme() {
+ return "chameleon";
+ }
+
+ @Override
+ protected void testWindows() throws IOException {
+ super.testWindows();
+
+ // chameleon theme only
+ testWindow(4, "subwindow-opaque");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/LiferayThemeTest.java b/uitest/src/com/vaadin/tests/components/uitest/LiferayThemeTest.java
new file mode 100644
index 0000000000..47c4c1baae
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/uitest/LiferayThemeTest.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2000-2014 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.components.uitest;
+
+public class LiferayThemeTest extends ThemeTest {
+ @Override
+ protected String getTheme() {
+ return "liferay";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/ReindeerThemeTest.java b/uitest/src/com/vaadin/tests/components/uitest/ReindeerThemeTest.java
new file mode 100644
index 0000000000..cdeb4b0606
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/uitest/ReindeerThemeTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 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.components.uitest;
+
+import java.io.IOException;
+
+public class ReindeerThemeTest extends ThemeTest {
+ @Override
+ protected String getTheme() {
+ return "reindeer";
+ }
+
+ @Override
+ protected void testWindows() throws IOException {
+ super.testWindows();
+
+ // reindeer theme only
+ testWindow(1, "subwindow-light");
+ testWindow(2, "subwindow-black");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/RunoThemeTest.java b/uitest/src/com/vaadin/tests/components/uitest/RunoThemeTest.java
new file mode 100644
index 0000000000..073ab27566
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/uitest/RunoThemeTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 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.components.uitest;
+
+import java.io.IOException;
+
+public class RunoThemeTest extends ThemeTest {
+ @Override
+ protected String getTheme() {
+ return "runo";
+ }
+
+ @Override
+ protected void testWindows() throws IOException {
+ super.testWindows();
+
+ // runo theme only
+ testWindow(3, "subwindow-dialog");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/uitest/ThemeTest.java b/uitest/src/com/vaadin/tests/components/uitest/ThemeTest.java
new file mode 100644
index 0000000000..86847fc28e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/uitest/ThemeTest.java
@@ -0,0 +1,209 @@
+package com.vaadin.tests.components.uitest;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.testbench.elementsbase.ServerClass;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.FixedNotificationElement;
+import com.vaadin.tests.tb3.newelements.WindowElement;
+
+public abstract class ThemeTest extends MultiBrowserTest {
+
+ @ServerClass("com.vaadin.ui.DateField")
+ public static class DateFieldElement extends
+ com.vaadin.testbench.elements.DateFieldElement {
+ public void openPopup() {
+ findElement(By.tagName("button")).click();
+ }
+ }
+
+ @ServerClass("com.vaadin.ui.TabSheet")
+ public static class TabSheetElement extends
+ com.vaadin.testbench.elements.TabSheetElement {
+ @Override
+ public void openTab(String tabCaption) {
+ super.openTab(tabCaption);
+ /* Layouting takes a moment after tab has been opened. */
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ @Override
+ protected boolean requireWindowFocusForIE() {
+ return true;
+ }
+
+ @Override
+ protected Class<?> getUIClass() {
+ return ThemeTestUI.class;
+ }
+
+ protected abstract String getTheme();
+
+ @Test
+ public void testTheme() throws Exception {
+ openTestURL("theme=" + getTheme());
+ runThemeTest();
+ }
+
+ private void runThemeTest() throws IOException {
+ TabSheetElement themeTabSheet = $(TabSheetElement.class).first();
+
+ // Labels tab
+ compareScreen("labels");
+
+ // Buttons tab
+ themeTabSheet.openTab("Buttons");
+ compareScreen("buttons");
+
+ // Embedded tab
+ themeTabSheet.openTab("Embedded");
+ compareScreen("embedded");
+
+ // Dates tab
+ themeTabSheet.openTab("Dates");
+ testDates();
+
+ // TextFields tab
+ themeTabSheet.openTab("TextFields");
+ compareScreen("textfields");
+
+ // Selects tab
+ themeTabSheet.openTab("Selects");
+ testSelects();
+
+ // Sliders tab
+ themeTabSheet.openTab("Sliders");
+ compareScreen("sliders");
+
+ // Uploads tab
+ themeTabSheet.openTab("Uploads");
+ compareScreen("uploads");
+
+ // Forms tab
+ themeTabSheet.openTab("Forms");
+ compareScreen("forms");
+
+ // Tables tab
+ themeTabSheet.openTab("Tables");
+ testTables();
+
+ // Trees tab
+ themeTabSheet.openTab("Trees");
+ compareScreen("trees");
+
+ // TreeTable tab
+ themeTabSheet.openTab("TreeTable");
+ compareScreen("treetable");
+
+ // Layouts tab
+ themeTabSheet.openTab("Layouts");
+ compareScreen("layouts");
+
+ // TabSheets tab
+ themeTabSheet.openTab("TabSheets");
+ compareScreen("tabsheets");
+
+ // Accordions tab
+ themeTabSheet.openTab("Accordions");
+ compareScreen("accordions");
+
+ // Windows tab
+ themeTabSheet.openTab("Windows");
+ testWindows();
+
+ // Notifications tab
+ themeTabSheet.openTab("Notifications");
+ testNotifications();
+ }
+
+ private void testNotifications() throws IOException {
+ testNotification(0, "notification-humanized");
+ testNotification(1, "notification-warning");
+ testNotification(2, "notification-error");
+ testNotification(3, "notification-tray");
+ }
+
+ private void testNotification(int id, String identifier) throws IOException {
+ $(ButtonElement.class).id("notifButt" + id).click();
+ compareScreen(identifier);
+ $(FixedNotificationElement.class).first().close();
+ }
+
+ protected void testWindows() throws IOException {
+ testWindow(0, "subwindow-default");
+ }
+
+ protected void testWindow(int id, String identifier) throws IOException {
+ $(ButtonElement.class).id("windButton" + id).click();
+ compareScreen(identifier);
+ WindowElement window = $(WindowElement.class).first();
+ if (getTheme() == "chameleon"
+ && BrowserUtil.isIE(getDesiredCapabilities())) {
+ new Actions(getDriver()).moveToElement(window, 10, 10).click()
+ .sendKeys(Keys.ESCAPE).perform();
+ } else {
+ window.findElement(By.className("v-window-closebox")).click();
+ }
+ }
+
+ private void testTables() throws IOException {
+ compareScreen("tables");
+ TableElement table = $(TableElement.class).first();
+ new Actions(driver).moveToElement(table.getCell(0, 1), 5, 5)
+ .contextClick().perform();
+ compareScreen("tables-contextmenu");
+ table.findElement(By.className("v-table-column-selector")).click();
+ compareScreen("tables-collapsemenu");
+ }
+
+ private void testSelects() throws IOException {
+ compareScreen("selects");
+ $(ComboBoxElement.class).id("select0").openPopup();
+ compareScreen("selects-first-open");
+ $(ComboBoxElement.class).id("select1").openPopup();
+ compareScreen("selects-second-open");
+ $(ComboBoxElement.class).id("select6").openPopup();
+ compareScreen("selects-third-open");
+
+ /* In chameleon theme search combobox has no visible popup button */
+ ComboBoxElement searchComboBox = $(ComboBoxElement.class).id("select7");
+ if (searchComboBox.findElement(By.tagName("div")).isDisplayed()) {
+ searchComboBox.openPopup();
+ } else {
+ WebElement textBox = searchComboBox.findElement(By
+ .vaadin("#textbox"));
+ textBox.click();
+ textBox.sendKeys(Keys.ARROW_DOWN);
+ }
+ compareScreen("selects-fourth-open");
+
+ $(ComboBoxElement.class).id("select8").openPopup();
+ compareScreen("selects-fifth-open");
+ }
+
+ private void testDates() throws IOException {
+ compareScreen("dates");
+ $(DateFieldElement.class).id("datefield0").openPopup();
+ compareScreen("dates-first-popup");
+ $(DateFieldElement.class).id("datefield1").openPopup();
+ compareScreen("dates-second-popup");
+ $(DateFieldElement.class).id("datefield2").openPopup();
+ compareScreen("dates-third-popup");
+ $(DateFieldElement.class).id("datefield3").openPopup();
+ compareScreen("dates-fourth-popup");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/FixedNotificationElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/FixedNotificationElement.java
index a3eb952ea7..8f8dd82d9f 100644
--- a/uitest/src/com/vaadin/tests/tb3/newelements/FixedNotificationElement.java
+++ b/uitest/src/com/vaadin/tests/tb3/newelements/FixedNotificationElement.java
@@ -19,7 +19,7 @@ public class FixedNotificationElement extends NotificationElement {
@Override
public void close() {
- click();
+ click(5, 5);
WebDriverWait wait = new WebDriverWait(getDriver(), 10);
wait.until(ExpectedConditions.not(ExpectedConditions
.presenceOfAllElementsLocatedBy(By.className("v-Notification"))));