All specs disappear in Cypress after experimentalSessionAndOrigin is implemented

Viewed 503

I'm very new to Cypress. I am having a roadblock and don't seem to be able to proceed. I have a few specs written but I'm having trouble having Cypress retain the cookies and not clear them before each test. I've read about cy.session(), it's all pretty confusing lol but it seems that, in order for me to use cy.session(), I first have to implement this script: 

 e2e: { experimentalSessionAndOrigin: true, },

But, as soon, as I add that to cypress.config.js, a new file, e2e.js, is created in support folder and, when I launch Cypress, it treats it as a new project, none of the existing specs are showing up. What am I doing wrong?

1 Answers

It may happen if you upgrade from Cypress v9 to v10. There's a wizard that creates a few things for you to ease the migration.

In any case, with default settings in Cypress 10

  • specs should be in the /cypress/e2e/ folder
  • specs should have the extension .cy.js

This section of the config docs shows how you can modify the pattern, for example to use v9 settings

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    // revert to v9 configuration pattern
    specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}' 
  }
})
Related