使用 cypress 向 browserstack 启动测试时
目前,通过在我的开发环境(ubuntu)上运行命令来调试它
npm run browserstack
it calls the script from package.json "browserstack": "./node_modules/.bin/browserstack-cypress run --sync"
我的功能日志执行在browerstack构建仪表板中显示以下错误
Running: features\desktop.feature (NaN of undefined)
Oops...we found an error preparing this test file:
cypress\integration\features\desktop.feature
The error was:
Error: Can't walk dependency graph: Cannot find module 'C:UsershelloDocumentsdocumentscypress_testcypress_test_folder
ode_modulescypress-cucumber-preprocessorlib
esolveStepDefinition' from 'cypress_test_folder\cypress\integration\features'
required by cypress_test_folder\cypress\integration\features\desktop.feature
at cypress_test_folder\node_modules\browser-resolve\node_modules\resolve\lib\async.js:46:17
at process (cypress_test_folder\node_modules\browser-resolve\node_modules\resolve\lib\async.js:173:43)
at ondir (cypress_test_folder\node_modules\browser-resolve\node_modules\resolve\lib\async.js:188:17)
at load (cypress_test_folder\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (cypress_test_folder\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at cypress_test_folder\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
at callback (C:\Windows\cypress_package\6.8.0\node_modules\graceful-fs\polyfills.js:289:20)
at FSReqCallback.oncomplete (fs.js:172:21)
This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
- A missing file or dependency
- A syntax error in the file or one of its dependencies
Fix the error in your code and re-run your tests.
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 0 │
│ Passing: 0 │
│ Failing: 1 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 0 seconds │
│ Spec Ran: features\desktop.feature │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Uploading Results)
- Nothing to Upload
我的 browserstack.json 如下
{
"auth": {
"username": "<username>",
"access_key": "<access_key>"
},
"browsers": [
{
"os": "Windows 10",
"browser": "chrome",
"versions": ["latest"]
}
],
"run_settings": {
"cypress_version" : "6",
"cypress_config_file": "./cypress.json",
"project_name": "myproject",
"build_name": "ui-automation",
"specs": ["cypress/integration/features/desktop.feature","cypress/integration/features/desktop/desktop.js"],
"exclude": [],
"parallels": "Here goes the number of parallels you want to run",
"npm_dependencies": {
"cypress-cucumber-preprocessor": "^1.19.2",
"browserstack-cypress-cli": "^1.8.1",
"cypress": "^3.8.3",
"cypress-xpath": "^1.6.2"
},
"package_config_options": {
"cypress_options": {
"testFiles": "**/*.feature",
"ignoreTestFiles": "*.js",
"chromeWebSecurity": false
},
"cypress-cucumber-preprocessor_options": {
"nonGlobalStepDefinitions": true,
"step_definitions": "cypress/integration/features/dekstop/"
}
},
"headless": false
},
"connection_settings": {
"local": false,
"local_identifier": null,
"local_mode": null,
"local_config_file": null
},
"disable_usage_reporting": false
}
按照入门指南和任何其他提示,我没有发现发生了什么,尤其是在 browserstack 日志上,它试图找到一个带有 windows 路径的模块,而我所有的测试环境都在 linux ubuntu 上 > 我的目标是下一步运行所有这些都在 gitlab 上