HsacExamples.SlimTests.BrowserTests.SuiteSetUp


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.

Fixture code locations


Import
nl.hsac.fitnesse.fixture.slim.web


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.

variable defined: GRID_HUB=http://remote-selenium.local:4444/wd/hub

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<-[
userAgent 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
deviceMetrics
width 360
height 640
pixelRatio 3.0
]
copy map

Define $chromeHeadlessProfile chrome profile


script map fixture
set value headless for args[0]
set value disable-gpu for args[1]
$chromeHeadlessProfile<-[
args [headless, disable-gpu]
]
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<-[
ie.ensureCleanSession true
]
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
deviceName Apple iPhone 6
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
browserName internet explorer
platform Windows 8.1
version 11
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.RemoteWebDriver
at ondemand.saucelabs.com
acceptInsecureCertsfalse
acceptSslCertsfalse
applicationCacheEnabledfalse
browserConnectionEnabledfalse
browserNamechrome
chrome{chromedriverVersion=80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}), userDataDir=C:\Users\ADMINI~1\AppData\Local\Temp\scoped_dir2056_282366603}
cssSelectorsEnabledtrue
databaseEnabledfalse
goog:chromeOptions{debuggerAddress=localhost:49760}
handlesAlertstrue
hasMetadatatrue
hasTouchScreenfalse
javascriptEnabledtrue
locationContextEnabledtrue
mobileEmulationEnabledfalse
nativeEventstrue
networkConnectionEnabledfalse
pageLoadStrategynormal
platformWINDOWS
platformNameWINDOWS
proxyProxy()
rotatablefalse
setWindowRecttrue
strictFileInteractabilityfalse
takesHeapSnapshottrue
takesScreenshottrue
timeouts{pageLoad=300000, implicit=0, script=30000}
unexpectedAlertBehaviourignore
unhandledPromptBehaviorignore
version80.0.3987.87
webStorageEnabledtrue
webdriver.remote.sessionid74ed0e4e6eb242638abd370a507c4669
Job details