Bug hunt · Intermediate
Find the 8 bugs in this shopping cart
Most cart bugs hide in the numbers. Check every total against the rules with a calculator, try the boundaries, then compare your list with the answer key. No real payment happens here.
Business rules
- Prices in the cart match the product list.
- Quantity is 1 to 10 per item.
- Line total = price × quantity.
- Coupon
SAVE10takes 10% off the subtotal, once per order. - HST of 13% is charged on the subtotal after the discount.
- Shipping is $5.99, and free when the subtotal after the discount is $50.00 or more.
- The cart badge shows the total number of items.
- An empty cart cannot be checked out.
Products
🛒 0- Wireless mouse$25.00
- USB-C cable$12.50
- Notebook$10.00
- Desk lamp$40.00
Your cart
| Product | Price | Qty | Total | Remove |
|---|
Your cart is empty.
- Subtotal
- $0.00
- Discount
- −$0.00
- HST (13%)
- $0.00
- Shipping
- $5.99
- Total
- $5.99
Answer key
Tip: write the expected totals in a spreadsheet first, then compare them with the screen.
Show the 8 planted bugs
- USB-C cable price changes in the cart. It is listed at $12.50 but charged at $12.05.
- Quantity accepts 0 and negative numbers. A quantity of -2 gives a negative line total and lowers the order total.
- Quantity accepts more than 10. Up to 99 is allowed, although the limit is 10 per item.
- Coupon can be applied again and again. Each click on Apply adds another 10% off.
- Tax is charged before the discount. HST is 13% of the subtotal, not of the subtotal after the discount.
- Free shipping misses exactly $50.00. Two mice ($50.00) still pay $5.99 shipping. The code checks "more than 50", not "50 or more".
- Cart badge counts products, not items. Three notebooks show a badge of 1 instead of 3.
- An empty cart can be checked out. Checkout with nothing in the cart places an order for the $5.99 shipping fee.
Want to automate these checks? Every element has a data-testid. Then try theautomation playground.