Skip to the editor

The cart makes four promises

State across pages · level 2 of 5 · Terra Supply

Most tests check the one thing the author was thinking about. A cart makes several promises at once, and a test that checks one of them stays green while the other three break.

The problem

Add the Trail Runner Backpack to the cart in Terra Supply, change the quantity, then remove it.

Your test must prove all four of these:

  1. The cart badge counts the item.
  2. The confirmation message appears.
  3. The subtotal multiplies by the quantity.
  4. Removing the item really removes it.

Each one is a separate promise the app makes to the shopper. This problem plants four bugs, one per promise. A test that checks only the first two passes, and ships the other two to production.

Done when

  • The cart badge shows 1 after the item is added.
  • A confirmation message tells the shopper the item was added.
  • With a quantity of 2, the subtotal is twice the price.
  • Removing the item leaves the cart empty.

Bugs we plant

  • Cart badge always shows 0
  • No "added to cart" confirmation appears
  • Subtotal ignores quantity (charges for one)
  • Removing a cart item does nothing

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

Loading the editor…