Skip to content

Commit

Permalink
Merge pull request #120 from 10up/fix/116
Browse files Browse the repository at this point in the history
Cypress integration migrated to 11+
  • Loading branch information
Sidsector9 authored Jan 23, 2023
2 parents d0d5ad5 + 39d462a commit 683f312
Show file tree
Hide file tree
Showing 8 changed files with 2,224 additions and 7,232 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ node_modules
vendor
.wp-env.override.json
dist/
tests/cypress/screenshots
tests/cypress/videos
9,409 changes: 2,194 additions & 7,215 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"@wordpress/dependency-extraction-webpack-plugin": "^3.4.1",
"@wordpress/env": "^5.3.0",
"10up-toolkit": "^4.3.1",
"cypress": "^9.5.2",
"cypress": "^11.2.0",
"node-sass": "^7.0.3",
"node-wp-i18n": "^1.2.6"
},
"scripts": {
"cypress:open": "cypress open --config-file tests/cypress/config.json",
"cypress:run": "cypress run --config-file tests/cypress/config.json",
"cypress:open": "cypress open --config-file tests/cypress/config.config.js",
"cypress:run": "cypress run --config-file tests/cypress/config.config.js",
"env": "wp-env",
"env:start": "wp-env start",
"env:stop": "wp-env stop",
Expand Down
3 changes: 3 additions & 0 deletions tests/bin/initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ npm run env run tests-cli "wp rewrite structure '/%postname%/' --hard"
# Create Posts
npm run env run tests-cli "wp post create --post_status=publish --post_title='Post 1'"
npm run env run tests-cli "wp post create --post_status=publish --post_title='Post 2'"
npm run env run tests-cli "wp post create --post_status=publish --post_title='Post 3'"
# Create Pages
npm run env run tests-cli "wp post create --post_status=publish --post_type=page --post_title='Page 1'"
npm run env run tests-cli "wp post create --post_status=publish --post_type=page --post_title='Page 2'"
npm run env run tests-cli "wp post create --post_status=publish --post_type=page --post_title='Page 3'"
npm run env run tests-cli "wp post create --post_status=publish --post_type=page --post_parent=2 --post_title='Child Page 1'"
npm run env run tests-cli "wp post create --post_status=publish --post_type=page --post_parent=2 --post_title='Child Page 2'"
npm run env run tests-cli "wp post create --post_status=publish --post_type=page --post_parent=2 --post_title='Child Page 3'"
18 changes: 18 additions & 0 deletions tests/cypress/config.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
fixturesFolder: __dirname+'/fixtures',
screenshotsFolder: __dirname+'/screenshots',
videosFolder: __dirname+'/videos',
downloadsFolder: __dirname+'/downloads',
video: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require(__dirname+'/plugins/index.js')(on, config)
},
specPattern: __dirname+'/integration/*.test.{js,jsx,ts,tsx}',
supportFile: __dirname+'/support/index.js',
},
})
10 changes: 0 additions & 10 deletions tests/cypress/config.json

This file was deleted.

4 changes: 2 additions & 2 deletions tests/cypress/integration/page-ordering.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('Test Page Order Change', () => {

const first = '.wp-list-table .level-0 + .level-1';
const second = '.wp-list-table .level-0 + .level-1 + .level-1';
const firstText = cy.get(`${first} .row-title`).invoke('text');
const secondText = cy.get(`${second} .row-title`).invoke('text');
const firstText = cy.get(`${first} .row-title`);
const secondText = cy.get(`${second} .row-title`);

cy.get(first).drag(second);
// wait for order update done.
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/integration/post-ordering.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('Test Post Order Change', () => {

const first = '.wp-list-table tbody tr:nth-child(1)';
const second = '.wp-list-table tbody tr:nth-child(2)';
const firstText = cy.get(`${first} .row-title`).invoke('text');
const secondText = cy.get(`${second} .row-title`).invoke('text');
const firstText = cy.get(`${first} .row-title`);
const secondText = cy.get(`${second} .row-title`);

cy.get(first).drag(second);
// wait for order update done.
Expand Down

0 comments on commit 683f312

Please sign in to comment.