Home > Back-end >  how to change the test file run order in cypress in run time
how to change the test file run order in cypress in run time

Time:02-22

I have 3 different test files

1- testfile-1.js 2- testfile-2.js 3- testfiles-3.js

i can change the test file running order using testfiles feature in cypress.config file but i want to change the order runtime not hard coded.

looking for the solution

Regards

CodePudding user response:

Change the file name to something like this in case you don't want to use testFiles: [] in your cypress.config.

01-testfile.spec.js
02-testfile.spec.js
03-testfile.spec.js

CodePudding user response:

You can comma-separate the file names on the command line,

yarn cypress run --spec "testfile-1.js,testfile-2.js,testfiles-3.js"

Not sure if that guarantees the order though.

If no luck with that, it would be possible to guarantee the order by running with a special script (but it's more work).

  • Related