1

我创建了一个简单的赛普拉斯项目来自动化网站并且它正在工作。现在我正在尝试将其转换为黄瓜项目,并且在执行测试用例时,出现以下错误:

Running:  Features/shopping.feature                                                       (1 of 1)
[BABEL] Note: The code generator has deoptimised the styling of C:\Users\001ZGA744\Personal\Cypress\Cucumber\node_modules\lodash\lodash.js as it exceeds the max of 500KB.


  1) An uncaught error was detected outside of a test

  0 passing (941ms)
  1 failing

  1) An uncaught error was detected outside of a test:
     TypeError: The following error originated from your test code, not from Cypress.

  > (0 , _typeof4.default) is not a function

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.
      at _typeof2 (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:303:63)
      at _typeof (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:317:39)
      at eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:23486:2332)
      at Object.eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32935:14)
      at Object.eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32937:4)
      at Object.254.C:\Users\001ZGA744\Personal\Cypress\Cucumber\node_modules\@babel\runtime/helpers/interopRequireDefault (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:32937:17)
      at o (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:265)
      at eval (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:316)
      at Object.169.babel-runtime/helpers/classCallCheck (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:9432:15)
      at o (http://localhost:60964/__cypress/tests?p=cypress\integration\Features\shopping.feature:1:265)

这就是我的项目结构的样子: 在此处输入图像描述

我无法理解问题的原因。请建议。

4

1 回答 1

0

请记住,您至少需要一个 stepDefinitions 文件夹。然后,在 package.json 文件中,您应该声明 Cypress Cucumber Preprocessor Style 模式。

像这样的东西:

“柏树黄瓜预处理器”:{“nonGlobalStepDefinitions”:真}

或者:

“柏树黄瓜预处理器”:{“commonPath”:“common”,“stepDefinitions”:“step_definitions”}

取决于你选择什么。

于 2022-01-15T08:00:32.097 回答