test: fix intermittent CI failures in PHPUnit and Cypress suites#60802
Draft
miaulalala wants to merge 5 commits into
Draft
test: fix intermittent CI failures in PHPUnit and Cypress suites#60802miaulalala wants to merge 5 commits into
miaulalala wants to merge 5 commits into
Conversation
…ore asserting order getFolderContentsById issues no ORDER BY, so insertion order is not guaranteed. MariaDB 11.8 returns rows in a different physical order than earlier versions, causing consistent assertion failures on that matrix combination. Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The three testCopyBetweenStorage* variants all mount at the fixed paths /
and /substorage. These paths persist in the Filesystem mount singleton
between tests; if a prior test's cache entries linger under the same
storage numeric ID, copyFromCache() sees an existing entry and can fail
its consistency check on MySQL 8.0/8.4.
Using getUniqueID('/') (the same pattern as testCacheAPI) scopes each test
invocation to its own mount namespace, preventing cross-test contamination.
Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and files-renaming
After triggerActionForFile('rename') Vue re-renders the file row, detaching
the DOM element previously returned by getRowForFile(). Chaining .find() or
.findByRole() off that stale element causes Cypress to throw "subject is no
longer attached to the DOM".
Fix: use a fresh top-level cy.get()/cy.findByRole() after the rename action
instead of chaining off the row element. A fresh query causes Cypress to
retry from the document root, surviving the re-render.
This affects all 9 test cases in files-renaming.cy.ts and the renameFile()
utility in FilesUtils.ts (which is also used by live_photos.cy.ts).
Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…toggleVersionMenu
Two stale DOM issues in the versions panel utilities:
1. openVersionsPanel used cy.get('@Sidebar').find(...) to locate the versions
tab button. If the sidebar re-renders after opening, the stored alias is
stale. Fix: use a fresh combined selector cy.get('[data-cy-sidebar] [...]').
Also add a wait for at least one version entry to be rendered before
returning, ensuring callers don't race against the list population.
2. toggleVersionMenu chained .find('button') off .eq(index), which is a
common stale DOM pattern: if the versions list re-renders between finding
the nth entry and finding its button, the intermediate element is detached.
Fix: query all version buttons in one selector and pick by index, so
Cypress retries the full query as a unit.
Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9 tasks
…sUtils and files-renaming
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
Fixes five identified flaky test patterns found by cross-referencing ~50 recent CI failure runs:
CacheTest::testExtended—getFolderContentsByIdhas noORDER BY, so insertion order is not guaranteed. MariaDB 11.8 returns rows in a different physical order than earlier versions, causing consistent assertion failures on that matrix. Fix: sort by name before asserting.ViewTest::testCopyBetweenStorageCrossNonLocal— ThreetestCopyBetweenStorage*variants all mount at the fixed paths/and/substorage. These mounts persist in theFilesystemsingleton between tests; stale cache entries from a prior test's storage can causecopyFromCache()to fail itsput()consistency check on MySQL 8.0/8.4. Fix: usegetUniqueID('/')(the same pattern already used intestCacheAPI) to scope each invocation to its own mount namespace.files-renaming.cy.ts/FilesUtils::renameFile(5× CI failures) — AftertriggerActionForFile('rename'), Vue replaces the file row element. All 9 test cases infiles-renaming.cy.tsand therenameFile()utility chained.findByRole()/.find()offgetRowForFile(), which holds the now-detached element. Fix: use a fresh top-levelcy.findByRole()/cy.get()after the action; Cypress retries from the document root and survives the re-render. Also fixeslive_photos.cy.tsfailures that callrenameFile().filesVersionsUtils::toggleVersionMenu(4× CI failures inversion_deletion.cy.ts) — Chained.eq(index).find('button')is the canonical stale DOM pattern: if the versions list re-renders between finding the nth entry and finding its button, the intermediate element is detached. Fix: query all version buttons in one combined selector and pick by index, so Cypress retries the full query as a unit. Also stabilisesopenVersionsPanelby: (a) removing the@sidebaralias that could go stale, and (b) waiting for at least one version entry to render before returning.Test plan
NOCOVERAGE=1 ./autotest.sh sqlite tests/lib/Files/Cache/CacheTest.php—testExtendedpassesNOCOVERAGE=1 ./autotest.sh sqlite tests/lib/Files/ViewTest.php— alltestCopyBetweenStorage*passfiles-renaming.cy.tsandfiles_versions/version_deletion.cy.ts— no stale DOM errors on repeated runsfiles-renaming,version_deletion,live_photosspecs and PHPUnit MySQL/MariaDB matrix🤖 Generated with Claude Code