Skip to content

test(cypress): improve resilience of files-copy-move sharing tests#59144

Draft
joshtrichards wants to merge 1 commit intomasterfrom
jtr/test-cy-filesSharing-copyMove-flakiness
Draft

test(cypress): improve resilience of files-copy-move sharing tests#59144
joshtrichards wants to merge 1 commit intomasterfrom
jtr/test-cy-filesSharing-copyMove-flakiness

Conversation

@joshtrichards
Copy link
Member

  • Resolves: #

Summary

Hardens the files-copy-move.cy.ts Cypress tests against flaky failures caused by DOM re-renders inside the file picker.

Changes:

  • Drop .within() scoping in copyFileForbidden and moveFileForbidden — the file picker can re-render during navigation, leaving .within() bound to a detached element. Each command now re-queries from the root.
  • Remove dead cy.intercept() calls — both helpers registered intercepts that were never cy.wait()-ed on.
  • Add visibility gatescy.get('.file-picker').should('be.visible') before first interaction and after breadcrumb navigation.
  • Fix missing CSS.escape() in moveFileForbidden directory selector, matching the existing pattern in copyFileForbidden.
  • Fix should('not.exist') anti-patterncy.contains(selector) must find an element before a chained .should('not.exist') can negate it, causing unnecessary full-timeout waits. Replaced with cy.get('.file-picker').should('not.contain', text).
  • Increase assertion timeouts to 10 s for button state checks on slower CI runners.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

- Remove `.within()` scoping to avoid stale DOM references on re-render
- Remove unused `cy.intercept()` calls (aliases were never awaited)
- Add explicit visibility gates before file picker interactions
- Re-query `.file-picker` per command chain for DOM freshness
- Add `CSS.escape()` to `moveFileForbidden` directory selector (bug fix)
- Increase assertion timeouts for slow CI environments
- Replace `cy.contains().should('not.exist')` anti-pattern with
  `cy.get().should('not.contain')` for correct negative assertion

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added the tests Related to tests label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant