Stabilize files sidebar Cypress specs by replacing fixed waits with state-based assertions#60314
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/nextcloud/server/sessions/249a9f22-5ed4-46a7-908e-e233ba3659a6 Co-authored-by: joshtrichards <1731941+joshtrichards@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nextcloud/server/sessions/249a9f22-5ed4-46a7-908e-e233ba3659a6 Co-authored-by: joshtrichards <1731941+joshtrichards@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update Cypress sidebar tests to use state-based waits
Stabilize files sidebar Cypress specs by replacing fixed waits with state-based assertions
May 12, 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.
Summary
This updates
cypress/e2e/files/files-sidebar.cy.tsto remove fixedcy.wait(600)timing dependencies and make sidebar transitions assert against deterministic UI state.The result is less flaky behavior around sidebar switching/deletion flows where DOM re-renders can race interactions.
Sidebar assertion helpers
assertSidebarShows(name)assertSidebarIsClosed()assertSidebarHeadingNotPresent(name)State-based waits instead of sleeps
cy.wait(600)calls.Flow hardening in targeted specs
changes the sidebar content on other filefilefileIdbefore switchingfolderfolderfileheading is absentcloses the sidebar on deletefileIdbefore deletefileIdchanges the fileid on deleteotherFileIdbefore deleteotherrow gone, URL no longer containsotherFileIdTODO
Checklist
3. to review, feature component)stable32)AI (if applicable)
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/server/server/node_modules/.bin/cypress install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Update the Cypress sidebar tests in
cypress/e2e/files/files-sidebar.cy.tsto replace the fixedcy.wait(600)calls with state-based waits and helper assertions.Context:
Required changes:
cypress/e2e/files/files-sidebar.cy.ts.cy.wait(600)calls with state-based waits/assertions.filefolderfolderfileheading is no longer presentfileotherotherFileIdbefore deletingotheris gone, and the URL no longer contains that file idAlso consider whether
cypress/e2e/files/FilesUtils.tsshould be updated in the same PR to maketriggerActionForFile()andtriggerActionForFileId()more robust against DOM re-renders by re-querying the visible menu after clicking the Actions button instead of depending on a possibly stale chain througharia-controls. If you include that change, keep it minimal and directly related to reducing this test flakiness.Validation:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: I suspect we have various places where the following types of failure is a high probability: check this class for this type of problem (and the class reported in the error too) and identify a concrete solution
Assistant: Yes — the concrete problem is a Cypress stale-element / DOM re-render race, and the most likely fix is to make the action helper atomic and to stop holding onto sidebar DOM across transitions.
What failed
The failure around:
is very likely caused by the UI re-rendering while
triggerActionForFile()is traversing row → actions button → menu → menu item.The helper itself is vulnerable:
Why it failed
The bad assumption is: once the row action button is found and clicked, the menu lookup remains valid through the next DOM update.
But in these sidebar tests, opening details for one item and then quickly opening details for another item is exactly the kind of flow that causes:
The existing
cy.wait(600)infiles-sidebar.cy.tsis a strong signal the test already knows this path is race-prone.Root cause
The root cause is not line 61 itself. It is that
triggerActionForFile()performs a multi-step interaction against UI that can re-render between steps, and the sidebar tests exercise that unstable path repeatedly.There are two hot spots:
getActionButtonForFile(filename)and then `getActionEntryForFile(filename, action...This pull request was created from Copilot chat.