@@ -24,7 +24,9 @@ export const getActionButtonForFile = (filename: string) => getActionsForFile(fi
2424export function getActionEntryForFileId ( fileid : number , actionId : string ) {
2525 return getActionButtonForFileId ( fileid )
2626 . should ( 'have.attr' , 'aria-controls' )
27- . then ( ( menuId ) => cy . get ( `#${ menuId } ` ) . find ( `[data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` ) )
27+ . then ( ( menuId ) => cy . get ( `#${ menuId } ` )
28+ . should ( 'exist' )
29+ . find ( `[data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` ) )
2830}
2931
3032/**
@@ -33,12 +35,11 @@ export function getActionEntryForFileId(fileid: number, actionId: string) {
3335 * @param actionId
3436 */
3537export function getActionEntryForFile ( file : string , actionId : string ) {
36- getActionButtonForFile ( file )
37- . if ( 'not.have.attr' , 'aria-expanded' , 'true' )
38- . click ( { force : true } )
39-
40- return cy . findByRole ( 'menu' )
41- . find ( `[data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` )
38+ return getActionButtonForFile ( file )
39+ . should ( 'have.attr' , 'aria-controls' )
40+ . then ( ( menuId ) => cy . get ( `#${ menuId } ` )
41+ . should ( 'exist' )
42+ . find ( `[data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` ) )
4243}
4344
4445/**
@@ -68,9 +69,8 @@ export function getInlineActionEntryForFile(file: string, actionId: string) {
6869 */
6970export function triggerActionForFileId ( fileid : number , actionId : string ) {
7071 getActionButtonForFileId ( fileid )
71- . as ( 'actionButton' )
7272 . scrollIntoView ( )
73- cy . get ( '@actionButton' )
73+ getActionButtonForFileId ( fileid )
7474 . click ( { force : true } ) // force to avoid issues with overlaying file list header
7575 getActionEntryForFileId ( fileid , actionId )
7676 . find ( 'button' )
@@ -85,8 +85,9 @@ export function triggerActionForFileId(fileid: number, actionId: string) {
8585 */
8686export function triggerActionForFile ( filename : string , actionId : string ) {
8787 getActionButtonForFile ( filename )
88- . should ( 'have.attr' , 'aria-expanded' , 'false' )
89- . click ( { force : true , scrollBehavior : 'nearest' } ) // force to avoid issues with overlaying file list header
88+ . scrollIntoView ( )
89+ getActionButtonForFile ( filename )
90+ . click ( { force : true } ) // force to avoid issues with overlaying file list header
9091 getActionEntryForFile ( filename , actionId )
9192 . find ( 'button' )
9293 . should ( 'be.visible' )
@@ -286,11 +287,17 @@ export function navigateToFolder(dirPath: string) {
286287 */
287288export function closeSidebar ( ) {
288289 // {force: true} as it might be hidden behind toasts
289- cy . get ( '[data-cy-sidebar] .app-sidebar__close' ) . click ( { force : true } )
290+ cy . get ( '[data-cy-sidebar] .app-sidebar__close' )
291+ . click ( { force : true } )
290292 cy . get ( '[data-cy-sidebar]' )
291293 . should ( 'not.be.visible' )
292294 // eslint-disable-next-line cypress/no-unnecessary-waiting -- wait for the animation to finish
293- cy . wait ( 300 )
295+ cy . wait ( 500 )
296+ // close all toasts
297+ cy . get ( '.toast-success' )
298+ . if ( )
299+ . findAllByRole ( 'button' )
300+ . click ( { force : true , multiple : true } )
294301}
295302
296303/**
0 commit comments