@@ -42,17 +42,17 @@ test(`file drop event should not propagate to dialog parent`, async ({
42
42
43
43
// Open the dialog.
44
44
await page . getByRole ( 'button' , { name : fileName } ) . click ( )
45
- await expect ( page . locator ( '#tree-editing- dialog') ) . toBeVisible ( )
45
+ await expect ( page . getByRole ( ' dialog') ) . toBeVisible ( )
46
46
47
47
// Drop the file again; this time, while the dialog is open.
48
48
//
49
49
// - The drop event should not propagate to the parent.
50
50
// - Therefore, the drop event should not cause the image to be added to the list again.
51
- await page . locator ( '#tree-editing- dialog') . dispatchEvent ( 'drop' , { dataTransfer} )
51
+ await page . getByRole ( ' dialog') . dispatchEvent ( 'drop' , { dataTransfer} )
52
52
53
53
// Close the dialog.
54
- await page . getByTestId ( 'tree-editing-done' ) . click ( )
55
- await expect ( await page . locator ( '#tree-editing- dialog') ) . not . toBeVisible ( )
54
+ await page . keyboard . press ( 'Escape' )
55
+ await expect ( page . getByRole ( ' dialog') ) . not . toBeVisible ( )
56
56
57
57
// Ensure the list still contains one item.
58
58
expect ( item ) . toHaveCount ( 1 )
@@ -93,8 +93,9 @@ test(`Scenario: Adding a new type from multiple options`, async ({page, createDr
93
93
await expect ( titleInput ) . toHaveValue ( 'Book title' )
94
94
95
95
// And the dialog is closed
96
- await page . keyboard . press ( 'Escape' )
97
- await expect ( await insertDialog ) . not . toBeVisible ( )
96
+ const closeDialogButton = insertDialog . getByLabel ( 'Close dialog' )
97
+ await closeDialogButton . click ( )
98
+ await expect ( insertDialog ) . not . toBeVisible ( )
98
99
99
100
// Then a new item is inserted in the array
100
101
const bookItem = field . getByText ( 'Book title' )
@@ -217,9 +218,9 @@ function createArrayFieldLocators(page: Page) {
217
218
const popover = page . getByTestId ( 'document-panel-portal' )
218
219
const popoverMenu = popover . getByRole ( 'menu' )
219
220
const popoverMenuItem = ( name : string ) => popoverMenu . getByRole ( 'menuitem' , { name} )
220
- const insertDialog = page . locator ( '#tree-editing- dialog')
221
+ const insertDialog = page . getByRole ( ' dialog')
221
222
const input = ( label : string ) => insertDialog . getByLabel ( label )
222
- const closeDialogButton = page . getByTestId ( 'tree-editing-done ')
223
+ const closeDialogButton = insertDialog . getByLabel ( 'Close dialog ')
223
224
224
225
return {
225
226
items,
0 commit comments