@@ -10,8 +10,10 @@ const ACTION_COPY_MOVE = 'move-copy'
1010export const getRowForFileId = ( fileid : string | number ) => cy . get ( `[data-cy-files-list-row-fileid="${ fileid } "]` )
1111export const getRowForFile = ( filename : string ) => cy . get ( `[data-cy-files-list-row-name="${ CSS . escape ( filename ) } "]` )
1212
13- export const getActionsForFileId = ( fileid : number ) => getRowForFileId ( fileid ) . find ( '[data-cy-files-list-row-actions]' )
14- export const getActionsForFile = ( filename : string ) => getRowForFile ( filename ) . find ( '[data-cy-files-list-row-actions]' )
13+ // Atomic query so the lookup is retried as a whole when rows re-render
14+ // (chained .find() can fail with "subject no longer attached" mid-render).
15+ export const getActionsForFileId = ( fileid : number ) => cy . get ( `[data-cy-files-list-row-fileid="${ fileid } "] [data-cy-files-list-row-actions]` )
16+ export const getActionsForFile = ( filename : string ) => cy . get ( `[data-cy-files-list-row-name="${ CSS . escape ( filename ) } "] [data-cy-files-list-row-actions]` )
1517
1618export const getActionButtonForFileId = ( fileid : number ) => getActionsForFileId ( fileid ) . findByRole ( 'button' , { name : 'Actions' } )
1719export const getActionButtonForFile = ( filename : string ) => getActionsForFile ( filename ) . findByRole ( 'button' , { name : 'Actions' } )
@@ -48,8 +50,7 @@ export function getActionEntryForFile(file: string, actionId: string) {
4850 * @param actionId
4951 */
5052export function getInlineActionEntryForFileId ( fileid : number , actionId : string ) {
51- return getActionsForFileId ( fileid )
52- . find ( `[data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` )
53+ return cy . get ( `[data-cy-files-list-row-fileid="${ fileid } "] [data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` )
5354}
5455
5556/**
@@ -58,8 +59,7 @@ export function getInlineActionEntryForFileId(fileid: number, actionId: string)
5859 * @param actionId
5960 */
6061export function getInlineActionEntryForFile ( file : string , actionId : string ) {
61- return getActionsForFile ( file )
62- . find ( `[data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` )
62+ return cy . get ( `[data-cy-files-list-row-name="${ CSS . escape ( file ) } "] [data-cy-files-list-row-action="${ CSS . escape ( actionId ) } "]` )
6363}
6464
6565/**
0 commit comments