Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cypress Tagging Example #42

Open
4 tasks
alexfinnarn opened this issue Feb 17, 2023 · 0 comments
Open
4 tasks

Add Cypress Tagging Example #42

alexfinnarn opened this issue Feb 17, 2023 · 0 comments

Comments

@alexfinnarn
Copy link
Contributor

alexfinnarn commented Feb 17, 2023

There are several ways you can add tags to Cypress tests via plugins or custom code.

In the Open Data projects, we see code like:

// index.js
beforeEach(function() {
  let testSuite = Cypress.env('SUITE');
  if (!testSuite) {
    return;
  }

  const testName = Cypress.mocha.getRunner().test.fullTitle();
  testSuite = "<"+testSuite+">"
  if (!testName.includes(testSuite)) {
    this.skip();
  }
})

// test file.
it('User Journey: Filtering PI Reports <pi> <pi-report-filtering>', () => {

Then you can run the suite from the CLI like:

SUITE=pi yarn cypress run

We also have many plugins, but the most popular/official seems to be https://github.com/cypress-io/cypress/tree/develop/npm/grep

There is also https://github.com/infosum/cypress-tags to use for tagging.

There could be more recommended options to check out.

Tasks:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant