elgentos / magento2-cypress-testing-suite

A community-driven Cypress testing suite for Magento 2
MIT License
172 stars 37 forks source link

Cypress version 10.0.0 no longer supports cypress.json. #52

Closed BorisovskiP closed 2 years ago

BorisovskiP commented 2 years ago

Describe the bug Using "cypress": "^10.0" will throw the following error: Cypress version 10.0.0 no longer supports cypress.json.

To Reproduce Steps to reproduce the behaviour:

  1. Require "cypress": "^10.0"
  2. Run npx cypress run --spec ./cypress/integration/path/to/some.spec.js

Expected behaviour Using the current version of cypress should work with the module

Additional context A current workaround to this is to have a dependency on "cypress": "^9.7.0

Vinai commented 2 years ago

I think the proper solution is to replace the cypress.json with a file cypress.config.js:

const {defineConfig} = require('cypress');

module.exports = defineConfig({
    e2e: {
        baseUrl: "http://example.com/",
        watchForFileChanges: false,
        viewportWidth: 1920,
        viewportHeight: 1080,
        env: {
            mobileViewportWidthBreakpoint: 768,
            mobileViewportWidthBreakpointHyva: 1024
        },
        supportFile: false,
        specPattern: 'cypress/integration/hyva/**/*.spec.js'
    }
});

This seems to work in CI:

  - echo "const { defineConfig } = require('cypress'); module.exports = defineConfig({e2e:{ ...$(cat cypress.json), supportFile:false, specPattern:'cypress/integration/hyva/**/*.spec.js' }});" > cypress.config.js
  - rm cypress.json

Reference https://docs.cypress.io/guides/references/migration-guide#Configuration-File-Changes