How to run a single Percy cypress test

27 Views Asked by At

I have a Nextjs project. My cypress folder has a few end to end tests:

cypress/e2e/test1 ... test10

How to run a single Percy Cypress test.

Below I have the script to run all tests test-visual and I am trying to set up a single percy test test-visual:single that runs just test1 but it runs all tests in the cypress folder

  "scripts": {
    "cypress:run": "cypress run",
    "percy:cypress": "percy exec -- cypress run",
    "test-visual": "start-server-and-test 'npm run dev' http://localhost:3000 percy:cypress",
    "percy-cypress-single": "percy exec -- cypress run -- spec cypress/e2e/test1.cy.ts",
    "test-visual:single": "start-server-and-test 'npm run dev' http://localhost:3000 percy-cypress-single"
  },

What am I doing wrong?

1

There are 1 best solutions below

1
K.Kassianides On BEST ANSWER

You should just be able to pass any Cypress CLI parameters in the same way you do when not invoking via percy.

You seem to have a rogue space in your CLI script

"percy-cypress-single": "percy exec -- cypress run --spec cypress/e2e/test1.cy.ts",
-----------------------------------------------------^ No space here