I am using Nightwatch.js for our e2e testing. All configuration has been tested successfully locally against both a local selenium server as well as a sauce labs cloud server. However, when travis-ci runs the same sauce labs configuration via sauce connect it fails. The two sides seem to engage correctly initially but then the selenium commands do not seem to reach the test server running in http://localhost:3000 in travis. I believe I've ruled out any latency issues by increasing the wait time to up to 30 seconds. Following are some logs for both sides. Anything I'm overlooking?
1) Travis logs show sauce connect establish a secure tunnel successfully:
Extracting Sauce Connect
Waiting for Sauce Connect readyfile
16 Feb 03:15:38 - Sauce Connect 4.3.13, build 1877 d9e5947
16 Feb 03:15:38 - Using CA certificate bundle /etc/ssl/certs/ca-certificates.crt.
16 Feb 03:15:38 - Using CA certificate verify path /etc/ssl/certs.
16 Feb 03:15:38 - Starting up; pid 4428
16 Feb 03:15:38 - Command line arguments: sc-4.3.13-linux//bin/sc -i 3101.1 -f sauce-connect-ready-15989 -l /home/travis/sauce-connect.log
16 Feb 03:15:38 - Using no proxy for connecting to Sauce Labs REST API.
16 Feb 03:15:38 - Resolving saucelabs.com to 162.222.75.243 took 13 ms.
16 Feb 03:15:38 - Started scproxy on port 59947.
16 Feb 03:15:38 - Please wait for 'you may start your tests' to start your tests.
16 Feb 03:15:38 - Starting secure remote tunnel VM...
16 Feb 03:15:41 - Secure remote tunnel VM provisioned.
16 Feb 03:15:41 - Tunnel ID: bd1ca94199724fddb1700dfa648706de
16 Feb 03:15:42 - Secure remote tunnel VM is now: booting
16 Feb 03:15:44 - Secure remote tunnel VM is now: running
16 Feb 03:15:44 - Using no proxy for connecting to tunnel VM.
16 Feb 03:15:44 - Resolving tunnel hostname to 162.222.75.26 took 311ms.
16 Feb 03:15:44 - Starting Selenium listener...
16 Feb 03:15:44 - Establishing secure TLS connection to tunnel...
16 Feb 03:15:45 - Selenium listener started on port 4445.
16 Feb 03:15:57 - Sauce Connect is up, you may start your tests.
2) Travis Logs show local test app server (e2e) started correctly (it binds to localhost:3000):
KeystoneJS Started:
```
3) Travis logs show tests starting and then timing out:
Running: Keystone should have a signin view
Timed out while waiting for element to be present for 30000 milliseconds. - expected "visible" but got: not found at Object.module.exports.Keystone should have a signin view FAILED: 1 assertions failed (37.752s)
4) In the other side sauce lab shows:
20:10:21.795 INFO - Launching a standalone Selenium Server
Setting system property webdriver.firefox.logfile to /home/chef/log/firefox.log
Setting system property webdriver.server.session.timeout to 0
20:10:21.848 INFO - Java: Oracle Corporation 25.72-b15
20:10:21.849 INFO - OS: Linux 3.13.0-32-generic i386
20:10:21.862 INFO - v2.48.0, with Core v2.48.0. Built from revision b7b081a
20:10:21.954 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
20:10:21.955 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
20:10:21.955 INFO - Driver class not found: com.opera.core.systems.OperaDriver
20:10:21.955 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
20:10:22.064 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4443/wd/hub
20:10:22.064 INFO - Selenium Server is up and running
20:10:22.287 INFO - Executing: [new session: Capabilities [{acceptSslCerts=true, webdriver.remote.quietExceptions=true, browserName=firefox, javascriptEnabled=true}]])
20:10:22.311 INFO - Creating a new session for Capabilities [{acceptSslCerts=true, webdriver.remote.quietExceptions=true, browserName=firefox, javascriptEnabled=true}]
20:10:25.435 INFO - Done: [new session: Capabilities [{acceptSslCerts=true, webdriver.remote.quietExceptions=true, browserName=firefox, javascriptEnabled=true}]]
20:10:25.842 INFO - Executing: [execute script: return screen.width, []])
20:10:25.949 INFO - Done: [execute script: return screen.width, []]
20:10:25.955 INFO - Executing: [execute script: return screen.height, []])
20:10:26.293 INFO - Done: [execute script: return screen.height, []]
20:10:26.300 INFO - Executing: [set window position])
20:10:26.314 INFO - Done: [set window position]
20:10:26.322 INFO - Executing: [set window size])
20:10:26.374 INFO - Done: [set window size]
20:10:26.378 INFO - Executing: [maximise window])
20:10:26.387 INFO - Done: [maximise window]
20:10:26.391 INFO - Executing: [get window handles])
20:10:26.399 INFO - Done: [get window handles]
20:10:28.944 INFO - Executing: [get: http://localhost:3000/keystone])
20:10:29.015 INFO - Done: [get: http://localhost:3000/keystone]
20:10:29.527 INFO - Executing: [find elements: By.cssSelector: div#signin-view])
20:10:29.536 INFO - Done: [find elements: By.cssSelector: div#signin-view]
20:10:30.031 INFO - Executing: [find elements: By.cssSelector: div#signin-view])
20:10:30.040 INFO - Done: [find elements: By.cssSelector: div#signin-view]
20:10:30.897 INFO - Executing: [find elements: By.cssSelector: div#signin-view])
20:10:30.906 INFO - Done: [find elements: By.cssSelector: div#signin-view]
20:10:31.404 INFO - Executing: [find elements: By.cssSelector: div#signin-view])
20:10:31.413 INFO - Done: [find elements: By.cssSelector: div#signin-view]
...<REPEATS UNTIL TIMEOUT>
5) The Nightwatch sauce labs config looks like this:
"saucelabs" : {
"selenium_host" : "ondemand.saucelabs.com",
"selenium_port" : 80,
"username" : "${SAUCE_USERNAME}",
"access_key" : "${SAUCE_ACCESS_KEY}",
"use_ssl" : false,
"silent" : true,
"output" : true,
"screenshots" : {
"enabled" : false,
"on_failure" : true,
"path" : ""
},
"desiredCapabilities": {
"name" : "test-firefox",
"browserName" : "firefox",
},
"selenium" : {
"start_process" : false
}
},
For the benefit of others running into the same problem the solution for this particular issue was to add a tunnel identifier as in:
"desiredCapabilities": {
"name": "test-firefox",
"browserName": "firefox",
"tunnel-identifier": "${TRAVIS_JOB_NUMBER}"
}