Files
webstudio/apps/builder/e2e
Oleg Isonen d9e3394c18 feat: Improve Advanced styles and CSS variables (#6638)
Closes #6470
Closes #4806
Closes #4392
Closes #4804
Closes #4616
Closes #4863
Closes #4912
Ref #1798

Advanced styles now uses a CSS block editor in the panel and a centered
editor. Local declarations are editable. Cascaded or inherited, preset,
and global declarations are grouped below them and are read-only. The
editor suggests properties and values, highlights search matches, shows
source details and color swatches, and previews valid local edits on the
canvas.

Keyframe CSS declarations use the reusable local block editor. The old
Add styles field, property-row editor, declaration menu actions, and
Navigator CSS Preview are removed.

### Delivery checklist

- [x] Edit and validate local CSS declarations, including shorthand
display and likely typo hints
- [x] Show other style sources with source colors, tooltips, and
read-only protection
- [x] Add search navigation, color swatches, and the centered editor
shortcut
- [x] Reuse the block editor for animation keyframes and preserve
transform controls
- [x] Preserve uploaded background layers when editing gradients or
reordering layers
- [x] Remove superseded editor and Navigator UI
- [x] Review and update the Style panel and Navigator guides
- [x] Remove the outdated CSS Preview sentence from the Builder anatomy
guide
- [x] Rename the stale Code view test title to match the Advanced editor
- [x] Regenerate fixtures and keep the Vercel build manifest through
regeneration
- [x] Resolve review threads and verify required CI

### Implementation notes

Styles remain stored as individual properties; equivalent shorthand text
is reconstructed for editing. Unknown property names become CSS
variables unless they resemble a known property, in which case the
editor warns and skips the typo. Editing is limited to the selected
local style block; read-only source groups remain visible for reference.
Existing uploaded image and hidden background layers are retained when
neighboring layers change. No schema migration is needed.

The Vercel manifest setting lives in the React Router template, so
fixture regeneration produces a clean worktree. The shared template also
generates the setting for the Docker fixture.

### Verification

On commit `7fb44d358`, both fixture checks, `check-size`, the main
workflow, all ten end-to-end shards, and the label-approved visual
comparison passed. The fixture regeneration, Vercel build, Builder
typecheck, focused lint, and formatting checks passed locally before the
final documentation and test-title cleanup; `git diff --check` passed
afterward. No local tests were run for the final cleanup, which changes
no behavior.
2026-11-06 12:52:33 +01:00
..

Builder E2E tests

Builder E2E workflows run with Playwright Test. The Playwright setup project waits for PostgREST, resets the disposable database, and warms the login route before Chromium runs the selected tests.

Run the suite

Use the full command for CI-like validation:

pnpm e2e:builder

The first run after migrations change applies the regular migration pipeline and writes an ignored schema cache under .cache/builder-e2e. Refresh it explicitly with:

pnpm e2e:builder:refresh-schema-cache

The regular E2E suite uses lightweight PostgreSQL containers. Verify that the complete migration chain also applies to the pinned Supabase PostgreSQL image with:

pnpm e2e:builder:check-supabase-migrations

Pass normal Playwright Test arguments after --. For example:

pnpm e2e:builder -- --grep "Builder can copy, duplicate, and delete a page"
pnpm e2e:builder -- 'apps/builder/e2e/tests/pages-actions.[shard-3].e2e.ts'
pnpm e2e:builder -- --debug --grep "Builder can copy"

A lightweight Playwright discovery pass validates the selection before Docker, database migrations, browser installation, or the Builder build starts. A filter that matches no tests therefore fails without starting the test environment.

Fast local reruns

Keep the E2E backend and Builder development server running to avoid rebuilding Builder and restarting Docker for each edit.

Terminal 1:

pnpm e2e:builder:dev:backend

Terminal 2:

pnpm dev

Terminal 3:

pnpm e2e:builder:dev -- --grep "Builder can copy, duplicate, and delete a page"

pnpm e2e:builder:dev defaults to E2E_BUILDER_URL=https://127.0.0.1:3000. Override it when the development server uses another port. Chromium maps wstd.dev and its project subdomains to loopback for local Builder URLs, so host-file changes are unnecessary.

The development backend uses E2E_DB_BOOTSTRAP=if-empty and keeps Docker containers running. The Playwright setup project still resets test data before each invocation.

Test organization

  • Put workflows in e2e/tests/*.e2e.ts and import test from e2e/test.ts.
  • Use Playwright's page fixture for the workflow under test. Playwright gives each test an isolated context and closes it automatically.
  • Use Playwright's context fixture when setup should share authentication with the workflow page.
  • Use withBrowserContext(browser, callback) for isolated setup or setup that runs in beforeAll. If cookies must survive from beforeAll into the tests, create an explicit context with newBrowserContext(browser) and close it in afterAll.
  • Use newIsolatedPage(browser) for identities that must not share cookies.
  • Keep tests in a file independent even though Playwright runs them in declaration order by default.

CI discovers isolated Playwright shards from filename tags. Each shard uses four workers, and files are assigned by measured CI duration to keep jobs near three to four minutes:

pages-actions.[shard-3].e2e.ts

Every E2E filename must contain at least one unique shard tag. CI derives its matrix from those tags, so adding or removing a shard does not require editing the workflow. Files with multiple tags are partitioned across those shards. All files selected by a shard must use the same set of tags. Rebalance by changing filename tags when measured job durations drift. Suites may opt into parallel mode only when every worker creates uniquely named setup data and the tests do not depend on each other's mutations.

Backend organization

Development, E2E, schema-cache, and Supabase compatibility commands share the backend definition in apps/builder/backend. compose.yaml defines the common services, and compose.<mode>.yaml defines only the differences for a named mode. Backend commands resolve these files by convention; callers do not pass Compose filenames.

The schema-cache fingerprint discovers migration sources and non-test backend files automatically. Adding a database image, initialization script, Compose override, or migration therefore invalidates the cache without updating a filename registry.

Failures

Failed shard jobs upload the Playwright HTML report, traces, screenshots, videos, and backend service logs.

When you need a completely clean backend locally:

E2E_SKIP_CLEANUP=false pnpm e2e:builder