在浏览器堆栈中使用cypress启动测试时
现在,通过在我的dev环境(ubuntu)上运行该命令来调试它
npm run browserstack
it calls the script from package.json "browserstack": "./node_modules/.bin/browserstack-cypress run --sync"我的功能日志执行在浏览器堆栈构建仪表板中显示以下错误
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
}按照开始指南和任何其他提示,我没有发现发生了什么,特别是在浏览器堆栈日志上,它试图找到一个带有windows路径的模块,而我所有的测试环境都在linux ubuntu上>我的下一个目标是在gitlab上运行所有这些
发布于 2021-04-26 11:22:09
您可以在broserstack.json https://www.browserstack.com/docs/automate/cypress/npm-packages中添加npm依赖项中的所有依赖项吗?您可以在此处参考示例黄瓜柏树:https://github.com/ashwingonsalves/cypress-browserstack-cucumber
https://stackoverflow.com/questions/67227754
复制相似问题