【问题标题】:BrowserStack cypress Run > error with cypress-cucumber-preprocessor dependency graph + cypress folderBrowserStack cypress Run > cypress-cucumber-preprocessor 依赖图 + cypress 文件夹出错
【发布时间】:2021-04-23 09:51:05
【问题描述】:

使用 cypress 向浏览器堆栈启动测试时

目前,通过在我的开发环境(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 上运行所有这些

【问题讨论】:

    标签: testing automated-tests cypress browserstack cypress-cucumber-preprocessor


    【解决方案1】:

    你能把所有的依赖都添加到 broserstack.json https://www.browserstack.com/docs/automate/cypress/npm-packages 中的 npm 依赖中吗? 你可以在这里参考样品黄瓜柏树:https://github.com/ashwingonsalves/cypress-browserstack-cucumber

    【讨论】:

      猜你喜欢
      • 2022-11-10
      • 1970-01-01
      • 2022-09-30
      • 2022-06-28
      • 2023-01-31
      • 2022-11-20
      • 2023-02-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多