test(functionalities): fix copy-page button test hydration race#471
Open
g-despot wants to merge 1 commit into
Open
test(functionalities): fix copy-page button test hydration race#471g-despot wants to merge 1 commit into
g-despot wants to merge 1 commit into
Conversation
The copy-page button is server-rendered, so Playwright clicked it before React hydrated and attached onClick — the click was dropped and the label never reached 'Copied!', failing the nightly suite deterministically on slower CI. Clipboard permissions were already granted (not the cause). Wait for networkidle (hydration) then retry the click. Test-only; the feature works.
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The nightly Docs Functionalities Tests suite has been red (both
test_copy_page_button_writes_markdownparams:/weaviate/quickstart,/weaviate/search/bm25) since at least Jul 5 — the "Copy page" button never showed "Copied!" within the timeout.Root cause: a hydration race in the test — not a feature bug, not clipboard
The button is server-rendered, so Playwright reports it "visible" before React hydrates and attaches its
onClick. A click landing in that gap is silently dropped, so the label stays on "Copy page" and never reports success. The fixture already grantsclipboard-read/clipboard-write, and a direct Clipboard API round-trip works in the test context — clipboard was a red herring. It fails deterministically (not flaky) because heavier pages and slower headless CI runners lose the race every time. The copy-page feature itself (from #460) is deployed and works.Fix (test-only)
After the button is visible, wait for the page JS to finish loading (
wait_for_load_state("networkidle"), non-fatal so a chatty live page can't hang the test), then retry the click a few times until the aria-live span reports "Copied!". No site source changed.Verification
uv run pytest -m functionalitiesagainst livedocs.weaviate.io:test_copy_page_button_writes_markdown[/weaviate/quickstart]— PASSEDtest_copy_page_button_writes_markdown[/weaviate/search/bm25]— PASSEDStable across repeated runs (verified independently). All downstream assertions (markdown length,
Source:prefix, fenced code block, no page chrome) still pass.