Skip to content

Latest commit

 

History

History
113 lines (91 loc) · 3.38 KB

File metadata and controls

113 lines (91 loc) · 3.38 KB

BUG-001: Cart Loses Products When Using "Continue Shopping" Modal

Summary

When adding multiple products to cart using the "Continue Shopping" button, only the last product is retained. Previous products are lost.

Severity

HIGH - Critical cart functionality broken

Environment

Steps to Reproduce

  1. Navigate to Products page
  2. Add first product to cart (e.g., "Blue Top")
  3. Click "Continue Shopping" button in modal
  4. Wait 2 seconds for modal to close
  5. Add second product to cart (e.g., "Men Tshirt")
  6. Click "View Cart" button in modal
  7. Observe cart contents

Expected Result

Cart should contain both products:

  • Blue Top (quantity: 1)
  • Men Tshirt (quantity: 1)
  • Total items: 2

Actual Result

Cart contains only the last product:

  • Men Tshirt (quantity: 1)
  • Total items: 1

Evidence

Test Logs

INFO  Attempting to add products: ['Blue Top', 'Men Tshirt']
INFO  Clicked add to cart button for product 0
INFO  Product 0 added to cart successfully
INFO  Clicking Continue Shopping
INFO  Modal closed successfully
INFO  Ready for next action
INFO  Clicked add to cart button for product 1
INFO  Product 1 added to cart successfully
INFO  Clicking View Cart from modal
INFO  Navigating to cart page
INFO  Cart count after adding 2 products: 1  ← SHOULD BE 2 ❌

Screenshot

reports/screenshots/test_remove_product_from_cart_[timestamp].png

Root Cause Analysis

Backend session/cookie management bug.

The site's cart implementation appears to:

  1. Store cart in session/cookies
  2. When "Continue Shopping" is clicked, session is NOT properly maintained
  3. Second add-to-cart AJAX call overwrites entire cart instead of appending to it

Attempted Fixes (All Failed)

  • ✅ Added 1.5s wait after add-to-cart
  • ✅ Added 2s wait after Continue Shopping
  • ✅ Used JavaScript click
  • ✅ Used hover + normal click
  • ✅ Waited for modal to appear
  • ✅ Waited for modal to disappear
  • None resolve the issue - this is a backend bug

Impact

  • Users: Cannot add multiple products from product list page
  • Business: Potential revenue loss (users must navigate to detail pages)
  • Testing: Blocks automated cart operations tests

Workaround

For Users

Add products from individual product detail pages, not from list page.

For Tests

# ❌ DOESN'T WORK:
products.add_product_to_cart(0)
products.click_continue_shopping()
products.add_product_to_cart(1)  # First product lost

# ✅ WORKS:
products.click_view_product(0)
detail = ProductDetailPage(driver)
detail.add_to_cart()
# Navigate to cart, then back to products, repeat

Status

  • Reported: 2026-01-07
  • Reporter: QA Automation Engineer
  • Status: OPEN
  • Priority: HIGH
  • Reproducibility: 100% (reproduced across 15+ test runs)

Affected Tests

  • tests/test_cart_operations.py::TestCartOperations::test_remove_product_from_cart
  • tests/test_product_features.py::TestProductFeatures::test_add_products_to_cart

Both tests marked with @pytest.mark.xfail until bug is resolved.

Next Steps

  1. Report to automationexercise.com development team
  2. Consider migrating to more stable test site (e.g., SauceDemo)
  3. Implement workaround tests using product detail page approach