我有这个带有一些测试的 github.js 文件:
module.exports = {
const homeToLoginPage = () => {
client
.url(homeURL)
...
};
const incorrectLoginFlow = () => {
client
.waitForElementVisible(selectors.loginInputField, timeout)
...
};
homeToLoginPage();
incorrectLoginFlow();
}
}
当我用 Google Chrome 运行它时
npm test -- -t tests/github.js
一切正常,但是当我尝试用 Firefox 运行它时 npm test -- -t tests/github.js --env firefox
我收到此错误消息:“Expected browser binary location, but unable to find binary in default location, no提供“moz:firefoxOptions.binary”功能,但未设置二进制标志
在命令行”。
我检查过 firefox.exe 位于:C:\Program Files\Mozilla Firefox,这应该是 Windows 的默认设置。
还有相关的night.conf.js文件:
module.exports = {
src_folders: ['tests'],
webdriver: {
start_process: true,
port: 4444
},
test_settings: {
default: {
desiredCapabilities: {
browserName: 'chrome'
},
webdriver: { server_path: require('chromedriver').path },
'screenshots': {
'enabled': true,
'on_failure': true,
'path': './screens'
},
'test_workers': {
'enabled': false,
'workers': 'auto'
},
},
firefox: {
desiredCapabilities: {
browserName: 'firefox'
},
webdriver: { server_path: require('geckodriver').path }
}
}
};
我搜索了很多,发现有人试图更改 moz:firefoxOptions 中的某些 Firefox 功能以手动记录 firefox.exe 的路径,但我找不到在哪里可以做。请给出一些建议如何在 Firefox 浏览器中运行测试。