Playwright

Turn on the pure-veg switch

Easy25 pts~2 min
  • ARIA switch
  • aria-checked
  • Counting elements
  • Data attributes
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-veg-only-switch

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

Objective

Switch the restaurant listing to pure-veg restaurants only and verify that exactly 7 veg restaurants remain.

Your task

  1. 1Open TEST_URL and find the “Pure veg only” switch (#veg-only, role=switch).
  2. 2Click the switch to turn it on.
  3. 3Assert that its aria-checked attribute is now “true”.
  4. 4Assert #result-count starts with “7 restaurants” and that every [data-testid="restaurant-card"] has data-veg="true".

Acceptance criteria

  • The switch reports aria-checked="true".
  • Exactly 7 restaurant cards are shown.
  • No non-veg restaurant is listed.
  • The test 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