|
|
|
|
@ -15,11 +15,27 @@ export const getActionsForFile = (filename: string) => getRowForFile(filename).f
|
|
|
|
|
export const getActionButtonForFileId = (fileid: number) => getActionsForFileId(fileid).findByRole('button', { name: 'Actions' })
|
|
|
|
|
export const getActionButtonForFile = (filename: string) => getActionsForFile(filename).findByRole('button', { name: 'Actions' })
|
|
|
|
|
|
|
|
|
|
export const getActionEntryForFileId = (fileid: number, actionId: string) => {
|
|
|
|
|
return getRowForFileId(fileid).find(`[data-cy-files-list-row-action="${CSS.escape(actionId)}"]`)
|
|
|
|
|
const searchForActionInRow = (row: JQuery<HTMLElement>, actionId: string): Cypress.Chainable<JQuery<HTMLElement>> => {
|
|
|
|
|
const action = row.find(`[data-cy-files-list-row-action="${CSS.escape(actionId)}"]`)
|
|
|
|
|
if (action.length > 0) {
|
|
|
|
|
cy.log('Found action in row')
|
|
|
|
|
return cy.wrap(action)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Else look in the action menu
|
|
|
|
|
const menuButtonId = row.find('button[aria-controls]').attr('aria-controls')
|
|
|
|
|
return cy.get(`#${menuButtonId} [data-cy-files-list-row-action="${CSS.escape(actionId)}"]`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getActionEntryForFileId = (fileid: number, actionId: string): Cypress.Chainable<JQuery<HTMLElement>> => {
|
|
|
|
|
// If we cannot find the action in the row, it might be in the action menu
|
|
|
|
|
return getRowForFileId(fileid).should('be.visible')
|
|
|
|
|
.then(row => searchForActionInRow(row, actionId))
|
|
|
|
|
}
|
|
|
|
|
export const getActionEntryForFile = (filename: string, actionId: string) => {
|
|
|
|
|
return getRowForFile(filename).find(`[data-cy-files-list-row-action="${CSS.escape(actionId)}"]`)
|
|
|
|
|
export const getActionEntryForFile = (filename: string, actionId: string): Cypress.Chainable<JQuery<HTMLElement>> => {
|
|
|
|
|
// If we cannot find the action in the row, it might be in the action menu
|
|
|
|
|
return getRowForFile(filename).should('be.visible')
|
|
|
|
|
.then(row => searchForActionInRow(row, actionId))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const triggerActionForFileId = (fileid: number, actionId: string) => {
|
|
|
|
|
|