Javascript 当使用Nightwatch/Cucumber实现无头e2e测试时,React路由器似乎不会呈现下一页
我正在尝试在我的React应用程序上使用nightwatch、Cucumber和nightwatch Cucumber(不推荐使用-之后可能会使用不同的e2e,但现在我必须让它工作)实现一个无头e2e测试。本地的一切都很好,但是当我运行headless时,它要么无法加载下一页,要么css选择器无法工作。我强烈认为这是第一次 我在试着调试时遇到了一些麻烦。任何其他调试方法都将不胜感激。除了在更改nightwatch.config文件并尝试不同的css选择器之后再次运行测试脚本之外,我不知道还有什么要做Javascript 当使用Nightwatch/Cucumber实现无头e2e测试时,React路由器似乎不会呈现下一页,javascript,reactjs,cucumber,e2e-testing,Javascript,Reactjs,Cucumber,E2e Testing,我正在尝试在我的React应用程序上使用nightwatch、Cucumber和nightwatch Cucumber(不推荐使用-之后可能会使用不同的e2e,但现在我必须让它工作)实现一个无头e2e测试。本地的一切都很好,但是当我运行headless时,它要么无法加载下一页,要么css选择器无法工作。我强烈认为这是第一次 我在试着调试时遇到了一些麻烦。任何其他调试方法都将不胜感激。除了在更改nightwatch.config文件并尝试不同的css选择器之后再次运行测试脚本之外,我不知道还有什么
//test devDependencies
"devDependencies": {
"chai": "^3.5.0",
"cucumber": "^4.0.0",
"cucumber-pretty": "^1.4.0",
"dotenv": "^5.0.1",
"https-proxy-agent": "^2.2.1",
"nightwatch": "^0.9.19",
"nightwatch-cucumber": "^9.1.0",
"selenium-server": "^3.9.1",
"wait-on": "^2.1.0"
}
// nightwatch.config
const seleniumServer = require('selenium-server');
require('dotenv').config({ path: `.env_${process.env.NODE_ENV || `local`}` })
require('nightwatch-cucumber')({
cucumberArgs: [
'--require', 'step-definitions',
'--format', 'node_modules/cucumber-pretty',
'--format', 'json:reports/test-results.json',
'features']
});
// Determines if the local enviornment is local or jenkins
const env = process && process.env && process.env.NODE_ENV || `local`;
console.log(`~!~!~!~! ${process.env.NODE_ENV}`)
module.exports = {
"output_folder": "reports",
"selenium": {
"start_process": true,
"server_path": seleniumServer.path,
"log_path": "",
"port": 9876,
"cli_args": {
"webdriver.chrome.driver": env === `local`
? `./chromedriver`
: `/usr/bin/chromedriver`
}
},
"test_settings": {
// Used as default
"default": {
"selenium_port": 9876,
"selenium_host": "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"acceptSslCerts": true,
"javascriptEnabled": true,
"acceptInsecureCerts": true,
"chromeOptions": {
"args": [
"--headless",
"disable-web-security",
"ignore-certificate-errors",
"no-sandbox",
"disable-gpu"
]
}
}
},
// Used for local chrome browser testing
"local": {
"selenium_port": 9876,
"selenium_host": "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptInsecureCerts": true,
"chromeOptions": {
"args": [
"disable-web-security",
"ignore-certificate-errors",
"no-sandbox",
"disable-gpu",
"window-size=1440,900"
]
}
}
},
// Used for PR build pipeline
"build": {
"selenium_port": 9876,
"selenium_host": "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptInsecureCerts": true,
"chromeOptions": {
"args": [
"headless",
"disable-web-security",
"ignore-certificate-errors",
"no-sandbox",
"disable-gpu",
"window-size=1440,900"
]
}
}
},
// Used for Regression
"redblu": {
"selenium_port": 8080,
"selenium_host": "bluxpress-sts.clouddqt.capitalone.com",
"desiredCapabilities": {
"browserName" : "chrome",
"recordVideo" : true,
"name" : "aviator-ui-test",
"acceptSslCerts": true,
"acceptInsecureCerts": true,
"javascriptEnabled": true,
"chromeOptions": {
"args": [
"ignore-certificate-errors",
"disable-gpu",
"no-sandbox",
"start-maximized"
]
}
}
}
}
};
我有这个设置,但当我运行无头夜表,它失败了。每样东西都在本地工作。它当时不支持macos吗