PAPracticeAutomation
Pw

TypeScript ยท @playwright/test

Playwright

Microsoft's modern end-to-end framework. Auto-waiting locators, web-first assertions, multiple tabs and browser contexts, network mocking and a trace viewer โ€” across Chromium, Firefox and WebKit.

getByTestId / getByRole locatorsAuto-wait & web-first assertionsMulti-tab, frames & dialogsTrace viewer & codegen

Pick a practice track

Two complete apps to automate end to end, plus focused element-handling recipes โ€” all in Playwright.

๐Ÿ›๏ธNova Shop

E-commerce app

Login with test users, search/filter/sort products, cart & coupons, a validated checkout, a declined card and order history.

  • โœ“3 test accounts incl. locked & slow
  • โœ“Cart maths, coupons, tax & shipping
  • โœ“Form validation + payment failure
๐ŸŽฌShowTime

Ticket booking app

Pick city, date and showtime, select seats on a live seat map, add snacks, apply promos and pay with an OTP step under a hold timer.

  • โœ“Seat map with tiers & limits
  • โœ“Countdown timer & clock mocking
  • โœ“OTP modal, async UPI, cancellations
๐Ÿงฉ50+ challenges

Elements handling

Focused recipes for inputs, dropdowns, tables, alerts, frames, windows, drag & drop, uploads, hover, waits, shadow DOM and keys.

  • โœ“15 copy-ready recipes
  • โœ“Each linked to a live challenge
  • โœ“Tool-specific gotchas called out

1. Set up

Run this site locally with npm run dev โ€” examples target http://localhost:3000.

Terminal
npm init playwright@latest

# playwright.config.ts
#   use: { baseURL: 'http://localhost:3000' }

2. Your first test

Sign in to Nova Shop and assert the product grid loaded.

first.spec.ts
import { test, expect } from '@playwright/test';

test('demo_user can sign in', async ({ page }) => {
  await page.goto('/shop');
  await page.getByTestId('username').fill('demo_user');
  await page.getByTestId('password').fill('Demo@123');
  await page.getByTestId('login-button').click();

  await expect(page).toHaveURL(/\/shop\/products/);
  await expect(page.getByTestId('product-card')).toHaveCount(12);
});

Official docs: https://playwright.dev/docs/intro

Practising another tool?