@@ -68,12 +68,45 @@ export class FilesListPage {
6868 . click ( { force : true } )
6969 }
7070
71+ async selectRowForFile ( filename : string ) : Promise < void > {
72+ // The checkbox is visually hidden inside NcCheckboxRadioSwitch, so force the check
73+ await this . getRowForFile ( filename )
74+ . getByRole ( 'checkbox' , { name : / T o g g l e s e l e c t i o n / } )
75+ . check ( { force : true } )
76+ }
77+
78+ /**
79+ * The toolbar that replaces the list header once one or more rows are selected.
80+ */
81+ getSelectionActionsToolbar ( ) : Locator {
82+ return this . page . locator ( '[data-cy-files-list-selection-actions]' )
83+ }
84+
85+ private getSelectionActionsButton ( ) : Locator {
86+ return this . getSelectionActionsToolbar ( ) . getByRole ( 'button' , { name : 'Actions' } )
87+ }
88+
89+ /**
90+ * Open the bulk-selection actions menu. Pair with {@link getSelectionActionEntry}
91+ * to inspect an entry (e.g. assert it is visible) before acting; for a plain
92+ * "open and click" use {@link triggerSelectionAction}.
93+ */
94+ async openSelectionActionsMenu ( ) : Promise < void > {
95+ await this . getSelectionActionsButton ( ) . click ( { force : true } )
96+ }
97+
98+ /**
99+ * A selection action entry. Matched at page level on the product-owned
100+ * attribute because selection actions can render inline or inside the menu popover.
101+ */
102+ getSelectionActionEntry ( actionId : string ) : Locator {
103+ return this . page . locator ( `[data-cy-files-list-selection-action="${ actionId } "]` )
104+ }
105+
71106 async triggerSelectionAction ( actionId : string ) : Promise < void > {
72- const actionsButton = this . page . locator ( '[data-cy-files-list-selection-actions]' )
73- . getByRole ( 'button' , { name : 'Actions' } )
74- await actionsButton . click ( { force : true } )
107+ await this . openSelectionActionsMenu ( )
75108 // NcActionButton renders as <li data-cy-...><button role="menuitem">
76- const actionButton = this . page . locator ( `[data-cy-files-list-selection-action=" ${ actionId } "] button` )
109+ const actionButton = this . getSelectionActionEntry ( actionId ) . locator ( ' button' )
77110 await actionButton . waitFor ( { state : 'visible' } )
78111 await actionButton . click ( )
79112 }
0 commit comments