Skip to content

Commit 4dcaec1

Browse files
chanceaclarkclaude
andcommitted
test(core): remove flaky toast assertion in shipping addProductAndGoToCart helper
Apply the same fix as cart and coupon tests: the add-to-cart success toast auto-dismisses after ~4s, so asserting on it is racy and made the shipping tests time out before reaching the cart page assertions. Wait for networkidle instead. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 330a19f commit 4dcaec1

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

core/tests/ui/e2e/shipping.spec.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@ async function addProductAndGoToCart(page: Page, catalog: CatalogFixture) {
1010

1111
await page.goto(product.path);
1212
await page.getByRole('button', { name: t('Product.ProductDetails.Submit.addToCart') }).click();
13-
14-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
15-
const addToCartSuccessMessage = t.rich('Product.ProductDetails.successMessage', {
16-
cartItems: 1,
17-
cartLink: (chunks: React.ReactNode) => chunks,
18-
}) as string;
19-
20-
await expect(page.getByText(addToCartSuccessMessage)).toBeVisible();
13+
// The success toast auto-dismisses after ~4s, so asserting on it is racy.
14+
// Wait for the add-to-cart action to settle and verify state via the /cart page instead.
15+
await page.waitForLoadState('networkidle');
2116

2217
await page.goto('/cart');
2318
await expect(page.getByRole('heading', { name: t('Cart.title') })).toBeVisible();

0 commit comments

Comments
 (0)