Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
85 changes: 17 additions & 68 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,74 +22,23 @@ concurrency:

jobs:
e2e-playwright:
name: Playwright
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@main
strategy:
matrix:
php: [ '8.2' ]
with:
COMPOSER_DEPS_INSTALL: true
PHP_VERSION: ${{ matrix.php }}
ARTIFACT_INCLUDE_HIDDEN_FILES: true
ARTIFACT_OVERWRITE: true
ARTIFACT_PATH: './artifacts'
NODE_VERSION: 20
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
SCRIPT_NAME: 'ci-test-e2e'
secrets:
ENV_FILE_DATA: ${{ secrets.GTM_VARS }}
COMPOSER_AUTH_JSON: '${{ secrets.PACKAGIST_AUTH_JSON }}'
GITHUB_USER_EMAIL: ${{ secrets.DEPLOYBOT_EMAIL }}
GITHUB_USER_NAME: ${{ secrets.DEPLOYBOT_USER }}
GITHUB_USER_SSH_KEY: ${{ secrets.DEPLOYBOT_SSH_PRIVATE_KEY }}
COMPOSER_AUTH: '${{secrets.PACKAGIST_AUTH_JSON}}'
strategy:
fail-fast: false

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

- name: Set up SSH
if: ${{ env.GITHUB_USER_SSH_KEY != '' }}
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ env.GITHUB_USER_SSH_KEY }}

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: '--prefer-dist'

- name: Set up node
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com/'

- name: Github Packages Auth
run: |
npm config set @inpsyde:registry 'https://npm.pkg.github.com'
npm config set //npm.pkg.github.com/:_authToken ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN}}

- name: Install dependencies
run: npm install

- name: Npm build
run: npm run-script build

- name: Install Playwright dependencies
run: |
npx playwright install chromium --with-deps

- name: Install WordPress and start the server
run: |
npm run-script wp-env start

- name: Run the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run-script test:e2e

- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: artifacts
path: ./artifacts
if-no-files-found: ignore
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN}}
44 changes: 43 additions & 1 deletion package-lock.json

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

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
"react": "18.3.1"
},
"devDependencies": {
"@wordpress/scripts": "^26",
"@wordpress/env": "^10.3.0",
"@inpsyde/playwright-utils": "2.0.0-beta.2",
"@playwright/test": "^1.45.1",
"@wordpress/env": "^10.3.0",
"@wordpress/scripts": "^26",
"copy-webpack-plugin": "^12.0",
"dotenv-cli": "^8.0.0",
"typescript": "^4.9.4"
},
"scripts": {
Expand All @@ -57,7 +58,10 @@
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.ts",
"wp-env": "wp-env",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "wp-scripts plugin-zip"
"plugin-zip": "wp-scripts plugin-zip",
"ci-test-e2e:setup": "npm run build && npm run wp-env start",
"ci-test-e2e:test": "xvfb-run --auto-servernum --server-args=\"-screen 0 1280x960x24\" -- dotenv -e .env.ci -- npm run-script test:e2e",
"ci-test-e2e": "npm run-script ci-test-e2e:setup && npm run-script ci-test-e2e:test"
},
"files": [
"index.php",
Expand Down
Loading