Skip to content

test(e2e): deep Playwright coverage for the React Scan overlay UI#459

Merged
aidenybai merged 3 commits into
mainfrom
cursor/deep-overlay-e2e-tests-d9da
May 29, 2026
Merged

test(e2e): deep Playwright coverage for the React Scan overlay UI#459
aidenybai merged 3 commits into
mainfrom
cursor/deep-overlay-e2e-tests-d9da

Conversation

@aidenybai

Copy link
Copy Markdown
Owner

Summary

The existing e2e suite mostly pokes at React Scan internals through window.__REACT_SCAN__ and rarely drives the actual Preact overlay UI. This PR adds deep, interaction-driven Playwright tests that exercise the real overlay interface mounted inside the shadow root — clicking the toolbar controls, running the full inspect→focus→inspect flow, opening the notifications panel, and asserting widget container behavior.

Playwright CSS locators pierce the open shadow root, so the tests target the overlay's actual buttons, toggles, and panels rather than reaching into signals.

What's added

New helpers in e2e/helpers.ts:

  • Centralized overlay selectors (TOOLBAR_SELECTORS) and an InspectStateKind type.
  • getInspectStateKind / waitForInspectStateKind, isOutlineInstrumentationPaused.
  • Locator getters (toolbarWidget, inspectButton, notificationsButton, outlineToggle) and waitForToolbarReady.
  • enterInspectMode and focusComponent — the latter drives raw pointer coordinates because the overlay's full-screen event-catcher obscures element-targeted clicks while inspecting.
  • clickToolbarControl (dispatches the click directly so resize handles overlapping a control can't swallow it) and blurOverlay (restores page focus for the global Escape shortcut).

New specs:

  • e2e/overlay-toolbar.spec.ts — toolbar renders with its controls; FPS meter paints; inspect button enters/exits inspecting mode and its icon color reflects state; the outline toggle pauses/resumes instrumentation and persists react-scan-options to localStorage.
  • e2e/overlay-inspector.spec.ts — full inspect→focus flow: overlay canvas activates, clicking a component focuses it and opens the inspector panel + component tree, the header shows the component name, the copy button appears, the close button returns to inspect-off, Escape steps focused→inspecting, and re-focusing keeps the inspector open.
  • e2e/overlay-notifications.spec.ts — notifications button opens/closes the panel (verified via widget expansion), opening turns inspection off, the slowdown-history chrome renders, and a deliberately slow interaction is recorded and surfaced.
  • e2e/overlay-widget.spec.ts — widget mounts with expected attributes, fades in, exposes all four resize handles, persists widget settings to localStorage, survives repeated host-app interactions, and expands when a panel opens.

Testing

  • pnpm build
  • pnpm test:e2e ✅ (all new overlay tests pass)
  • Stability: ran the four new specs with --repeat-each (84/84 and 52/52 passing) to eliminate flakiness from the FPS sampling interval and from React Scan incidentally recording a slow render under CPU contention.

Notes

  • No source files were changed — tests only.
  • Pre-existing repo-wide pnpm lint/pnpm format:check/pnpm typecheck issues are untouched and unrelated to these tests (e.g. ban-ts-comment in core/utils.ts, a deprecated tsconfig option in packages/extension, and the repo not being oxfmt-formatted). The new files follow the established style of the existing e2e/ specs.
Open in Web Open in Cursor 

cursoragent and others added 2 commits May 29, 2026 01:25
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
…der load

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
react-scan Skipped Skipped May 29, 2026 3:08am

@aidenybai aidenybai marked this pull request as ready for review May 29, 2026 03:01
await clickToolbarControl(inspectButton(page));
await waitForInspectStateKind(page, 'inspecting');
expect(await getInspectStateKind(page)).toBe('inspecting');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test doesn't verify panel teardown it claims to

Low Severity

The test title says "toggling inspect button off while focused tears down the panel" but the test body never asserts the inspector panel is hidden. It only verifies the state transitions to 'inspecting' — not 'inspect-off' as the title implies. Other tests in this file explicitly check inspectorPanel visibility (lines 39, 93), establishing the pattern this test omits. The inline comment ("advances to 'inspecting'") contradicts the title ("off"), and the core claim — panel teardown — goes unverified.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7508b4e. Configure here.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Comment on lines +102 to +105
// From "focused" the inspect button advances to "inspecting".
await clickToolbarControl(inspectButton(page));
await waitForInspectStateKind(page, 'inspecting');
expect(await getInspectStateKind(page)).toBe('inspecting');

@vercel vercel Bot May 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// From "focused" the inspect button advances to "inspecting".
await clickToolbarControl(inspectButton(page));
await waitForInspectStateKind(page, 'inspecting');
expect(await getInspectStateKind(page)).toBe('inspecting');
// From "focused" the inspect button toggles to "inspect-off".
await clickToolbarControl(inspectButton(page));
await waitForInspectStateKind(page, 'inspect-off');
expect(await getInspectStateKind(page)).toBe('inspect-off');
await expect(page.locator(TOOLBAR_SELECTORS.inspectorPanel)).not.toBeVisible();

Test expects wrong state transition and missing panel teardown assertion when toggling inspect button off while focused

Fix on Vercel

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 99fbf64. Configure here.

await notificationsButton(page).click();
await expect(historyHeader(page)).toBeVisible();
expect(await getInspectStateKind(page)).toBe('inspect-off');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test never activates inspection before asserting it turns off

Medium Severity

The test "opening notifications turns inspection off" never enters inspect mode before opening the notifications panel. Since the default state after gotoFixture is already inspect-off (confirmed by the existing inspector.spec.ts), the assertion expect(await getInspectStateKind(page)).toBe('inspect-off') trivially passes without actually verifying that opening notifications causes inspection to turn off. The test would pass even if the notifications panel had zero effect on inspection state. An enterInspectMode(page) call is needed before clicking the notifications button.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 99fbf64. Configure here.

@aidenybai aidenybai merged commit 759b6da into main May 29, 2026
4 of 6 checks passed
@aidenybai aidenybai deleted the cursor/deep-overlay-e2e-tests-d9da branch May 29, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants