Skip to content

Commit

Permalink
Merge pull request #64 from felipeelia/tests/cypress
Browse files Browse the repository at this point in the history
Add e2e tests
  • Loading branch information
felipeelia authored Sep 2, 2023
2 parents 09c674b + eddca3b commit a27344b
Show file tree
Hide file tree
Showing 10 changed files with 2,274 additions and 160 deletions.
12 changes: 10 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
"env": {
"jquery": true
},
"ignorePatterns": ["vendor/*", "dist/*"]
}
"ignorePatterns": ["vendor/*", "dist/*"],
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
}
81 changes: 81 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: E2E Test

env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"
NODE_VERSION: "18"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- trunk
pull_request:
branches:
- trunk
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x

jobs:
cypress_local:
name: Cypress - Local
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare npm cache
uses: actions/cache@v3
with:
path: ${{ env.NODE_CACHE }}
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.NODE_VERSION }}-
- name: Prepare composer cache
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: cs2pr
coverage: none

- name: composer install
run: composer install

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: npm ci --include=dev

- name: Set up WP environment
run: npm run env start

- name: Build asset
run: npm run build

- name: Test
run: npm run e2e:run

- name: Make artifacts available
uses: actions/upload-artifact@v3
if: failure()
with:
name: e2e-artifact
retention-days: 2
path: |
${{ github.workspace }}/tests/e2e/screenshots/
${{ github.workspace }}/tests/e2e/videos/
${{ github.workspace }}/tests/e2e/logs/
Loading

0 comments on commit a27344b

Please sign in to comment.