Home > Back-end >  Cypress - Why adding testfiles names in jsconfig.json file are not executing in order
Cypress - Why adding testfiles names in jsconfig.json file are not executing in order

Time:07-13

I have added spec file names in jsconfig.json so that they can execute in order. But they are not executing in this order.

enter image description here

{
  "include": ["./node_modules/cypress", "cypress/**/*.js"],
  "testFiles":
  [
    "login.cy.js",
    "create_course.cy.js",
    "open_course.cy.js",
    "create_training.cy.js",
    "edit_pitch.cy.js"
  ]

 }

enter image description here

CodePudding user response:

With specPattern, you can add a String or Array of glob patterns of the test files to load. Unfortunately, you won't be able to add the spec files in an array-like you can do in cypress version < 10 with testFiles.

An alternate way would be to keep the spec pattern as ["cypress/e2e/**/*.cy.{js,jsx,ts,tsx}"] and then rename your spec files to include sequential numbers so that they are executed in that sequence.

01-login.cy.js
02-create_course.cy.js
03-open_course.cy.js
04-create_training.cy.js
05-edit_pitch.cy.js
  • Related