Selenium grid configuration for the functional testing of AlloyUI.
Running all the tests on all the environment takes some time. On average it takes 1min to run all the tests on Chrome on a last-generation MacBook Pro. Running on all the browsers we plan to support should take about 1 hour.
It is important to test the AlloyUI framework with major browsers. Both desktop and mobile.
The following environments were chosen for this first step using the Selenium grid.
- Google Chrome (Linux or OS X)
- Firefox (Linux or OS X)
- Safari (OS X)
- Safari mobile (simulator on OS X)
- Android (simulator on Linux or OS X)
- Internet Explorer 8, 9, 10, 11 (Windows)
Unless specified, we use the latest available version for operating systems, web drivers, and browsers.
Free virtual machines with different versions of Internet Explorer can be downloaded from modern.IE.
Run gulp ci
to run the integration tests.
The tests suites are run in series (one browser after the other) with yeti reading the capabilities.json file.
We can make the task faster making the tests run in parallel in the future.
If we decide to do this the following should be considered:
- yeti's integration with Selenium needs improvement to run tests in parallel without waiting for all browsers to be available (what wastes Selenium availability)
- we need to keep track of each browser log individually without getting a mengled log
- focus issue (more on that later)
The hub works like a bridge between the Selenium clients (test runners) and the nodes (browser drivers).
Start the HUB with
java -jar selenium-server-standalone-<version>.jar -role hub -hubConfig hub.json
Start a node with
java -jar selenium-server-standalone-<version>.jar -role node -hub <hub> -nodeConfig node.json
Where hub is the hub HTTP address.
To pass a system property use -DpropertyName=value
.
The Selenium standalone server already comes with some browser drivers, but you may need to install another driver. For example, to use Internet Explorer you must get a driver fot it.
Download the InternetExplorerDriver.
To execute it, you use something like
java -jar selenium-server-standalone-<version>.jar -role node -hub http://192.168.70.1:4444/ -Dwebdriver.ie.driver="IEDriverServer.exe" -nodeConfig ie8.json
Some tests might fail if the browser isn't in focus. Also, commands sent to IE might not work.
This is why it might be a good idea to have a single browser running on a Selenium node.
Verify the issue IE11 exceptions with IEDriverServer: Unable to get browser and edit the Windows Registry accordingly to make the IE11 driver work.
- Browser zoom level not set to 100% made Selenium throw an exception on IE.
- If yeti dies for some unknown reason a browser may hang for a few minutes before being killed by Selenium
Reference: https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Browser_Focus
Install Android Studio and create an Android System Image with a Nexus virtual device running the latest Android version inside it. It'll create an ~/.android
directory with the virtual machine.
Then, run a Selendroid node and register it on the HUB.
Make sure you have Xcode and the iOS Simulator installed on your system.
Then download the ios-driver. See the basics of how to patch your iPhoneSimulator to work with it, and add it as a node on the grid. It's similar to Selendroid.