如何跳过 cypress 中的某个功能,以便不对其进行端到端测试

Ang*_*arM 6 javascript angular cypress

如何跳过 cypress 中的某个功能,以便不对其进行端到端测试

技术带有 cypress 版本的 Angular 8:

  • "柏树": "^3.4.1"
  • “柏树黄瓜预处理器”:“^1.16.2”
  • "柏树管": "^1.4.0"

我正在使用 cypress 及其测试运行程序(./node_modules/.bin/cypress open)。

我无法跳过测试。我了解如何@focus 像这样的功能:

Feature: App is alive
  checking data

  @focus
  Scenario: Read list of data
    Given I open up the page
    Then I see more than one row of data
Run Code Online (Sandbox Code Playgroud)

我尝试将@focus更改为@skip和@skipped但没有用

Ret*_*End 6

当然你可以使用标签

Feature: My very feature

  @ignore-this
  Scenario: I don't want to run
    Given I open up the page
    Then I see more than one row of data

  Scenario: I want to run
    Given I open up the page
    Then I see more than one row of data
Run Code Online (Sandbox Code Playgroud)

然后运行 ​​Cypress 并相应地设置环境标签

./node_modules/.bin/cypress open -e "TAGS=not @ignore-this"
Run Code Online (Sandbox Code Playgroud)

如果您希望在使用cypress run时忽略整个功能,您可以使用黄瓜标签包装器(它不适用于“open”命令,请参阅:cypress-tags.js

./node_modules/.bin/cypress-tags run -e TAGS='not @ignore'
Run Code Online (Sandbox Code Playgroud)

参考资料: - https://github.com/TheBrainFamily/cypress-cucumber-example#tags-usage