Playwright

Set the delivery area through a native prompt

Medium50 pts
  • Native prompt
  • Accept vs dismiss
  • Typing into a prompt
  • Assertions
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-location-prompt

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

Objective

FoodRush asks for your delivery area in a native browser prompt. Enter “Indiranagar” and accept it, then open the prompt again and dismiss it, and verify the header keeps the area and the page explains that the location did not change.

Your Task

  1. 1Open TEST_URL and click “Detect location” (#location-button).
  2. 2When the prompt “Enter your delivery area” opens, type Indiranagar and accept it.
  3. 3Assert #delivery-location reads “Delivering to Indiranagar” and the button now reads “Change location”.
  4. 4Click #location-button again and dismiss (cancel) the prompt.
  5. 5Assert #location-message reads “Location unchanged. Still delivering to Indiranagar.” and the header still shows Indiranagar.

Validation Checks

  • The header shows “Delivering to Indiranagar”.
  • The location button reads “Change location”.
  • #location-message confirms the location was left unchanged after the dismissed prompt.
  • No dialog is left open and 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

Cloud Execution & Grading Guide

This Medium Playwright Challenges exercise runs inside TargetQA's managed cloud sandbox using Playwright (TypeScript, JavaScript, Python, Java, C#). Every submission runs inside an isolated headless Chromium container with pre-synced drivers, capturing live console logs, DOM assertions, and a 720p step-by-step video replay.

  • Supported stacks: TypeScript (@playwright/test) · JavaScript (@playwright/test) · Python (Playwright + pytest) · Java (Playwright for Java + JUnit 5) · C# (Playwright for .NET + NUnit)
  • Zero local setup: Use the pre-declared TEST_URL variable so your script targets the live FoodRush sandbox reliably without hardcoding hosts.
  • Automated grading: Click Run to inspect step logs and behavior, then click Submit to validate all 4 acceptance checks and earn 50 points.

Playwright · Playwright Challenges Practice Track · FoodRush