Skip to content

Commit 62508ca

Browse files
authored
test: fix flaky toast assertions in draft validation tests (#14615)
### What? The test "should keep save draft button enabled after validation failure on update" was intermittently failing in CI with: ``` Error: strict mode violation: locator('.payload-toast-container .toast-error') resolved to 2 elements ``` This occurred because the test clicks the save draft button twice in quick succession to verify it remains enabled after validation failures. In slower CI environments, both error toasts were visible simultaneously, causing Playwright's strict mode to fail.
1 parent 89ab526 commit 62508ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/field-error-states/e2e.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ describe('Field Error States', () => {
111111
await page.locator('#field-validatedField').fill('This will fail')
112112

113113
await page.click('#action-save-draft')
114-
await expect(page.locator('.payload-toast-container .toast-error')).toBeVisible()
114+
const errorToast = page.locator('.payload-toast-container .toast-error').first()
115+
await expect(errorToast).toBeVisible()
116+
await errorToast.locator('button[aria-label="Close toast"]').click()
115117

116118
const saveDraftButton = page.locator('#action-save-draft')
117119
await expect(saveDraftButton).toBeEnabled()

0 commit comments

Comments
 (0)