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

PoC: Run E2E tests with WP Playground #62692

Draft
wants to merge 30 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0399391
modify config to run against Playground
WunderBart Jun 20, 2024
e226d20
upload e2e blueprint
WunderBart Jun 20, 2024
467a732
try running e2e tests w/ Playground in CI
WunderBart Jun 20, 2024
5416734
make the test report verbose
WunderBart Jun 20, 2024
12a8ac7
run single suite for testing
WunderBart Jun 20, 2024
582c72c
try checking out PG repo aside
WunderBart Jun 20, 2024
2991126
Revert "try checking out PG repo aside"
WunderBart Jun 20, 2024
187acdf
restore global setup for pre-auth
WunderBart Jun 20, 2024
4e2de6d
add missing dir change
WunderBart Jun 20, 2024
a54920c
Revert "run single suite for testing"
WunderBart Jun 20, 2024
a34384e
disable retries to finish faster avoid flaky reports
WunderBart Jun 20, 2024
e0f6e89
Merge remote-tracking branch 'origin' into try/run-e2e-tests-against-…
WunderBart Oct 3, 2024
a78b728
Use the @wp-playground/cli package
WunderBart Oct 3, 2024
df7d403
Add db connection retry
WunderBart Oct 3, 2024
49cfa8d
Wait for the server to be fully provisioned
WunderBart Oct 3, 2024
1e0155b
Provision server with node
WunderBart Oct 3, 2024
6dca9a6
Ignore the `Downloading ...` log noise
WunderBart Oct 3, 2024
1613cbb
Don't print progress logs
WunderBart Oct 3, 2024
e003621
Debug pw:api
WunderBart Oct 3, 2024
b294df5
Try older php
WunderBart Oct 4, 2024
4fe28bb
Fix log exclusion
WunderBart Oct 4, 2024
bfbc5fa
Try POST instead of PUT for plugin activation
WunderBart Oct 4, 2024
80e61be
Revert "Try POST instead of PUT for plugin activation"
WunderBart Oct 4, 2024
9ca0fbb
disable pw:api logs
WunderBart Oct 4, 2024
ef07ba4
Revert "Add db connection retry"
WunderBart Oct 4, 2024
8549d76
try: Run only one shard
WunderBart Oct 6, 2024
19d223f
try: Make shards smaller
WunderBart Oct 6, 2024
d92a140
tmp: run just 1 suite
WunderBart Oct 6, 2024
3e48cba
tmp: run 2 suites :)
WunderBart Oct 6, 2024
15689a1
try: run 3 suites :))
WunderBart Oct 6, 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
32 changes: 29 additions & 3 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,41 @@ jobs:
run: |
npx playwright install chromium firefox webkit --with-deps

- name: Install WordPress and start the server
- name: Checkout Playground repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
repository: WordPress/wordpress-playground
path: playground

- name: Setup Playground
run: |
# Install Bun
curl -fsSL https://bun.sh/install | bash # install bun

# Install the dependencies
cd playground
npm install
WunderBart marked this conversation as resolved.
Show resolved Hide resolved

- name: Start the server
run: |
npm run wp-env start
cd playground
~/.bun/bin/bun packages/playground/cli/src/cli.ts server \
--wp=6.5 \
WunderBart marked this conversation as resolved.
Show resolved Hide resolved
--mount=../:/wordpress/wp-content/plugins/gutenberg \
--mount=../test/emptytheme:/wordpress/wp-content/themes/emptytheme \
--mount=../test/gutenberg-test-themes:/wordpress/wp-content/themes/gutenberg-test-themes \
--mount=../packages/e2e-tests/mu-plugins:/wordpress/wp-content/mu-plugins \
--mount=../packages/e2e-tests/plugins:/wordpress/wp-content/plugins/gutenberg-test-plugins \
--blueprint=../test/e2e/playground.blueprint.json \
&

- name: Run the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}
WP_BASE_URL=http://127.0.0.1:9400/ \
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- \
npm run test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }}

- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand Down
13 changes: 0 additions & 13 deletions test/e2e/config/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ async function globalSetup( config: FullConfig ) {
// Authenticate and save the storageState to disk.
await requestUtils.setupRest();

// Reset the test environment before running the tests.
await Promise.all( [
requestUtils.activateTheme( 'twentytwentyone' ),
// Disable this test plugin as it's conflicting with some of the tests.
// We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
requestUtils.deactivatePlugin(
'gutenberg-test-plugin-disables-the-css-animations'
),
requestUtils.deleteAllPosts(),
requestUtils.deleteAllBlocks(),
requestUtils.resetPreferences(),
] );

await requestContext.dispose();
}

Expand Down
37 changes: 37 additions & 0 deletions test/e2e/playground.blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"siteOptions": {
"blogname": "Gutenberg E2E Tests"
},
"steps": [
{
"step": "installTheme",
"themeZipFile": {
"resource": "wordpress.org/themes",
"slug": "twentytwenty"
}
},
{
"step": "installTheme",
"themeZipFile": {
"resource": "wordpress.org/themes",
"slug": "twentytwentyone"
}
},
{
"step": "installTheme",
"themeZipFile": {
"resource": "wordpress.org/themes",
"slug": "twentytwentythree"
}
},
{
"step": "activateTheme",
"themeFolderName": "twentytwentyone"
},
{
"step": "activatePlugin",
"pluginPath": "gutenberg/gutenberg.php"
}
]
}
4 changes: 3 additions & 1 deletion test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ const baseConfig = require( '@wordpress/scripts/config/playwright.config' );
const config = defineConfig( {
...baseConfig,
reporter: process.env.CI
? [ [ 'github' ], [ './config/flaky-tests-reporter.ts' ] ]
? [ [ 'github' ], [ 'list' ], [ './config/flaky-tests-reporter.ts' ] ]
: 'list',
workers: 1,
retries: 0,
webServer: undefined,
globalSetup: fileURLToPath(
new URL( './config/global-setup.ts', 'file:' + __filename ).href
),
Expand Down
Loading