K.Osire
K.Osire

Reputation: 135

How can I run a batch of Cypress tests in correct order (for report readability)

I have just upgraded to Cypress v10.3 from v9.7. I used to run a sequence of tests by specifying the testFiles sequence in configuration, but now two things have changed that prevent me from doing so.

I know the tests should be independent, and have made sure that is so.

But the test report goes to stakeholders and the order of tests presented on the report is important, so the report needs to read in logical order.

I've been manually re-sorting, but it's a pain to do this. How can I reinstate the missing feature in Cypress v10?

Upvotes: 6

Views: 775

Answers (1)

Fody
Fody

Reputation: 31882

This might work, or might not, depending on how your report outputs the test.

Create a "runner" test that imports all the tests in your batch in the order you want them to run.

// run-batch-in-order.cy.js

import './test1.spec.cy.js'    // relative paths
import './test2.spec.cy.js'
...

Run just the special batch test in either cypress open or cypress run.

Upvotes: 3

Related Questions