@Test
void CheckMobileLayout()
{
checkLayout("mobile")
}
private void checkLayout(String platform)
{
Properties properties = new Properties()
properties.load(new FileInputStream(getTestResource("test.properties")))
load(WebDriverRunner.webDriver.currentUrl)
Browser browser = new SeleniumBrowser(WebDriverRunner.webDriver)
browser.changeWindowSize(platform == "desktop" ? new Dimension(1024, 750) : new Dimension(300, 700))
Galen.checkLayout(browser,
specPath,
new SectionFilter(asList(platform, "all"), Collections.emptyList()),
properties,
Collections.emptyMap(),
null,
null,
locators)
}
= Landing Page =
@on *
mainTitle:
text is "DevelopingScientists"
above mainTitleDescription
mainTitleDescription:
below mainTitle
above educationButton
educationButton:
css background-color is ${BRIGHT_GREEN}
discoveryButton:
css background-color is ${GREEN}
leadershipButton:
css background-color is ${GREEN}
@on desktop
educationButton:
left-of discoveryButton
discoveryButton:
right-of educationButton
left-of leadershipButton
leadershipButton:
right-of discoveryButton
@on mobile
educationButton:
above discoveryButton
discoveryButton:
below educationButton
above leadershipButton
leadershipButton:
above discoveryButton
@@ Set
page_name it-it/
page_url http://url/${page_name}
page_spec_url c:/***/***/homepage_IT.gspec
@@ Parameterized
| viewport | size |
| mobile | 480x640 |
| tablet | 768x1024 |
| desktop | 1366x768 |
${page_name} ${viewport} viewport ${full_name}
${page_url} ${size}
check ${page_spec_url} --include "${viewport}"
#
@import modules/homepage_header_it.gspec
Is the import feature supported using Java ?
The file runs fine if I use a .test file and run it on CMD.
Thanks
Niko
protected void executeGalenSpec(List<String> tags, String specPath, Closure doSomething)
{
tags = new LinkedList<>(tags)
tags << browser
Properties properties = new Properties()
properties.load(new FileInputStream(getTestResource("test.properties")))
load(WebDriverRunner.webDriver.currentUrl)
if (doSomething != null)
{
doSomething()
}
Browser browser = new SeleniumBrowser(WebDriverRunner.webDriver)
browser.changeWindowSize(tags.contains("desktop") ? new java.awt.Dimension(1200, 700) : new java.awt.Dimension(300, 700))
SectionFilter sectionFilter = new SectionFilter(tags, [] as List)
LayoutReport layoutReport = Galen.checkLayout(browser,
specPath,
sectionFilter,
properties,
Collections.emptyMap(),
null,
null,
galenLocators)
getReport().layout(layoutReport, "Checking " + this.class.getName() + " for tags: " + tags.each { it + "," })
if (layoutReport.errors() > 0)
{
throw new LayoutValidationException(specPath, layoutReport, sectionFilter)
}
}
@Test
void CheckMobileLayout()
{
executeGalenSpec(["mobile"], "/path/to/file.gspec", { /* a closure with any action that must be performed in the browser before executing your tests using selenium or some other framework */ })
}
# Params for page A
BRIGHT_GREEN="rgb(119, 187, 78)"
GREEN="rgb(0, 166, 75)"
TEAL="rgb(0, 141, 152)"
ORANGE="rgb(228, 112, 0)"
LIGHT_GRAY="rgb(232, 232, 232)"
MEDIUM_GRAY="rgb(119, 119, 119)"
DARK_GRAY="rgb(83, 85, 84)"
BLACK="rgb(0, 0, 0)"
BLUE="rgb(0, 72, 140)"
WHITE="rgb(255, 255, 255)"
# Params for page B
SECTION1_TITLE="TITLE 1"
SECTION2_TITLE="TITLE 2"
SECTION3_TITLE="TITLE 3"
SECTION4_TITLE="TITLE 4"
I have modified the spec file intentionally to check if the login button is above the password field. Even though the button is displayed below the password field the report does not show it as fail. Request your help in this regard.