mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
chore(ci): Make row action helpers atomic to avoid mid-render detachment
-e Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
This commit is contained in:
parent
70522c2d3d
commit
beee7427c5
2 changed files with 9 additions and 9 deletions
|
|
@ -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' })
|
||||
|
|
|
|||
|
|
@ -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]')
|
||||
|
|
|
|||
Loading…
Reference in a new issue