Skip to content

Comments

test: Automate manual test cases with wp-env E2E tests#329

Draft
dcalhoun wants to merge 11 commits intofeat/local-wordpress-wp-envfrom
test/automate-manual-test-cases
Draft

test: Automate manual test cases with wp-env E2E tests#329
dcalhoun wants to merge 11 commits intofeat/local-wordpress-wp-envfrom
test/automate-manual-test-cases

Conversation

@dcalhoun
Copy link
Member

What?

Automates all remaining manual test cases from docs/test-cases.md as Playwright E2E tests running against wp-env, and migrates the existing E2E suite to use wp-env for a more realistic testing environment.

Why?

The manual test cases (media uploads, text alignment, embeds, color/gradient, gallery, patterns) all require a real WordPress backend. With wp-env now available, these can be automated to run in CI and reduce the manual testing burden.

How?

  • wp-env fixtures (e2e/wp-env-fixtures.js): Reads credentials from .wp-env.credentials.json and fetches/caches editor settings from the WP REST API.
  • EditorPage migration (e2e/editor-page.js): setup() now injects wp-env config (siteApiRoot, authHeader, editorSettings) by default. Added helper methods: getBlockAttribute(), setTextAlignment(), openBlockSettings(), waitForMediaUpload().
  • 9 new test files: Image upload, video upload, gallery block, audio upload, file upload, text alignment, embedded content, color/gradient, pattern insertion.
  • Test assets: Minimal binary files (PNG, MP4, MP3, PDF) for upload tests.
  • Docs cleanup: Removed S.4 (save/publish — delegated to native host) and automated test case descriptions from docs/test-cases.md. Only S.1 (Undo/Redo) remains as a manual test.

Testing Instructions

  1. Start wp-env: make wp-env-start
  2. Run all E2E tests: make test-e2e
  3. Verify all 45 tests pass (29 existing + 16 new).

Accessibility Testing Instructions

N/A — no UI changes.

Screenshots or screencast

N/A — test infrastructure only.

GutenbergKit delegates save/publish to the native host app, so this
test case does not belong in the editor's E2E suite.
Introduce `e2e/wp-env-fixtures.js` which reads wp-env credentials from
`.wp-env.credentials.json` and fetches editor settings from the WP REST
API. Update `EditorPage.setup()` to inject wp-env config (siteApiRoot,
authHeader, editorSettings) by default so all E2E tests run against a
real WordPress backend.

Add helper methods to EditorPage: `getBlockAttribute()`,
`setTextAlignment()`, `openBlockSettings()`, and `waitForMediaUpload()`.

Update `editor-error.spec.js` to use an unreachable API root so the
plugin load failure test still works with wp-env credentials present.
Add minimal test files used by the media upload E2E tests:
- test-image.png (1x1 RGBA PNG)
- test-image-2.png (1x1 RGBA PNG, second image for gallery)
- test-video.mp4 (minimal MP4 container)
- test-audio.mp3 (minimal MP3 frame)
- test-file.pdf (minimal PDF document)
Add Playwright E2E tests that verify media upload flows against wp-env:

- S.2 image-upload: Upload image via Image block, verify block attributes
- S.3 video-upload: Upload video via Video block, verify src attribute
- F.4 gallery-block: Upload multiple images, verify inner blocks and
  caption editing
- F.6 audio-upload: Upload audio via Audio block, verify src attribute
- F.7 file-upload: Upload file via File block, verify href and fileName

All tests use the filechooser event to simulate file selection and
`waitForMediaUpload()` to wait for the upload to complete.
Add Playwright E2E tests for non-upload editor features against wp-env:

- F.1 text-alignment: Verify center/right alignment on paragraph and
  verse blocks via the toolbar dropdown
- F.2 embed-content: Insert YouTube embed URL and verify oEmbed
  resolution; test fallback for non-embeddable URLs
- F.3 color-gradient: Apply background color via Block Settings UI,
  verify theme gradients are available, apply gradient via data store
- F.5 pattern-insertion: Fetch patterns from WP REST API, insert parsed
  pattern content via wp.blocks.parse() + insertBlocks()
Automated tests live in the E2E suite and don't need to be duplicated
in the manual test cases document. Only S.1 (Undo/Redo) remains since
it requires the native toolbar.
@dcalhoun dcalhoun added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Feb 20, 2026
dcalhoun and others added 4 commits February 20, 2026 14:02
Move the E2E step from the `mac` queue to `default` (Linux EC2 with
Docker) so wp-env can start and provide the credentials file needed by
all E2E tests. Also install Playwright with `--with-deps` on CI to
pull in required system libraries on Linux.
…right is related to trying to run it within a virtualized environment (AMI/VM) or if it's unrelated
…th Playwright is related to trying to run it within a virtualized environment (AMI/VM) or if it's unrelated"

This reverts commit 7b5aafe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants