Merge pull request #60303 from nextcloud/backport/60298/stable32

[stable32] test(cypress): Reduce flakiness
This commit is contained in:
Peter R. 2026-05-13 15:16:06 +02:00 committed by GitHub
commit eba767ee3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View file

@ -9,8 +9,10 @@ import { ACTION_COPY_MOVE } from '../../../apps/files/src/actions/moveOrCopyActi
export const getRowForFileId = (fileid: number) => cy.get(`[data-cy-files-list-row-fileid="${fileid}"]`)
export const getRowForFile = (filename: string) => cy.get(`[data-cy-files-list-row-name="${CSS.escape(filename)}"]`)
export const getActionsForFileId = (fileid: number) => getRowForFileId(fileid).find('[data-cy-files-list-row-actions]')
export const getActionsForFile = (filename: string) => getRowForFile(filename).find('[data-cy-files-list-row-actions]')
// Atomic query so the lookup is retried as a whole when rows re-render
// (chained .find() can fail with "subject no longer attached" mid-render).
export const getActionsForFileId = (fileid: number) => cy.get(`[data-cy-files-list-row-fileid="${fileid}"] [data-cy-files-list-row-actions]`)
export const getActionsForFile = (filename: string) => cy.get(`[data-cy-files-list-row-name="${CSS.escape(filename)}"] [data-cy-files-list-row-actions]`)
export const getActionButtonForFileId = (fileid: number) => getActionsForFileId(fileid).findByRole('button', { name: 'Actions' })
export const getActionButtonForFile = (filename: string) => getActionsForFile(filename).findByRole('button', { name: 'Actions' })

View file

@ -4,7 +4,7 @@
*/
import type { User } from '@nextcloud/cypress'
import { createShare } from './FilesSharingUtils.ts'
import { closeSidebar, enableGridMode, getActionButtonForFile, getInlineActionEntryForFile, getRowForFile } from '../files/FilesUtils.ts'
import { closeSidebar, enableGridMode, getActionButtonForFile, getActionsForFile, getInlineActionEntryForFile, getRowForFile } from '../files/FilesUtils.ts'
describe('files_sharing: Sharing status action', { testIsolation: true }, () => {
/**
@ -22,9 +22,8 @@ describe('files_sharing: Sharing status action', { testIsolation: true }, () =>
cy.visit('/apps/files')
getRowForFile('folder')
.should('be.visible')
.find('[data-cy-files-list-row-actions]')
getRowForFile('folder').should('be.visible')
getActionsForFile('folder')
.findByRole('button', { name: 'Shared' })
.should('not.exist')
})
@ -37,12 +36,11 @@ describe('files_sharing: Sharing status action', { testIsolation: true }, () =>
cy.visit('/apps/files')
})
getRowForFile('folder')
.should('be.visible')
.find('[data-cy-files-list-row-actions]')
getRowForFile('folder').should('be.visible')
getActionsForFile('folder')
.findByRole('button', { name: /Sharing options/ })
.should('be.visible')
.click()
.click({ force: true })
// check the click opened the sidebar
cy.get('[data-cy-sidebar]')