Commit 7550c97
test(core): TRAC-281 replace flaky add-to-cart toast assertions in cart and coupon E2E tests
The add-to-cart success message renders as a Sonner toast that
auto-dismisses after ~4s, so asserting on it is inherently racy. The
existing `toPass` retry in `cart.spec.ts` was also logically broken:
the catch branch reloaded the page, which destroys client-side toast
state, so retries could never succeed once the first attempt missed
the toast.
Drop the toast assertion in both tests and wait on `networkidle`
after the add-to-cart click. The cart-page assertions on `/cart`
remain as the actual verification.
Additionally, rework the coupon-apply flake handling in
`coupon.spec.ts`. The previous catch/reload pattern only recovered if
the server had already applied the coupon (CATALYST-1685). When the
action silently failed, the reload alone could not bring the coupon
back. Replace it with a `toPass` retry that re-applies the coupon
from a clean reloaded state if the optimistic update reverts.
Refs TRAC-281
Refs CATALYST-1685
Co-Authored-By: Claude <noreply@anthropic.com>1 parent ea7dba2 commit 7550c97
2 files changed
Lines changed: 30 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
38 | 26 | | |
39 | 27 | | |
40 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 15 | | |
20 | | - | |
21 | 16 | | |
22 | 17 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
26 | 41 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
0 commit comments