All learning modules

Playwright Test Automation Lab

Reliable automation is test design plus code.

The fastest way to create a brittle suite is to automate clicks without thinking about intent, observability, state and failure diagnosis. These exercises focus on the choices that make Playwright tests useful in CI.

Learn by making an engineering decision, then inspect the reasoning.

// The goal is not this:

click → sleep → click → sleep → expect(true)

// The goal is observable, deterministic evidence of business behaviour.

1

Choose the most resilient locator

You need to click the Save button. The DOM contains a generated CSS class, visible text "Save", and an accessible role/name.

2

Wait for behaviour, not time

After Submit, an API call completes and a success banner appears. The test is flaky in CI.

3

What should an assertion prove?

A checkout test clicks Pay and only checks that the button disappears.

4

When should you use API setup?

Every UI test spends 40 seconds navigating screens just to create prerequisite data before testing a small account setting.

Current score

0 / 4