To select which platform/browser combinations to test on, set the SAUCE_ONDEMAND_BROWSERS environment variable to a string such as:
[
{
"platformName": "Windows 10",
"browserName": "Chrome",
"browserVersion": "latest",
"screenResolution": "1280x960"
},
{
"platformName":"Android",
"platformVersion":"12.0",
"browserName":"Chrome",
"deviceName": "Android GoogleAPI Emulator",
"automationName": "UiAutomator2"
}
]Then execute maven:
mvn clean verify -Djava.locale.providers=COMPAT,SPI \
-Dit.test=pt.arquivo.tests.** \
-Dtest.url=https://preprod.arquivo.pt \
-Dtest.saucelabs.user=xxxx \
-Dtest.saucelabs.key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
-Dtest.selenium.host=ondemand.us-west-1.saucelabs.com \
-Dtest.selenium.port=443To debug tests add the argument:
-Dmaven.failsafe.debugFirst start the proxy:
/root/sc-4.4.12-linux/bin/sc --user xxxx --api-key xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --se-port 4444 --tunnel-name teste mvn clean verify -Djava.locale.providers=COMPAT,SPI \
-Dit.test=pt.arquivo.tests.** \
-Dtest.url=https://preprod.arquivo.pt \
-Dtest.saucelabs.user=xxxx \
-Dtest.saucelabs.key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
-Dtest.selenium.host=localhost \
-Dtest.selenium.port=4444 \
-Dtest.saucelabs.tunnelname=testeIn some cases when the test or tunnel is closed incorrectly a process is pending which makes it impossible to run the test again. So, use the following steps:
ps aux | grep scAnd a process will appear with a name similar to "/root/sc-4.4.12-linux/bin/sc -u ArquivoPT". Then,
kill process_IDUse sauce labs directly for development of this tests could take too much time. Another aproach is to replace sauce labs with a local selenium grid.
On a different shell start selenium grid using:
docker-compose upAnd another run your tests like:
mvn clean verify \
-Dit.test=pt.arquivo.tests.webapp.imagesearch.ImageSearchTest \
-Dtest.url=https://arquivo.pt \
-Djava.locale.providers=COMPAT,SPI \
-Dtest.selenium.port=4444 \
-Dtest.selenium.host=localhostMore information on: https://github.com/SeleniumHQ/docker-selenium