Playwright

Handle the switch-restaurant confirm dialog

Medium55 pts~2 min
  • Native confirm
  • Accept vs dismiss
  • State after dialogs
Practice app · FoodRush

A food-delivery app: set your delivery area through a native prompt, filter restaurants by veg-only, cuisine and search, sort them, customise dishes in a modal, manage a cart with a coupon, check out and follow a live order tracker before rating the meal.

Test URL
/lab/playwright-foodrush-switch-restaurant-confirm

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Your cart holds items from Dosa Darbar. Adding a dish from Biryani Baithak opens a native confirm dialog. Cancel it once and check the cart is kept, then add again, accept, and verify a new cart was started.

Your task

  1. 1Open TEST_URL and open Biryani Baithak ([data-restaurant-id="biryani-baithak"]).
  2. 2Click “Add Chicken 65”. A confirm dialog asks “Your cart has items from Dosa Darbar. Discard them and add from Biryani Baithak?”. Dismiss (cancel) it.
  3. 3Assert #cart-notice reads “Kept your cart from Dosa Darbar” and #cart-count still shows 4.
  4. 4Click “Add Chicken 65” again and accept the confirm dialog.
  5. 5Assert #cart-notice reads “Started a new cart from Biryani Baithak”, #cart-bar-restaurant names Biryani Baithak and the cart holds 1 item.

Acceptance criteria

  • The dismissed dialog kept the Dosa Darbar cart.
  • The accepted dialog replaced it with a Biryani Baithak cart of 1 item.
  • The test explicitly dismisses and accepts the dialog and makes at least two assertions.

Fixtures

Delivery area
Any area name, e.g. Indiranagar
Coupon
FEAST50 (₹50 off item totals of ₹299 and above)
Delivery fee
₹40 per order
Taxes
5% GST & restaurant charges on the item total, rounded to the nearest rupee
Seeded cart
Dosa Darbar: Masala Dosa ×1 (₹120), Filter Coffee ×2 (₹60), Medu Vada ×1 (₹80)
Checkout details
Asha Verma · 9876543210 · 12, 4th Cross
Tracking
Order placed → Preparing → Out for delivery → Delivered, about 1.5 s per step

Playwright · Playwright Challenges · FoodRush