From ee6c839ecd4287ba7e38defe5ae2a32e17b6add3 Mon Sep 17 00:00:00 2001 From: senke Date: Sun, 5 Apr 2026 18:01:06 +0200 Subject: [PATCH] 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) --- tests/e2e/08-marketplace.spec.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/e2e/08-marketplace.spec.ts b/tests/e2e/08-marketplace.spec.ts index 9f38f911d..3080e418e 100644 --- a/tests/e2e/08-marketplace.spec.ts +++ b/tests/e2e/08-marketplace.spec.ts @@ -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(); }); });