chore: re-query before clicks to prevent detached-DOM flakiness#96
Merged
jtroup merged 1 commit intostacklet/integrationfrom Mar 10, 2026
Merged
chore: re-query before clicks to prevent detached-DOM flakiness#96jtroup merged 1 commit intostacklet/integrationfrom
jtroup merged 1 commit intostacklet/integrationfrom
Conversation
Ahmore
approved these changes
Mar 10, 2026
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.
what
Fix the detached-DOM anti-pattern across all Cypress e2e tests: split
every chained
.should(...).action()call into separate queries — onestatement for the assertion, a fresh
cy.get()for the action.why
When
.should()and an action (.click(),.type(), etc.) are chainedon the same element reference, React can re-render between those two
Cypress commands, replacing the original DOM node. Cypress then tries to
act on the now-detached reference and times out.
The immediate trigger was
Table - renders all cell typesfailing in CIwith
CypressError: cy.click() failed because this element is detached from the DOMon thejvi-togglespan (confirmed in CI logs).A sweep of all spec files found the same pattern in 12 other places,
including the
LogOutButton(inside a just-opened dropdown),EditTagsButton(text-content assertion on a stateful button), theNewVisualizationbutton (after async query execution), and theExecuteButton(9 occurrences across visualization and query specs).Re-querying with a fresh
cy.get()before each action ensures Cypressholds a live DOM reference and re-activates its built-in actionability
retry loop, making the interaction self-healing if a re-render occurs.
testing
Diagnosed from CI e2e test output. Fix aligns with the standard Cypress
guidance for detached-DOM errors:
https://on.cypress.io/element-has-detached-from-dom
docs
No docs needed.
🤖 Generated with Claude Code