Skip to content

refactor(mcp): rename and restructure sidebar opening functions for c… - #771

Merged
pikann merged 2 commits into
masterfrom
fix/fix-failed-e2e-testings
Nov 15, 2026
Merged

pikann merged 2 commits into
masterfrom
fix/fix-failed-e2e-testings

Conversation

@pikann

@pikann pikann commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes the failing mobile-chrome Playwright run in CI (run 43713324033): Managed copies › a managed copy shows where it comes from in apps/e2e/tests/docs/managed-copies.spec.ts.

Why it failed

On phones (viewport < 768px) the sidebar, and with it the docs tree, is a Sheet that starts closed. The test asserted on the tree rows (Plan … Copy of … and Plain) without opening it, so the locators were never found. Desktop projects always show the tree, so only mobile-chrome failed.

Changes

  • Extract the "open the sidebar if the viewport is under 768px" logic from openDocsTree into a new openSidebarOnPhone helper (no-op on wider screens).
  • openDocsTree now uses the helper.
  • The failing test calls the helper before both tree assertions. The second one is needed because navigating to the plain doc closes the Sheet again.

Test-only change; no app code touched.

Verification

Ran tests/docs/managed-copies.spec.ts against the isolated e2e docker stack (deploy/docker-compose.e2e.yml): 14/14 passed (7 on chromium, 7 on mobile-chrome). Biome check passes. The rest of the e2e suite was not re-run locally.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ Minor suggestion inline. The fix is correct — I re-read the failing run's log and the pre-fix assertion failed with element(s) not found / Timeout: 5000ms, exactly the unmounted-Sheet symptom described in the PR body.

Reviewed changes

  • openSidebarOnPhone helper — extracts the "viewport < 768 → click Toggle Sidebar" block from openDocsTree into a reusable helper, and openDocsTree now goes through it.
  • Tree assertions on phones — a managed copy shows where it comes from opens the Sheet before both sidebar row assertions (:205, :215), since the second follows a full page.goto that remounts the app with the Sheet closed.
  • Reorder — expectEditable(page, true) moved ahead of the second open; order-only, toHaveAttribute does not depend on visibility.

ℹ️ That run had a second, unrelated failure this PR does not cover

The mobile-safari job hit the same managed-copies failure (covered here, since the helper keys off viewport width) but also a pre-existing flake in docs.spec.ts, so a dispatched safari run may still report a failure after this merges.

Technical details
# Remaining e2e failures in run 43713324033

## Affected sites
- `apps/e2e/tests/docs/managed-copies.spec.ts:175` — failed on all 3 attempts in both mobile jobs (fixed here).
- `apps/e2e/tests/docs/docs.spec.ts:350` — "Rename a document from the sidebar", `mobile-safari` job 132809463755: failed twice, passed on retry #2.

## Evidence
- The safari error is `expect(...).toBe('Final')` receiving `'Draft'` from `GET /docs/{id}` while the sidebar already showed `Final`, i.e. the write had not landed when the API was read — a missing `expect.poll`, independent of the sidebar changes.

## Required outcome
- None for this PR; recorded so a still-red safari run is not attributed to this change.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found. The follow-up commit addresses the earlier note exactly, and I verified the wait is sound against the Sidebar's mount semantics.

Reviewed changes

Since the prior pullfrog review (2fff861), one commit (2390c7c) landed:

  • Helper now waits for a mounted Sheet — after the Toggle Sidebar click, openSidebarOnPhone awaits getByText("Documentation", { exact: true }) with a 10 s budget, so callers can assert on tree rows without carrying their own timeout.
  • Comment updated — the helper's JSDoc now says it "opens it and waits for the docs tree", matching the new behavior.

Two things I checked while validating the wait, so the next reader does not have to: Sidebar renders only the Sheet when isMobile (apps/web/src/components/ui/sidebar.tsx:202), so there is no hidden desktop copy of the "Documentation" label that could trip strict mode; and the label renders unconditionally in app-sidebar.tsx:1080, including when the docs group is collapsed, so it signals mount rather than the row fetch. The < 768 test also matches useIsMobile's breakpoint.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pikann
pikann merged commit ed1fd24 into master Nov 15, 2026
2 checks passed
@pikann
pikann deleted the fix/fix-failed-e2e-testings branch November 15, 2026 13:50
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.

1 participant