fix(e2e): scope toast selector to avoid strict mode violation
The cart toast was matching 3 elements (react-hot-toast renders both a wrapper and a role="status" div). Narrowed to the role="status" element with aria-live attribute. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bf0f044f08
commit
ee6c839ecd
1 changed files with 2 additions and 5 deletions
|
|
@ -158,11 +158,8 @@ test.describe('MARKETPLACE — Cart (in-page)', () => {
|
||||||
await addToCartBtn.click();
|
await addToCartBtn.click();
|
||||||
await page.waitForTimeout(1_000);
|
await page.waitForTimeout(1_000);
|
||||||
|
|
||||||
// react-hot-toast renders with [role="status"] + .go-* classes, not toast-alert testid
|
// react-hot-toast renders with role="status" aria-live="polite" + text "added to cart"
|
||||||
const toast = page.getByTestId('toast-alert').first()
|
const toast = page.locator('[role="status"][aria-live]').filter({ hasText: /added to cart/i }).first();
|
||||||
.or(page.locator('[role="status"]').filter({ hasText: /added to cart|ajouté/i }).first())
|
|
||||||
.or(page.locator('.go2072408551, [class*="react-hot-toast"]').first())
|
|
||||||
.or(page.locator('div').filter({ hasText: /added to cart/i }).first());
|
|
||||||
await expect(toast).toBeVisible();
|
await expect(toast).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue