Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cypress/e2e/files/FilesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
Expand Down
14 changes: 6 additions & 8 deletions cypress/e2e/files_sharing/share-status-action.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }, () => {
/**
Expand All @@ -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')
})
Expand All @@ -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]')
Expand Down
Loading