ShopKart Cart 0

Practice tasks

Work through these in order. Every control on this app has a stable id and a data-testid, so your locators will not break between visits.

1. Search and filter

  1. Search for mouse and assert the result count text matches the number of product cards.
  2. Search for something that does not exist and assert the empty-state message appears.
  3. Tick Electronics and assert every visible card shows that category.
  4. Drag the price slider to 2000 and assert no card shows a price above it.
  5. Tick In stock only and assert no card shows "Out of stock".
  6. Combine two filters, then click Clear all filters and assert all 18 products are back.

2. Sorting and paging

  1. Sort by Price: low to high and assert the prices are in ascending order.
  2. Sort by Customer rating and assert the first card has the highest rating.
  3. Go to page 2 and assert the cards are different from page 1.
  4. Apply a filter and assert the pager resets to page 1.

3. Product page

  1. Open a product and assert the name, price and rating match the card you clicked.
  2. Assert the discount percentage equals (MRP - price) / MRP, rounded.
  3. Open an out-of-stock product and assert Add to cart is disabled.
  4. Set the quantity above the stock and assert the error message.
  5. Check a pincode: 636001 is serviceable, 999999 is not.
  6. Switch to the Reviews tab, submit a review without a rating, and assert the validation message.

4. Cart

  1. Add two different products and assert the cart badge shows 2.
  2. Add the same product twice and assert the quantity becomes 2, not two rows.
  3. Change a quantity and assert the row subtotal and the order total both update.
  4. Remove a row and assert it disappears and the total drops.
  5. Apply SAVE10 on a cart above 1000 and assert a 10% discount.
  6. Apply SAVE10 on a cart below 1000 and assert it is rejected.
  7. Apply EXPIRED5 and assert the expiry message.
  8. Clear the cart and assert the empty state and a badge of 0.

5. Checkout

  1. Submit the empty form and assert every required field is listed.
  2. Enter a 5-digit mobile number and assert the "exactly 10 digits" message.
  3. Enter an email without an @ and assert the email message.
  4. Select Card and assert the card fields appear; select UPI and assert they are replaced.
  5. Leave the terms unticked and assert the order is not placed.
  6. Place a valid order and assert you land on the confirmation page with an order ID in the format SK-XXXXXX.
  7. Assert the cart badge resets to 0 after the order.

6. Orders, login and register

  1. Open My Orders and assert the order you just placed is listed with the right total.
  2. Filter by status and assert only matching orders remain.
  3. Search by order ID and assert exactly one order is shown.
  4. Log in with qa.tester / Passw0rd! and assert the welcome message.
  5. Log in with a wrong password and assert the error message.
  6. Register with a weak password and assert the strength meter and the validation.
  7. Register with mismatched passwords and assert the message.

Where the data lives

The cart, the orders and the session are kept in your browser's localStorage under the keys sk_cart, sk_orders and sk_session. Clearing site data resets the app, which is a clean way to start each test run:

// Selenium
((JavascriptExecutor) driver).executeScript("window.localStorage.clear()");

// Playwright
await page.evaluate(() => localStorage.clear());