我試圖用量角器一些端到端的測試,以前也從來沒有使用過。該項目使用yeoman-gulp-angular生成,並且有一些預定義的測試任務/配置。當我嘗試執行任務時,我看到硒已經啓動,然後在硒關閉之前堆棧跟蹤輸出一些錯誤。配置中是否缺少某些東西?角E2E - 錯誤與硒/量角器配置
量角器配置
'use strict';
var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;
// An example configuration file.
exports.config = {
// The address of a running selenium server.
//seleniumAddress: 'http://localhost:4444/wd/hub',
//seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: [paths.e2e + '/**/*.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
堆棧跟蹤
Starting selenium standalone server...
(node:23800) DeprecationWarning: util.puts is deprecated. Use console.log instead.
Selenium standalone server started at http://[IP]/wd/hub
Stacktrace:
UnknownError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"23817.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=56.0.2924.87)
(Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
...
Stacktrace:
UnknownError: Error communicating with the remote browser. It may have died.
...
Finished in 4.84 seconds
2 tests, 4 assertions, 4 failures
Shutting down selenium standalone server.
編輯
[launcher] Error: UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
xpi","e":true,"v":"1.7","st":1486662567000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","e":true,"v":"1.0.5","st":1486662567000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","e":true,"v":"1.0","st":1486662567000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"/Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"51.0.1","st":1486662567000}}}
更新
我想的事情是固定的,但事實並非如此。運行後webdriver-manager update
,然後webdriver-manager status
我看到chromedriver version available: 2.27 [last]
。當我查看node_modules /量角器/硒時,我看到chromedriver_2.12.zip
。在node_modules/protractor/config.json中,我將chromedriver的webdriverVersions從2.12更改爲2.27,這是不可用的。不知道我應該在量角器/config.json中指定哪個版本。
test-mbp:fota-admin-portal test$ gulp protractor:src
[11:48:17] Starting 'webdriver-update'...
selenium standalone is up to date.
Updating chromedriver
downloading https://chromedriver.storage.googleapis.com/2.27/chromedriver_mac32.zip...
Error: Got code 404 from https://chromedriver.storage.googleapis.com/2.27/chromedriver_mac32.zip
chromedriver_2.27.zip downloaded to /Users/test/project/node_modules/protractor/selenium/chromedriver_2.27.zip
/Users/test/project/node_modules/adm-zip/adm-zip.js:19
throw Utils.Errors.INVALID_FILENAME;
^
Invalid filename
堆棧跟蹤
Stacktrace:
UnknownError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"26574.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=56.0.2924.87)
(Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
謝謝!這解決了鉻問題,但現在我看到一個Firefox連接錯誤,我沒有在量角器conf文件中定義的firefox。從我讀過的內容看,這似乎是硒和最新的Firefox的一個問題。問題是爲什麼當我甚至沒有將它傳遞給配置文件時,調用firefox?見上面的編輯。 – neridaj