Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool/117: add Cypress tests #116

Merged
merged 14 commits into from
Apr 18, 2022
Merged
15 changes: 14 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
const defaultConfig = require('@wordpress/scripts/config/.eslintrc.js' );
module.exports = defaultConfig;
module.exports = {
...defaultConfig,
ignorePatterns: [
"tests/cypress/fixures",
"tests/cypress/plugins",
"tests/cypress/support",
"tests/bin"
],
"globals": {
"Cypress": "readonly",
"cy": "readonly",
"before": "readonly",
}
};
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v1
40 changes: 40 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: E2E test

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
jobs:
cypress:
name: ${{ matrix.core.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
core:
- {name: 'WP latest', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#5.4'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Composer (optional)
run: composer install
continue-on-error: true
- name: Build (optional)
run: npm run build
continue-on-error: true
- name: Set the core version
run: ./tests/bin/set-core-version.js ${{ matrix.core.version }}
- name: Set up WP environment
run: npm run env:start
- name: Create test pages
run: npm run create-pages
- name: Test
run: npm run cypress:run
12 changes: 0 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,3 @@ jobs:
run: |
npm install
npm run lint:js

test_acceptance:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: composer install
- name: Run WP Acceptance
run: |
WP_SNAPSHOTS_DIR=${{ github.workspace }}/.wpsnapshots/ ./vendor/bin/wpsnapshots configure --aws_key=${{ secrets.AWS_ACCESS_KEY }} --aws_secret=${{ secrets.SECRET_ACCESS_KEY }} --user_name="wp-acceptance" --user_email=travis@10up.com 10up
./vendor/bin/wpacceptance run
10 changes: 10 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": ["."],
"env": {
"tests": {
"mappings": {
"wp-cli.yml": "./tests/bin/wp-cli.yml"
}
}
}
}
1 change: 1 addition & 0 deletions .wp-env.override.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"core":"WordPress/WordPress#5.9"}
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,5 @@
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {},
"require-dev": {
"10up/wpacceptance": "^0.16.5"
},
"scripts": {
"test:acceptance": "wpacceptance run"
}
"require": {}
}
Loading