Skip to the editor

The cart badge lies

State across pages · level 2 of 5 · Terra Supply

One action usually has several observable effects. Assert every effect the user depends on, not just the convenient one.

The problem

Add a product to the cart in Terra Supply and prove both things the user relies on:

  1. The cart badge goes from 0 to 1.
  2. The confirmation toast appears.

These are two separate promises the app makes. A test that checks only one of them stays green while the other silently breaks.

Done when

  • The cart badge changes from 0 to 1 after an item is added.
  • The user sees a confirmation after the item is added.

Bugs we plant

  • Cart badge always shows 0
  • No "added to cart" confirmation appears

We break each one in a copy of the app. Your test has to fail on every copy.

Loading the editor…