marcstraube / marcstraube/zappzarapp-php-devtoolbar

test(e2e): Playwright browser tests with visual regression

Open
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

effort:l enhancement
Dominant language
PHP
Stars
0
Forks
0
Avg merge
3m
Merged PRs (30d)
4

Description

Motivation

The frontend suite runs on happy-dom — it tests logic, not rendering. The toolbar's product-specific risks live only in a real browser: it is an overlay injected into arbitrary host pages (stacking contexts, CSS leakage in both directions, scroll/focus behavior, whether panels stay clickable after innerHTML rewrites). The upcoming refactorings (#27 event delegation, #28 storage) change exactly this interaction layer — the functional browser tests should land first, as the safety net underneath them.

As a public package running inside arbitrary consumer environments, the toolbar is tested across all three browser engines.

Setup

  • Playwright with testDir: './e2e'; vitest + happy-dom stays the fast default gate, Playwright covers everything that needs a real browser.
  • Projects: Chromium, Firefox and WebKit — public package, consumers develop on all three engines.
  • Visual snapshots pinned to one engine (Firefox) inside the tests (test.skip on other engines) with maxDiffPixelRatio: 0.01 against sub-pixel font noise. Cross-engine layout breakage is caught by the functional assertions; individual per-engine baselines can be added later if an engine-specific rendering bug shows up.
  • webServer: a small PHP fixture app (php -S + front controller) that boots the real toolbar via a composer path-require with ENABLE_DEV_TOOLBAR=true — testing the actual injectToolbar() path, not an isolated frontend.
  • CI: dedicated job on the official Playwright image (consistent baseline rendering); retries: 1, trace: on-first-retry, HTML reporter kept as artifact.

Functional cases (all engines)

  • Mini bar renders after page load; panel opens/closes; tab switching works.
  • Toggle shortcut works — and does not fire inside input fields (regression net for #27).
  • History survives a reload; request switcher works.
  • Xdebug cookie toggle sets/clears the cookie.
  • No console errors; host page DOM/styles remain untouched (spot-check assertions).

Visual baselines (Firefox-pinned)

  • Mini bar (collapsed); open panel with one populated collector tab.
  • Baselines committed; regeneration documented (docker command) in TESTING.md.

Ordering

Functional cases land before #27/#28. Visual baselines are frozen after #27 — otherwise they cement the pre-refactoring state and every adoption PR churns them.

Acceptance criteria

  • All functional cases green on Chromium, Firefox and WebKit, locally and in CI.
  • Visual baselines committed and reproducible via the documented docker path.
  • CI job wired in and required.
  • TESTING.md documents running, debugging (--ui), and baseline regeneration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the planned e2e test directory and Playwright configuration, then inspect the real injectToolbar() path and the PHP fixture front controller described in the issue. Implement the listed functional cases, Firefox-pinned visual baselines, CI job, and TESTING.md guidance; done means all acceptance criteria pass across the three engines and the documented Docker workflow reproduces the snapshots.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, github-actions, php, playwright
Domain
ci-cd, devtools, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.