Skip to content

Commit 9bd5123

Browse files
authored
test: trash auth e2e tests have race condition on navigation (#15468)
### What Two trash e2e tests for auth-enabled collections are flaky in CI: "`Should properly disable auth fields in the trashed user edit view`" and "`Should properly restore trashed user as draft`" ### Why Race condition: both tests click a table row to navigate but don't wait for navigation to complete before asserting on page elements. CI environments can be slower, causing elements to not exist yet when the assertions run. ### How Added `await expect(page).toHaveURL(/\/users\/trash\/[a-f0-9]{24}$/)` after row clicks to wait for navigation to complete before checking for elements.
1 parent 731037e commit 9bd5123

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/trash/e2e.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,8 @@ describe('Trash', () => {
11011101

11021102
await page.locator('.row-1 .cell-name').click()
11031103

1104+
await expect(page).toHaveURL(/\/users\/trash\/[a-f0-9]{24}$/)
1105+
11041106
await expect(page.locator('input[name="email"]')).toBeDisabled()
11051107
await expect(page.locator('#change-password')).toBeDisabled()
11061108

@@ -1116,6 +1118,8 @@ describe('Trash', () => {
11161118
await expect(page.locator('.row-1 .cell-name')).toHaveText('Dev')
11171119
await page.locator('.row-1 .cell-name').click()
11181120

1121+
await expect(page).toHaveURL(/\/users\/trash\/[a-f0-9]{24}$/)
1122+
11191123
await page.locator('.doc-controls__controls #action-restore').click()
11201124

11211125
await expect(page.locator(`#restore-${devUserID} #confirm-action`)).toBeVisible()

0 commit comments

Comments
 (0)