This set up page is executed once, before any tests in this suite.
In it we configure which Java packages contain the logic for our fixtures, which browser we want to use for Selenium tests and we start this browser.
This means we do not have to do this in every test, which means easier maintenance and better performance.
Stopping the browser is done in SuiteTearDown, which is done after all tests in this suite are completed.
The Selenium configuration below uses lines starting with |note to have configuration values present that are not currently used.
This allows us to switch to another browser by just adding |note to one line and removing it from another, instead of typing the entire line.
Furthermore this configuration is prepared for both running the browser on the same (development) machine running Fitnesse (with start driver for), as remotely on a node in a Selenium Grid (with connect to driver for).
The latter allows tests to be executed on different operating systems. This is also very useful to run tests as part of a continuous integration server (i.e. build server), when no browsers are installed on the server running the tests.
This configuration can be overridden by using system properties. This allows different configurations on the build server to test with different browsers, without requiring different wiki content, but only requiring a different build configuration. More details can be found in OverridingSeleniumSetup.
Define $mobileEmulation device attributes
script | map fixture | ||||||||||||
set value | Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19 | for | userAgent | ||||||||||
set int value | 360 | for | deviceMetrics.width | ||||||||||
set int value | 640 | for | deviceMetrics.height | ||||||||||
set double value | 3.0 | for | deviceMetrics.pixelRatio | ||||||||||
$mobileEmulation<-[
|
copy map |
Define $chromeHeadlessProfile chrome profile
script | map fixture | ||||
set value | headless | for | args[0] | ||
set value | disable-gpu | for | args[1] | ||
$chromeHeadlessProfile<-[
|
copy map |
Define $ieCleanSession internet explorer profile
script | map fixture | ||||
expand periods in names to nested maps | false | ||||
set boolean value | true | for | ie.ensureCleanSession | ||
$ieCleanSession<-[
|
copy map |
script | selenium driver setup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
start driver for | chrome | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | MicrosoftEdge | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | internet explorer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | firefox | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | safari | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | chrome mobile emulation | with profile |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | chrome mobile emulation | with profile | $mobileEmulation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | chrome | with profile | $chromeHeadlessProfile | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | Starting internet explorer with a clean session is destructive, i.e. clears cookies, cache, history and saved form data globally | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | start driver for | internet explorer | with profile | $ieCleanSession | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | connect to driver for | chrome | at | http://remote-selenium.local:4444/wd/hub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | connect to driver for | MicrosoftEdge | at | http://remote-selenium.local:4444/wd/hub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | connect to driver for | internet explorer | at | http://remote-selenium.local:4444/wd/hub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | connect to driver for | firefox | at | http://remote-selenium.local:4444/wd/hub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | connect to driver at | http://remote-selenium.local:4444/wd/hub | with capabilities |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note | connect to driver at | http://remote-selenium.local:4444/wd/hub | with json capabilities | {aut:"io.selendroid.testapp", emulator: true} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
show | driver description | org.openqa.selenium.remote.RemoteWebDriverat ondemand.saucelabs.com
|