File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
WorkspacePage/WorkspaceActions Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,18 @@ const renderPage = async () => {
47
47
const removeMember = async ( ) => {
48
48
const user = userEvent . setup ( ) ;
49
49
// Click on the "Open menu" button to display the "Remove" option
50
- const menuButtons = await screen . findAllByLabelText ( " Open menu") ;
50
+ const menuButtons = await screen . findAllByRole ( "button" , { name : " Open menu" } ) ;
51
51
// get MockUser2
52
52
const selectedMenuButton = menuButtons [ 0 ] ;
53
53
54
54
await user . click ( selectedMenuButton ) ;
55
55
56
- const removeButton = await within ( document . body ) . findByText ( "Remove…" ) ;
56
+ // Wait for the dropdown menu to be visible and find the remove button
57
+ const menuItems = await screen . findAllByRole ( "menuitem" ) ;
58
+ const removeButton = menuItems . find ( item => item . textContent === "Remove" ) ;
59
+ if ( ! removeButton ) {
60
+ throw new Error ( "Remove button not found" ) ;
61
+ }
57
62
await user . click ( removeButton ) ;
58
63
59
64
const dialog = await within ( document . body ) . findByRole ( "dialog" ) ;
Original file line number Diff line number Diff line change @@ -202,9 +202,9 @@ export const OpenDownloadLogs: Story = {
202
202
} ,
203
203
play : async ( { canvasElement } ) => {
204
204
const canvas = within ( canvasElement ) ;
205
- await userEvent . click ( canvas . getByRole ( "button" , { name : "More options" } ) ) ;
206
- await userEvent . click ( canvas . getByText ( "Download logs" , { exact : false } ) ) ;
205
+ await userEvent . click ( canvas . getByRole ( "button" , { name : "Workspace actions" } ) ) ;
207
206
const screen = within ( document . body ) ;
207
+ await userEvent . click ( screen . getByText ( "Download logs…" ) ) ;
208
208
await expect ( screen . getByTestId ( "dialog" ) ) . toBeInTheDocument ( ) ;
209
209
} ,
210
210
} ;
@@ -215,8 +215,9 @@ export const CanDeleteDormantWorkspace: Story = {
215
215
} ,
216
216
play : async ( { canvasElement } ) => {
217
217
const canvas = within ( canvasElement ) ;
218
- await userEvent . click ( canvas . getByRole ( "button" , { name : "More options" } ) ) ;
219
- const deleteButton = canvas . getByText ( "Delete…" ) ;
218
+ await userEvent . click ( canvas . getByRole ( "button" , { name : "Workspace actions" } ) ) ;
219
+ const screen = within ( document . body ) ;
220
+ const deleteButton = screen . getByText ( "Delete…" ) ;
220
221
await expect ( deleteButton ) . toBeEnabled ( ) ;
221
222
} ,
222
223
} ;
Original file line number Diff line number Diff line change @@ -182,13 +182,13 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
182
182
< Button
183
183
size = "icon-lg"
184
184
variant = "subtle"
185
- aria-label = "More options "
185
+ aria-label = "Workspace actions "
186
186
data-testid = "workspace-options-button"
187
187
aria-controls = "workspace-options"
188
188
disabled = { ! canAcceptJobs }
189
189
>
190
190
< EllipsisVertical aria-hidden = "true" />
191
- < span className = "sr-only" > More options </ span >
191
+ < span className = "sr-only" > Workspace actions </ span >
192
192
</ Button >
193
193
</ DropdownMenuTrigger >
194
194
You can’t perform that action at this time.
0 commit comments