通过 Nightwatch 的 Travis-CI 和 SauceLabs 集成失败
Travis-CI and SauceLabs integration via Nightwatch fails
我正在使用 Nightwatch.js 进行端到端测试。所有配置都已针对本地 selenium 服务器和 sauce labs 云服务器在本地成功测试。但是,当 travis-ci 通过 sauce connect 运行相同的 sauce labs 配置时,它会失败。双方最初似乎正确参与,但随后 selenium 命令似乎没有到达 travis http://localhost:3000 中的测试服务器 运行。我相信我已经通过将等待时间增加到最多 30 秒来排除任何延迟问题。以下是双方的一些日志。我忽略了什么吗?
1) Travis日志显示sauce connect成功建立安全隧道:
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 日志显示本地测试应用程序服务器 (e2e) 已正确启动(它绑定到 localhost:3000):
```
KeystoneJS 开始:
e2e 已在端口 3000 上准备就绪
```
3) Travis 日志显示测试开始然后超时:
[Group001 登录/Test001 有登录视图] 测试套件
运行: Keystone 应该有登录视图
等待元素出现 30000 毫秒时超时。 - 预期 "visible" 但得到:未在 Object.module.exports.Keystone 处找到应该有一个登录视图失败:1 个断言失败(37.752s)
4) 在另一边酱实验室显示:
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) Nightwatch sauce 实验室配置如下所示:
"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
}
},
为了其他人的利益 运行 遇到同样的问题,这个特定问题的解决方案是添加一个隧道标识符,如下所示:
"desiredCapabilities": {
"name": "test-firefox",
"browserName": "firefox",
"tunnel-identifier": "${TRAVIS_JOB_NUMBER}"
}
我正在使用 Nightwatch.js 进行端到端测试。所有配置都已针对本地 selenium 服务器和 sauce labs 云服务器在本地成功测试。但是,当 travis-ci 通过 sauce connect 运行相同的 sauce labs 配置时,它会失败。双方最初似乎正确参与,但随后 selenium 命令似乎没有到达 travis http://localhost:3000 中的测试服务器 运行。我相信我已经通过将等待时间增加到最多 30 秒来排除任何延迟问题。以下是双方的一些日志。我忽略了什么吗?
1) Travis日志显示sauce connect成功建立安全隧道:
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 日志显示本地测试应用程序服务器 (e2e) 已正确启动(它绑定到 localhost:3000):
```
KeystoneJS 开始:
e2e 已在端口 3000 上准备就绪
```
3) Travis 日志显示测试开始然后超时:
[Group001 登录/Test001 有登录视图] 测试套件
运行: Keystone 应该有登录视图
等待元素出现 30000 毫秒时超时。 - 预期 "visible" 但得到:未在 Object.module.exports.Keystone 处找到应该有一个登录视图失败:1 个断言失败(37.752s)
4) 在另一边酱实验室显示:
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) Nightwatch sauce 实验室配置如下所示:
"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
}
},
为了其他人的利益 运行 遇到同样的问题,这个特定问题的解决方案是添加一个隧道标识符,如下所示:
"desiredCapabilities": {
"name": "test-firefox",
"browserName": "firefox",
"tunnel-identifier": "${TRAVIS_JOB_NUMBER}"
}