Object [][] table = new Object[][]{
{new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile")},
{new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS}
};
for (int i=0; i<2; i++) {
GalenBasicTest suite = galenSuites.get(i);
assertThat(suite.getName(), is("Test for " + table[i][2]));
assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
// Checking page 1
GalenPageTest page = suite.getPageTests().get(0);
assertThat(page.getUrl(), is("http://example.com/page1"));
assertThat(page.getScreenSize(), is((Dimension)table[i][0]));
assertThat(page.getActions(), is(actions(
GalenPageActions.check(asList("page1.spec")).withIncludedTags((List<String>) table[i][1]).withExcludedTags((List<String>) table[i][3])
)));
}
}
/* Checking second group of suites */
{
Object [][] table = new Object[][]{
{new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile"), "page1"},
{new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS, "page2"},
{new Dimension(1024, 768), asList("desktop"), "Desktop", asList("nodesktop"), "page3"}
};
for (int i=2; i<5; i++) {
int j = i - 2;
GalenBasicTest suite = galenSuites.get(i);
assertThat(suite.getName(), is("Test combining 2 tables for " + table[j][2]));
assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
// Checking page 1
GalenPageTest page = suite.getPageTests().get(0);
assertThat(page.getUrl(), is("http://example.com/" + table[j][4]));
assertThat(page.getScreenSize(), is((Dimension)table[j][0]));
assertThat(page.getActions(), is(actions(
GalenPageActions.check(asList("page1.spec")).withIncludedTags((List<String>) table[j][1]).withExcludedTags((List<String>) table[j][3])
)));
}
}
/* Checking 3rd group of suites */
{
Object[][] table = new Object[][]{
{new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile"), "page1", "firefox", "Firefox", "any"},
{new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS, "page2", "firefox", "Firefox", "any"},
{new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile"), "page1", "ie", "IE 8", "8"},
{new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS, "page2", "ie", "IE 8", "8"},
{new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile"), "page1", "ie", "IE 9", "9"},
{new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS, "page2", "ie", "IE 9", "9"},
};
for (int i=5; i<11; i++) {
int j = i - 5;
GalenBasicTest suite = galenSuites.get(i);
assertThat(suite.getName(), is("Test using 2 layer tables in browser " + table[j][6] + " for type " + table[j][2]));
assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
// Checking page 1
GalenPageTest page = suite.getPageTests().get(0);
assertThat(page.getBrowserFactory(), is((BrowserFactory)new SeleniumGridBrowserFactory("http://mygrid:8080/wd/hub")
.withBrowser((String)table[j][5])
.withBrowserVersion((String)table[j][7])
));
assertThat(page.getUrl(), is("http://example.com/" + table[j][4]));