Skip to content

Commit

Permalink
fix: upgraded cypress to v12 (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpina1-godaddy authored Jan 27, 2023
1 parent 7dd5277 commit 38ad6cf
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Available structure
| test/ | Test files |
| test/ | Test files |
| [app.config.js] | App configuration with environment overrides |
| [cypress.json] | Cypress configuration |
| [cypress.config.js]| Cypress configuration |
| [gasket.config.js] | Gasket config for an app |
| [jest.config.js] | Jest configuration |
| [redux/store.js] | Setup to make Redux store |
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/gasket-plugin-cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ the following `scripts` to the `package.json`:

NOTE: before running `npm run cypress` or `npm run cypress:headless`, you should first start the server in a separate tab. Before starting the server for the first time, you must run `gasket build`/`npm run build` in order for things to work properly.

- `npm run cypress`, opens the Cypress Test Runner and uses the default configuration values from `cypress.json`, which uses all tests specified in the **tests** folder
- `npm run cypress:headless` runs all cypress tests to completion. the cypress tests must be located in the **test** folder or whatever folder value is set for `integrationFolder` in the `cypress.json` config
- `npm run cypress`, opens the Cypress Test Runner and uses the default configuration values from `cypress.config.js`, which uses all tests specified in the **tests** folder
- `npm run cypress:headless` runs all cypress tests to completion. the cypress tests must be located in the **test** folder or whatever folder value is set for `integrationFolder` in the `cypress.config.js` config
- `npm run e2e` starts the Next.js production server in conjunction with opening the Cypress Test Runner
- `npm run e2e:headless` Same as `npm run e2e`, but runs the cypress tests to completion in the command line

Expand Down
11 changes: 11 additions & 0 deletions packages/gasket-plugin-cypress/generator/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
video: false,
e2e: {
setupNodeEvents(on, config) {},
baseUrl: 'http://localhost:8080',
supportFile: false,
specPattern: 'test/e2e/**/*.cy.{js,jsx,ts,tsx}'
}
});
5 changes: 0 additions & 5 deletions packages/gasket-plugin-cypress/generator/cypress.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/gasket-plugin-cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@babel/core": "^7.16.10",
"@testing-library/react": "^13.4.0",
"cypress": "^9.6.0",
"cypress": "^12.3.0",
"eslint": "^8.7.0",
"eslint-config-godaddy": "^6.0.0",
"eslint-plugin-unicorn": "^44.0.0",
Expand Down
11 changes: 7 additions & 4 deletions packages/gasket-plugin-cypress/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const self = require('../package.json');
const plugin = require('../lib/index.js');
const config = require('../generator/cypress.json');
const config = require('../generator/cypress.config.js');

describe('Plugin', function () {
async function create() {
Expand Down Expand Up @@ -77,13 +77,16 @@ describe('Plugin', function () {
});

it('has the correct custom cypress config', async function () {
expect(config).toHaveProperty('baseUrl', 'http://localhost:8080');
expect(config).toHaveProperty('integrationFolder', 'test');
const {e2e} = config;
expect(e2e).toHaveProperty('baseUrl', 'http://localhost:8080');
expect(e2e).toHaveProperty('supportFile', false);
expect(e2e).toHaveProperty('specPattern', 'test/e2e/**/*.cy.{js,jsx,ts,tsx}');
expect(typeof e2e.setupNodeEvents).toBe('function');
expect(config).toHaveProperty('video', false);
});

describe('react', function () {
it('includes a glob for the `generator/cypress.json` contents for react projects', async function () {
it('includes a glob for the `generator/cypress.config.js` contents for react projects', async function () {
const { files } = await createReact();

expect(files[0]).toContain('/../generator/*');
Expand Down

0 comments on commit 38ad6cf

Please sign in to comment.