Skip to content

Add Cypress Tagging Example #42

@alexfinnarn

Description

@alexfinnarn

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions