Skip to content

fix: rewrite responsive e2e tests to match current toolbar UI (#1347)#1349

Merged
ggfevans merged 4 commits intomainfrom
fix/1347-webkit-responsive-brand
Feb 27, 2026
Merged

fix: rewrite responsive e2e tests to match current toolbar UI (#1347)#1349
ggfevans merged 4 commits intomainfrom
fix/1347-webkit-responsive-brand

Conversation

@ggfevans
Copy link
Collaborator

@ggfevans ggfevans commented Feb 27, 2026

User description

Summary

  • Rewrote e2e/responsive.spec.ts to match the current toolbar implementation (no hamburger menu/drawer — mobile uses direct Save/Load/Export buttons + bottom navigation)
  • Replaced all broken class-based selectors (.brand-name, aside.sidebar, .hamburger-icon, .toolbar-drawer, .drawer-item) with stable, user-visible signals (aria-label, role, existing classes)
  • Removed the phone viewport dialog test that depended entirely on defunct drawer UI
  • Net: -195 lines, +41 lines (removed dead test code)

Test plan

  • All 16 responsive tests pass on Chromium locally
  • CI passes on WebKit (the originally failing browser)
  • No regressions in adjacent E2E specs

Closes #1347

🤖 Generated with Claude Code


CodeAnt-AI Description

Update responsive end-to-end tests to match the current toolbar UI

What Changed

  • Replaced assertions that expected a hamburger/drawer navigation with checks for visible toolbar center, direct Save/Load/Export action buttons on narrow viewports, and a bottom navigation button
  • Switched brand and sidebar checks to use stable, user-visible labels so tests verify the Rackula brand image and the sidebar pane are visible
  • Removed phone-dialog and drawer-opening tests that relied on the old hamburger/drawer interaction
  • Adjusted pan/zoom reset test to use a keyboard shortcut and verify the canvas container is interactive

Impact

✅ Fewer flaky responsive tests
✅ Tests reflect current mobile toolbar behavior (Save/Load/Export and bottom nav visible)
✅ Clearer test failures for branding and sidebar visibility

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The responsive E2E spec was written for a previous toolbar design that
had hamburger menus and drawer navigation. The current toolbar uses a
simpler mobile layout with direct Save/Load/Export buttons and bottom
navigation. Updated all selectors to use stable, user-visible signals
(aria roles/labels) instead of brittle class-based selectors.

Key changes:
- Replace .brand-name with role-based selector (SVG aria-label)
- Replace aside.sidebar with .sidebar-pane
- Remove nonexistent hamburger/drawer tests
- Add mobile action button and bottom nav assertions
- Remove phone dialog test (relied on defunct drawer UI)

Fixes #1347

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 27, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e405135 and 0fe5faf.

📒 Files selected for processing (1)
  • e2e/responsive.spec.ts

📝 Walkthrough

Walkthrough

Rewrites the responsive E2E test to match updated UI structure: replaces legacy selectors with toolbar-brand, .toolbar-center, and .sidebar-pane; removes large-phone/dialog tests; adds role-based File menu and mobile action assertions; and changes pan/zoom reset to use the "f" keyboard shortcut with transform polling.

Changes

Cohort / File(s) Summary
Responsive E2E Test
e2e/responsive.spec.ts
Reworked responsive test: replaced .brand-name, .hamburger-icon, aside.sidebar with .toolbar-brand (img role "Rackula"), .toolbar-center, .sidebar-pane; removed large-phone/dialog coverage; added role-based File menu checks; mobile assertions now expect hidden center cluster and visible mobile Save/Load/Export controls; panzoom reset uses "f" key and verifies transform change via polling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped through selectors, swift and spry,

swapped old classes for a brand-new sky,
hid the center when the screen grew small,
pressed "f" to reset and watched transforms fall,
a tiny logo winked — a rabbit's call.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: rewriting responsive e2e tests to match the current toolbar UI implementation.
Description check ✅ Passed The description is clearly related to the changeset, explaining the rewrite of e2e/responsive.spec.ts tests to match the current toolbar without hamburger/drawer patterns.
Linked Issues check ✅ Passed The PR fully addresses issue #1347 by replacing brittle .brand-name selectors with stable user-visible signals (aria-label, role, img pattern) and updating tests to reflect current toolbar behavior.
Out of Scope Changes check ✅ Passed All changes are directly scoped to updating e2e/responsive.spec.ts tests to align with the current toolbar UI; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/1347-webkit-responsive-brand

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:M This PR changes 30-99 lines, ignoring generated files label Feb 27, 2026
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 27, 2026

CodeAnt AI finished reviewing your PR.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/responsive.spec.ts`:
- Around line 23-26: The test "sidebar pane is visible" currently uses a class
selector via page.locator(".sidebar-pane"); if the sidebar is implemented with
an <aside> element prefer using the semantic Playwright query
page.getByRole('complementary') instead to improve accessibility-based
selection; update the test to use page.getByRole('complementary') when the DOM
uses <aside>, otherwise keep the existing ".sidebar-pane" selector (adjust the
locator in the test function named "sidebar pane is visible").
- Around line 62-75: Update the Playwright selectors to use case-insensitive
regex name matching instead of exact strings: replace page.getByRole("button", {
name: "Save layout" }) / "Load layout" / "Export layout" with
page.getByRole("button", { name: /save layout/i }) / /load layout/i / /export
layout/i for the test "mobile action buttons are shown" (variables saveBtn,
loadBtn, exportBtn), and replace page.getByRole("button", { name: "Devices" })
with page.getByRole("button", { name: /devices/i }) for the "bottom navigation
is visible" test (variable bottomNav) so the tests are resilient to casing/
minor wording changes.
- Around line 154-159: The test "reset view via keyboard shortcut" currently
only presses "f" and checks visibility, which doesn't verify reset behavior;
update the test to first change the view (e.g., use page.mouse.drag or
page.keyboard to pan and page.mouse.wheel or a zoom control to change scale) so
the panzoom container has a non-default transform, then press "f", and finally
assert that the panzoom container's transform or style (the ".panzoom-container"
locator) has returned to the identity/default (e.g., transform matrix equals
identity or top/left/scale equal defaults) to confirm the reset action worked.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c9023de and 892efde.

📒 Files selected for processing (1)
  • e2e/responsive.spec.ts

Comment on lines +23 to 26
test("sidebar pane is visible", async ({ page }) => {
const sidebar = page.locator(".sidebar-pane");
await expect(sidebar).toBeVisible();
});
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Acceptable class-based selector for sidebar.

If the sidebar uses <aside>, consider using page.getByRole('complementary') for a more semantic selector. Otherwise, the class selector is fine.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/responsive.spec.ts` around lines 23 - 26, The test "sidebar pane is
visible" currently uses a class selector via page.locator(".sidebar-pane"); if
the sidebar is implemented with an <aside> element prefer using the semantic
Playwright query page.getByRole('complementary') instead to improve
accessibility-based selection; update the test to use
page.getByRole('complementary') when the DOM uses <aside>, otherwise keep the
existing ".sidebar-pane" selector (adjust the locator in the test function named
"sidebar pane is visible").

- Use case-insensitive regex for mobile button aria-label matching
- Enhance reset view test to verify actual transform reset behaviour
  (set non-default transform, press "f", assert transform changed back)
- Sidebar selector kept as .sidebar-pane (not <aside> at desktop viewport)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/responsive.spec.ts`:
- Around line 154-176: Replace the brittle sleep after triggering the reset
shortcut with a Playwright auto-retrying assertion: after calling
page.keyboard.press("f") remove page.waitForTimeout(300) and instead assert on
the panzoomContainer locator that its style attribute matches the default
transform (e.g. use expect(panzoomContainer).toHaveAttribute("style",
/matrix\(1,\s*0,\s*0,\s*1/, { timeout: 2000 }) or another regex for your
default), so the test retries until the transform resets rather than relying on
a fixed timeout.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 892efde and b824cca.

📒 Files selected for processing (1)
  • e2e/responsive.spec.ts

Use expect.poll() instead of waitForTimeout(300) in the reset view
test so Playwright retries until the transform changes rather than
relying on a fixed sleep.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/responsive.spec.ts`:
- Around line 154-174: The test "reset view via keyboard shortcut" currently
forces the transform by DOM mutation which bypasses the panzoom library state;
replace the page.evaluate DOM set with an actual pan gesture (use the same
approach as the "can pan the canvas" test: locate .panzoom-container, use
page.mouse.move/page.mouse.down/page.mouse.move/page.mouse.up to perform a pan)
so the library's internal state updates, then assert the style on
panzoomContainer and press "f" and poll as before; update any references to
transformBefore and the panzoomContainer locator accordingly.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b824cca and e405135.

📒 Files selected for processing (1)
  • e2e/responsive.spec.ts

Comment on lines 154 to 174
test("reset view via keyboard shortcut", async ({ page }) => {
const panzoomContainer = page.locator(".panzoom-container");

// Pan the view to a non-default position
await page.evaluate(() => {
const container = document.querySelector(".panzoom-container");
if (container) {
(container as HTMLElement).style.transform =
"matrix(0.5, 0, 0, 0.5, -300, -300)";
}
});

const resetButton = page.locator('.drawer-item:has-text("Reset View")');
await resetButton.click();
const transformBefore = await panzoomContainer.getAttribute("style");
expect(transformBefore).toContain("-300");

await expect(
page.locator('.toolbar-drawer:not([aria-hidden="true"])'),
).not.toBeVisible();
// Press "f" to reset view — auto-retry until transform changes
await page.keyboard.press("f");
await expect
.poll(() => panzoomContainer.getAttribute("style"), { timeout: 2000 })
.not.toContain("-300");
});
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider using actual pan gesture instead of direct DOM manipulation.

The expect.poll() pattern is a good improvement over waitForTimeout. However, directly setting the transform via page.evaluate() bypasses the panzoom library's internal state. If the reset shortcut reads from the library's state rather than the DOM, this test could pass/fail inconsistently.

Since the "can pan the canvas" test (lines 128-152) already demonstrates real panning via mouse gestures, consider reusing that approach for a more realistic test flow.

♻️ Suggested refactor using actual pan gesture
     test("reset view via keyboard shortcut", async ({ page }) => {
       const panzoomContainer = page.locator(".panzoom-container");
+      const canvas = page.locator(".canvas");

-      // Pan the view to a non-default position
-      await page.evaluate(() => {
-        const container = document.querySelector(".panzoom-container");
-        if (container) {
-          (container as HTMLElement).style.transform =
-            "matrix(0.5, 0, 0, 0.5, -300, -300)";
-        }
-      });
+      // Pan the view using actual mouse gesture
+      const canvasBox = await canvas.boundingBox();
+      if (canvasBox) {
+        const startX = canvasBox.x + canvasBox.width / 2;
+        const startY = canvasBox.y + canvasBox.height / 2;
+        await page.mouse.move(startX, startY);
+        await page.mouse.down();
+        await page.mouse.move(startX - 100, startY - 100, { steps: 5 });
+        await page.mouse.up();
+      }

-      const transformBefore = await panzoomContainer.getAttribute("style");
-      expect(transformBefore).toContain("-300");
+      const transformBefore = await panzoomContainer.getAttribute("style");
+      expect(transformBefore).toContain("matrix");

       // Press "f" to reset view — auto-retry until transform changes
       await page.keyboard.press("f");
       await expect
-        .poll(() => panzoomContainer.getAttribute("style"), { timeout: 2000 })
-        .not.toContain("-300");
+        .poll(async () => {
+          const style = await panzoomContainer.getAttribute("style");
+          // Check for identity matrix (reset state)
+          return style?.includes("matrix(1, 0, 0, 1, 0, 0)") ||
+                 style?.includes("matrix(1,0,0,1,0,0)");
+        }, { timeout: 2000 })
+        .toBe(true);
     });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/responsive.spec.ts` around lines 154 - 174, The test "reset view via
keyboard shortcut" currently forces the transform by DOM mutation which bypasses
the panzoom library state; replace the page.evaluate DOM set with an actual pan
gesture (use the same approach as the "can pan the canvas" test: locate
.panzoom-container, use
page.mouse.move/page.mouse.down/page.mouse.move/page.mouse.up to perform a pan)
so the library's internal state updates, then assert the style on
panzoomContainer and press "f" and poll as before; update any references to
transformBefore and the panzoomContainer locator accordingly.

- Rename bottom nav test and use semantic navigation role locator
- Keep DOM-based transform setup for reset view test (consistent with
  view-reset.spec.ts pattern; real mouse panning doesn't reliably
  change panzoom transform in this viewport)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ggfevans ggfevans merged commit bcfc3bb into main Feb 27, 2026
8 checks passed
@ggfevans ggfevans deleted the fix/1347-webkit-responsive-brand branch February 27, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: webkit responsive e2e cannot find brand name at 900px viewport

1 participant