1

Cypress Version

11.0.1

Node Version

16.16.0

Package Manager

Yarn version 1.22.19

Operating System

Windows 10 Pro Version 21H2

I've created a cypress_grep_test_project to practice this plugin and used the default sample spec files that Cypress provides during the first-time configuration. I just changed some spec files from "cy.js" to "cy.ts." I aim to use this plugin and test it out for Continuous Integration.

According to the Cypress docs, the plugins folder no longer exists. Following the current documentation of the plugin, the registerCypressGrep method isn't available anymore.

I've added the @cypress/grep to the ts.config file.

//ts.config file
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "commonjs",
    "types": [
      "cypress",
      "@cypress/grep" // Added this to prevent tags issue
    ],
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}

In the todo.cy.ts file, I inserted the { tags: 'smoke' } to the describe block as shown in below snippet.

// todo.cy.ts
describe('example to-do app', { tags: 'smoke' }, () => {
  beforeEach(() => {
    cy.visit('https://example.cypress.io/todo')
  })

Now I don't know what to do next, can someone please help me with this?

// cypress.config.ts
import { defineConfig } from 'cypress'

export default defineConfig({
  e2e: {
    video: false,
    setupNodeEvents(on, config) {
      // implement node event listeners here
    // What next?
    },
  }
})
Zujaj Misbah Khan
  • 655
  • 2
  • 11
  • 31

1 Answers1

0

Thanks mahadazad for your collaboration.

Although this is just a workaround, I hope we'll get a proper solution to this problem very soon.

  1. Navigate to the cypress\support\e2e.ts file.

Navigation To e2e.ts file

  1. Add the below code with @ts-ignore to ignore typescript compiler warnings.
// e2e.ts file

import './commands'

// @ts-ignore
import registerCypressGrep from '@cypress/grep' 

registerCypressGrep()
  1. Run the command npx cypress run --env grepTags=smoke on the terminal.

Result

Zujaj Misbah Khan
  • 655
  • 2
  • 11
  • 31