Skip to content

Commit

Permalink
Convert old theme test to new MultiBrowserThemeTest
Browse files Browse the repository at this point in the history
Change-Id: Ia99fc3d9474d7cd63402b01e3784ffea7f05a760
  • Loading branch information
Artur- committed Sep 3, 2015
1 parent bbe811e commit 054cff0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 160 deletions.
23 changes: 0 additions & 23 deletions uitest/src/com/vaadin/tests/components/uitest/BaseThemeTest.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions uitest/src/com/vaadin/tests/components/uitest/RunoThemeTest.java

This file was deleted.

36 changes: 22 additions & 14 deletions uitest/src/com/vaadin/tests/components/uitest/ThemeTest.java
Expand Up @@ -13,11 +13,11 @@
import com.vaadin.testbench.elements.TableElement; import com.vaadin.testbench.elements.TableElement;
import com.vaadin.testbench.elementsbase.ServerClass; import com.vaadin.testbench.elementsbase.ServerClass;
import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserThemeTest;
import com.vaadin.tests.tb3.newelements.FixedNotificationElement; import com.vaadin.tests.tb3.newelements.FixedNotificationElement;
import com.vaadin.tests.tb3.newelements.WindowElement; import com.vaadin.tests.tb3.newelements.WindowElement;


public abstract class ThemeTest extends MultiBrowserTest { public class ThemeTest extends MultiBrowserThemeTest {


@ServerClass("com.vaadin.ui.DateField") @ServerClass("com.vaadin.ui.DateField")
public static class DateFieldElement extends public static class DateFieldElement extends
Expand Down Expand Up @@ -51,15 +51,9 @@ protected Class<?> getUIClass() {
return ThemeTestUI.class; return ThemeTestUI.class;
} }


protected abstract String getTheme();

@Test @Test
public void testTheme() throws Exception { public void testTheme() throws Exception {
openTestURL("theme=" + getTheme()); openTestURL();
runThemeTest();
}

private void runThemeTest() throws IOException {
TabSheetElement themeTabSheet = $(TabSheetElement.class).first(); TabSheetElement themeTabSheet = $(TabSheetElement.class).first();


// Labels tab // Labels tab
Expand Down Expand Up @@ -161,12 +155,26 @@ protected void testWindow(int id, String identifier) throws IOException {
} }


private void testTables() throws IOException { private void testTables() throws IOException {

compareScreen("tables"); compareScreen("tables");
TableElement table = $(TableElement.class).first(); final TableElement table = $(TableElement.class).first();
new Actions(driver).moveToElement(table.getCell(0, 1), 5, 5) if (!BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
.contextClick().perform(); // Context click does not work in phantom js
compareScreen("tables-contextmenu"); new Actions(driver).moveToElement(table.getCell(0, 1), 5, 5)
table.findElement(By.className("v-table-column-selector")).click(); .contextClick().perform();
compareScreen("tables-contextmenu");

// Close context menu before opening collapsemenu
// (https://dev.vaadin.com/ticket/18770)
WebElement cm = findElement(By.className("v-contextmenu"));
cm.findElement(By.xpath("//div[text()='Save']")).click();
}

WebElement columnSelector = table.findElement(By
.className("v-table-column-selector"));
new Actions(driver).moveToElement(columnSelector, 5, 5).click()
.perform();

compareScreen("tables-collapsemenu"); compareScreen("tables-collapsemenu");
} }


Expand Down
4 changes: 4 additions & 0 deletions uitest/src/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
Expand Up @@ -39,6 +39,10 @@ public void setTheme(String theme) {
this.theme = theme; this.theme = theme;
} }


protected String getTheme() {
return theme;
}

@Parameters @Parameters
public static Collection<String> getThemes() { public static Collection<String> getThemes() {
return Arrays.asList(new String[] { "valo", "reindeer", "runo", return Arrays.asList(new String[] { "valo", "reindeer", "runo",
Expand Down

0 comments on commit 054cff0

Please sign in to comment.