Skip to content

test: Add Playwright E2E tests for editor core flows#313

Draft
dcalhoun wants to merge 10 commits intotrunkfrom
test/e2e
Draft

test: Add Playwright E2E tests for editor core flows#313
dcalhoun wants to merge 10 commits intotrunkfrom
test/e2e

Conversation

@dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Feb 8, 2026

What?

Adds a Playwright E2E test suite covering core editor flows: loading, text formatting, and block split/merge. Removes the corresponding manual test cases that are now automated.

Why?

GutenbergKit has 40+ @wordpress/* dependencies (5 with patches). The existing unit tests heavily mock these packages, so they can't catch regressions from dependency upgrades. Browser-based E2E tests that load the real editor with real WordPress packages close this gap.

How?

  • Adds Playwright infrastructure: config, shared helpers (setupEditor, getBlocks), ESLint config, npm scripts, and Makefile targets
  • Adds 11 E2E tests across three spec files: editor load (3), text formatting (4), and block split/merge (4)
  • Adds a Buildkite pipeline step to run E2E tests in CI
  • Removes manual test cases now covered by E2E tests and renumbers remaining smoke tests

Testing Instructions

  1. npm ci
  2. npx playwright install chromium
  3. make test-e2e — all 11 tests should pass
  4. make help — verify test-e2e and test-e2e-ui are listed

Accessibility Testing Instructions

N/A — no UI changes; this PR adds automated tests only.

Install @playwright/test, configure Chromium-only project with Vite dev
server integration, add shared editor-setup helper, ESLint overrides for
the e2e directory, npm scripts (test:e2e, test:e2e:ui), Makefile targets
(test-e2e, test-e2e-ui), and gitignore entries for test artifacts.
Verify the editor initializes and reaches a usable state: visual editor
visible, post title wrapper present, block list container rendered,
toolbar shown, and default block appender attached. Also test empty
editor state and loading with initial block content.
Verify typing text into a new paragraph block, applying bold (Cmd+B),
italic (Cmd+I), and combined bold+italic formatting via keyboard
shortcuts. Asserts block content attributes contain the expected
inline formatting markup.
Verify splitting a paragraph with Enter, merging with Backspace,
round-trip content preservation, and inline formatting preservation
across split/merge operations.
The help target's grep pattern `[a-zA-Z_-]` excluded digits, so
targets containing numbers (e.g. test-e2e) were not listed. Add `0-9`
to the character class.
Install Chromium and run Playwright E2E tests alongside the existing
JS unit test and lint steps.
@dcalhoun dcalhoun added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Feb 8, 2026
Remove S.1 (Write and format text) and S.3 (Merge and split blocks)
from the manual smoke tests, as these flows are now covered by the
Playwright E2E test suite. Renumber remaining smoke tests.
Vitest was picking up Playwright spec files in e2e/ and failing because
Playwright's test.describe() is incompatible with Vitest's test context.
…ugin extend

Switch from `plugin:playwright/recommended` to
`plugin:@wordpress/eslint-plugin/test-playwright` to align with the
upstream Gutenberg E2E linting setup. The WordPress config is currently
a thin wrapper around the same Playwright recommended rules, but using
it ensures we automatically pick up any Playwright-specific rules
WordPress adds in the future.
Add no-restricted-syntax rules to discourage `page.$()`, `page.$$()`
and `page.waitForTimeout()` in favor of the locator API. These rules
are aligned with the upstream Gutenberg E2E ESLint configuration and
help prevent flaky tests.
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.

1 participant