cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Spec order from `specPattern` is ignored when `--record` is used

Open dennisoelkers opened this issue 11 months ago • 2 comments

Current behavior

When --record is used, specs are executed in lexicographic order.

Desired behavior

Just like without --record, specs should be executed in the order they are defined in specPattern in cypress config.

Test code to reproduce

Cypress config:

import { defineConfig } from 'cypress';
export default defineConfig({
  specPattern: ['foo.spec.ts', 'bar.spec.ts']
});

Now, when run with yarn cy:run, it should execute foo.spec.ts before bar.spec.ts. When yarn cy:run --record is used, bar.spec.ts will be executed before foo.spec.ts.

Cypress Version

13.6.6

Node version

18.18.0

Operating System

Linux x64

Debug Logs

No response

Other

No response

dennisoelkers avatar Mar 06 '24 10:03 dennisoelkers

That is definitely unexpected. It's documented that during record it is run alphabetically, unless there is test history that dictates the order in which it should be run - essentially when using --record there will never be determinism in how it runs. I think that that running cypress run alone should run the tests alphabetically. https://docs.cypress.io/guides/cloud/smart-orchestration/parallelization#Without-parallelization

jennifer-shehane avatar Mar 06 '24 19:03 jennifer-shehane

Experiencing the same issue on Cypress 13.6.4, Windows 11. specPattern order is not maintained when using --record.

igorkuryasev avatar Apr 30 '24 08:04 igorkuryasev