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

Add E2E Tests #37

Draft
wants to merge 42 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c3e71ac
Add E2E Tests
sksaju Sep 17, 2024
97128c8
fix js lint issue
sksaju Sep 17, 2024
3847856
fix js lint issue
sksaju Sep 17, 2024
cff6aa5
rename files
sksaju Sep 23, 2024
d8ddc86
update cypress.yml
sksaju Sep 23, 2024
7d5e192
move cypress-mochawesome-reporter into dev dependancy
sksaju Sep 23, 2024
24eb11b
update tests/cypress/e2e/admin.cy.js
sksaju Sep 23, 2024
fa93074
added Install node command in the cypress.yml
sksaju Nov 5, 2024
3adf941
added cypress/plugins/index.js
sksaju Nov 5, 2024
9b5f636
Merge branch 'develop' into feature/19=e2e-tests
sksaju Nov 6, 2024
9037b1a
downgrade mochawesome-json-to-md package version
sksaju Nov 6, 2024
8d42736
update cypress config
sksaju Nov 6, 2024
3458fff
update cypress config
sksaju Nov 6, 2024
b66e390
update set-wp-config.js
sksaju Nov 6, 2024
9340a5c
update set-wp-config.js
sksaju Nov 6, 2024
7949c35
update set-wp-config.js
sksaju Nov 6, 2024
b081cd4
update set-wp-config.js
sksaju Nov 6, 2024
10bdff7
update cypress.yml workflow
sksaju Nov 6, 2024
0c604dc
update package-lock.json
sksaju Nov 6, 2024
47271e2
update .wp-env.json and tests/bin/set-wp-config.js
sksaju Nov 6, 2024
7816da7
update .github/workflows/cypress.yml
sksaju Nov 6, 2024
50ee0ea
update .wp-env.json and tests/bin/initialize.sh
sksaju Nov 6, 2024
f9146b7
update tests/bin/initialize.sh
sksaju Nov 6, 2024
0167063
update e2e test file names
sksaju Nov 6, 2024
fdbe724
update embed-block-figma.test
sksaju Nov 6, 2024
a628d43
fix js lint issue
sksaju Nov 6, 2024
24c6377
update embed-block-figma.test
sksaju Nov 6, 2024
e071f6a
update embed-block-figma.test
sksaju Nov 6, 2024
fa5087d
update embed-block-figma.test
sksaju Nov 6, 2024
ff454a4
update embed-block-figma.test
sksaju Nov 10, 2024
80c3615
update embed-block-figma.test
sksaju Nov 10, 2024
c70de4c
addes support command and update embed-block-figma.test.js
sksaju Nov 10, 2024
49ddb06
fix eslint issue
sksaju Nov 10, 2024
b577ada
update embed-block-figma.test.js
sksaju Nov 10, 2024
f5ccb78
update embed-block-figma.test.js
sksaju Nov 24, 2024
f181387
update embed-block-figma.test.js
sksaju Nov 24, 2024
1c42e99
update embed-block-figma.test.js
sksaju Nov 24, 2024
dbfa7d8
added setLocalStorage support command
sksaju Nov 24, 2024
c4f166f
update commands.js
sksaju Nov 24, 2024
a721bde
update support command functions
sksaju Nov 24, 2024
1b03f70
update createPost support command
sksaju Nov 24, 2024
ca52fc2
update e2e test case with support commands
sksaju Nov 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: E2E test

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop

jobs:
build:
uses: 10up/embed-block-figma/.github/workflows/build-release-zip.yml@develop
cypress:
needs: build
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.7'}
sksaju marked this conversation as resolved.
Show resolved Hide resolved
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}

steps:
- name: Checkout
uses: actions/checkout@v3
sksaju marked this conversation as resolved.
Show resolved Hide resolved
- name: Download build zip
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.event.repository.name }}
- name: Cache node_modules
sksaju marked this conversation as resolved.
Show resolved Hide resolved
id: cache-node-modules
uses: actions/cache@v3
sksaju marked this conversation as resolved.
Show resolved Hide resolved
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.cache
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
sksaju marked this conversation as resolved.
Show resolved Hide resolved
- name: Composer
run: composer install
sksaju marked this conversation as resolved.
Show resolved Hide resolved
- name: Set the core version and plugins config
run: ./tests/bin/set-wp-config.js --core=${{ matrix.core.version }} --plugins=./${{ github.event.repository.name }},./tests/cypress/test-plugin
- name: Set up WP environment
run: npm run env:start
- name: Test
run: npm run cypress:run

- name: Update summary
if: always()
run: |
npx mochawesome-merge ./tests/cypress/reports/*.json -o tests/cypress/reports/mochawesome.json
rm -rf ./tests/cypress/reports/mochawesome-*.json
npx mochawesome-json-to-md -p ./tests/cypress/reports/mochawesome.json -o ./tests/cypress/reports/mochawesome.md
npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/
cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY
- name: Make artifacts available
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-artifact
retention-days: 2
path: |
${{ github.workspace }}/tests/cypress/screenshots/
${{ github.workspace }}/tests/cypress/videos/
${{ github.workspace }}/tests/cypress/logs/
${{ github.workspace }}/tests/cypress/reports/

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ Thumbs.db
Desktop.ini
/debug.log
/db.php

# Tests
tests/cypress/downloads
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably just ignore the entire tests directory

tests/cypress/screenshots
tests/cypress/videos
tests/cypress/reports
12 changes: 12 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"plugins": [
"."
],
"env": {
"tests": {
"mappings": {
"wp-cli.yml": "./tests/bin/wp-cli.yml"
}
}
}
}
Loading
Loading