-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add E2E test support with
wp-scripts
and Playwright
- Loading branch information
1 parent
5983dd0
commit 4d9d200
Showing
25 changed files
with
3,761 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Test e2e | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, ready_for_review] | ||
branches-ignore: | ||
- "update_dependencies" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
e2e: | ||
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | ||
name: Playwright E2E tests | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Setup PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.4" | ||
extensions: simplexml | ||
- name: Check out source files | ||
uses: actions/checkout@v4 | ||
- name: Install composer deps | ||
run: composer install --no-dev --prefer-dist --no-progress --no-suggest | ||
- name: Install npm deps | ||
run: | | ||
npm ci | ||
npm install -g playwright-cli | ||
npx playwright install --with-deps chromium | ||
- name: Install environment | ||
run: | | ||
cp ./bin/themeisle-sdk.php ./ | ||
npm run wp-env start | ||
- name: Run the tests | ||
run: | | ||
npm run test:e2e:playwright | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
- name: Archive test results | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: e2e-playwright-results | ||
path: artifacts | ||
retention-days: 1 | ||
if-no-files-found: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
.DS_Store | ||
.idea | ||
node_modules | ||
.vscode | ||
artifact | ||
artifacts | ||
dist | ||
logs | ||
node_modules | ||
themeisle-sdk.php | ||
vendor | ||
.DS_Store | ||
dist | ||
artifact | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"core": null, | ||
"plugins": [ "." ], | ||
"config": { | ||
"WP_DEBUG": true, | ||
"WP_DEBUG_DISPLAY": true | ||
}, | ||
"lifecycleScripts": { | ||
"afterStart": "bash ./bin/setup-env-e2e.sh" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array(), 'version' => 'b8af0b12ad3cabe4c4b8'); | ||
<?php return array('dependencies' => array(), 'version' => 'f35e2c927fed8015fa08'); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
echo "Setting up environment for e2e tests" | ||
|
||
echo "* The working directory is: $(pwd)" | ||
|
||
echo "[1] Transform into a plugin" | ||
if [ ! -f "./themeisle-sdk.php" ]; then | ||
cp ./bin/themeisle-sdk.php ./ | ||
else | ||
echo "[Skip] The plugin file already exists" | ||
fi | ||
|
||
echo "[2] Activate Visualizer tracking" | ||
npm run wp-env run tests-cli wp option set visualizer_logger_flag "yes" | ||
|
||
echo "[3] Install plugins" | ||
npm run wp-env run tests-cli wp plugin install visualizer | ||
npm run wp-env run tests-cli wp plugin activate visualizer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.