Playwright

Log in with a mobile number and an SMS OTP

Medium50 pts~2 min
  • OTP flows
  • Explicit waits
  • Negative testing
  • Reading dynamic text
Practice app · FlipMart

An Indian electronics megastore: mobile-number + OTP login with an on-page SMS, an Electronics hover mega-menu, search autocomplete, listings with a price slider, brand filters, sort tabs and infinite scroll, a 3-product compare table, product pages with offers, pincode checks and rating breakdowns, a flash sale countdown, a login-gated wishlist, and a cart with UPI, card and Cash on Delivery checkout.

Test URL
/lab/playwright-flipmart-otp-login

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

Objective

Log in to FlipMart with a mobile number and a one-time password. Read the OTP from the on-page SMS, prove that a wrong OTP is rejected, then verify the correct one and assert that the header greets Rohan.

Your task

  1. 1Open TEST_URL and click Login (#login-button).
  2. 2Type 9876543210 in #login-mobile and click Request OTP (#request-otp).
  3. 3Wait for the SMS notification (#sms-notification) to arrive and read the 6-digit code from #sms-otp.
  4. 4Type the wrong OTP 111111 in #otp-input, click Verify (#verify-otp) and assert that #otp-error says the OTP is incorrect.
  5. 5Replace it with the code from the SMS, click Verify again and assert that #account-name in the header reads “Rohan”.

Acceptance criteria

  • A wrong OTP shows the “Incorrect OTP” error.
  • The correct OTP signs the customer in and the header shows “Rohan”.
  • The browser ends on the FlipMart home page.
  • The test makes at least two assertions.

Fixtures

Mobile number
9876543210
OTP
482913 (also shown in the on-page SMS)
Account name
Rohan Mehta
UPI ID
rohan@fmupi
Saved address
221B, 12th Main Road, Indiranagar, Bengaluru - 560038
Pincodes
560001 / 560038 Bengaluru · 110001 New Delhi · 400001 Mumbai · 600001 Chennai · 700001 Kolkata · 500001 Hyderabad
Today
Tuesday, 10 November 2026

Playwright · Playwright Challenges · FlipMart