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:
senke 2026-04-05 18:01:06 +02:00
parent bf0f044f08
commit ee6c839ecd

View file

@ -158,11 +158,8 @@ test.describe('MARKETPLACE — Cart (in-page)', () => {
await addToCartBtn.click();
await page.waitForTimeout(1_000);
// react-hot-toast renders with [role="status"] + .go-* classes, not toast-alert testid
const toast = page.getByTestId('toast-alert').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());
// react-hot-toast renders with role="status" aria-live="polite" + text "added to cart"
const toast = page.locator('[role="status"][aria-live]').filter({ hasText: /added to cart/i }).first();
await expect(toast).toBeVisible();
});
});