Skip to content

FE-2013: Wait for controls inside an opening Collapse to be fully shown before clicking - #10077

Merged
0xRezaa merged 1 commit into
mainfrom
claude/fe-2013-wait-for-collapsed-controls-before-clicking
Oct 18, 2026
Merged

0xRezaa merged 1 commit into
mainfrom
claude/fe-2013-wait-for-collapsed-controls-before-clicking

Conversation

@claude

@claude claude Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Requested by Tim Diekmann · Slack thread

🌟 Purpose

The PDF preview search test failed in CI because it clicked Next result about 124 ms into the search box's opening animation. The button sits inside two nested horizontal Collapses that clip it until they finish. Playwright judged it visible and stable, since the wrapper clips the button without moving it. The click then scrolled the clipped wrappers sideways to reach the button. As the wrappers grew, they scrolled back and the button slid out from under the pointer. onClick never ran: the counter stayed at "1 of 2" and the page stayed on page 1.

This PR makes the tests wait until such a control is fully shown before clicking it. It applies the wait to every spec found clicking a control inside an opening Collapse.

🔍 Changes

  • expectFullyShown in tests/shared/expect-fully-shown.ts wraps toBeInViewport({ ratio: 1 }). In Playwright 1.58.2 the check reads intersectionRatio from an IntersectionObserver with the viewport as root. The spec clips that intersection by every ancestor with overflow other than visible, so the ratio reaches 1 only once the Collapse wrappers stop clipping the element. The check does not scroll, so it sees the natural layout.
  • PDF and DOCX search tests: wait for the search input to be fully shown before filling it, so fill does not scroll the outer wrapper while it opens. Then wait for Next result, click it, and assert the counter moves from "1 of 2" to "2 of 2". The PDF test previously asserted neither count.
  • entity-type-editing.spec.ts: the parent card's remove button sits in a horizontal Collapse that opens on hover (TypeCard), the same pattern as the search box. It now waits before clicking.
  • entities-page.spec.ts: the sidebar entity type item sits in nested vertical Collapses (the section and the item's TransitionGroup entry). When expandSidebarSection opens the section, the click can hit the same scroll-back. It now waits before clicking.

Other clicks after an opening transition were judged safe and left alone:

  • Menu items (types-page web filter, row Options for … menu, account dropdown Settings/Sign Out): MUI Menu uses Grow, which scales the paper. The item's box changes every frame, so Playwright's stability check already waits for the animation to end. Nothing clips the item.
  • Autocomplete options (selector-autocomplete-option, type selector option): the popper has no transition.
  • The MFA backup-codes Modal: Fade changes only opacity. The button neither moves nor gets clipped.
  • create-entity-type-btn: in the section header, outside the Collapse.

⚠️ Known issues

  • toBeInViewport also needs the element inside the browser viewport. The sidebar's Document item is expected near the top of the list. If a seed change ever pushes it below the fold, that assertion fails every time rather than intermittently.

Generated by Claude Code

…hown before clicking

A control inside a `Collapse` that is still opening is visible and stable
to Playwright while the `Collapse` clips it. The click scrolls the
clipping wrapper to reach the control, the wrapper scrolls back as it
grows, and the pointer event lands beside the control.

`expectFullyShown` waits until `toBeInViewport({ ratio: 1 })` passes,
which happens only once no ancestor clips the element. The PDF and DOCX
search tests, the parent-card remove button, and the sidebar entity type
item now wait for it before clicking. The PDF search test also asserts
that the result counter moves from "1 of 2" to "2 of 2".
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hash Ready Ready Preview Oct 18, 2026 4:52pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 18, 2026 4:52pm UTC
petrinaut Skipped Skipped Oct 18, 2026 4:52pm UTC
petrinaut-docs Skipped Skipped Oct 18, 2026 4:52pm UTC

Request Review

@github-actions github-actions Bot added area/tests New or updated tests area/tests > playwright New or updated Playwright tests labels Oct 18, 2026
@TimDiekmann
TimDiekmann requested a review from a team October 18, 2026 16:52
@TimDiekmann
TimDiekmann marked this pull request as ready for review October 18, 2026 16:52
Copilot AI balanced review requested due to automatic review settings October 18, 2026 16:52
@cursor

cursor Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Playwright test-only changes with no production or runtime behavior impact.

Overview
Adds a Playwright helper expectFullyShown that waits until an element is fully in the viewport (toBeInViewport({ ratio: 1 })), so clicks and fills do not run while nested Collapse animations still clip the target.

Specs now call it before interacting with controls inside opening collapses: sidebar Document link after expanding Entities, remove-parent on entity type cards, and PDF/DOCX preview search input and Next result. The PDF search test also asserts the result counter moves from 1 of 2 to 2 of 2.

Reviewed by Cursor Bugbot for commit 15835b2. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI 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.

🟢 Approval recommended

The focused test-only changes address animation clipping, with no unresolved blocking findings.

No open issues 🎉

What changed in this PR

Stabilizes Playwright tests by waiting for controls inside opening Collapse components to be fully shown before interacting.

Changes:

  • Adds a shared full-visibility assertion.
  • Applies waits to document search, parent removal, and sidebar navigation.
  • Adds PDF search-result count assertions.
File Description
tests/​hash-playwright/​tests/​shared/​expect-fully-shown.ts Adds the reusable viewport assertion.
tests/​hash-playwright/​tests/​features/​file-preview/​pdf.spec.ts Waits for search controls and verifies result counts.
tests/​hash-playwright/​tests/​features/​file-preview/​docx.spec.ts Waits before interacting with search controls.
tests/​hash-playwright/​tests/​features/​entity-type-editing.spec.ts Waits for the parent removal button.
tests/​hash-playwright/​tests/​features/​entities-page.spec.ts Waits for the sidebar Document item.

Review effort: Balanced

@0xRezaa
0xRezaa added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit ffb509b Oct 18, 2026
53 checks passed
@0xRezaa
0xRezaa deleted the claude/fe-2013-wait-for-collapsed-controls-before-clicking branch October 18, 2026 18:37

This branch was successfully deployed

1 active and 2 inactive deployments
Preview – hash — 15835b29 Deployed Oct 18, 2026 by vercel[bot]
Preview – petrinaut-docs — 15835b29 Deployed Oct 18, 2026 by vercel[bot]
Preview – petrinaut — 15835b29 Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tests > playwright New or updated Playwright tests area/tests New or updated tests

Development

Successfully merging this pull request may close these issues.

4 participants