Playwright
Write browser tests that click, type, and check the page.
Playwright is a tool that controls a web browser with code. A test opens a page, does what a user does, and checks the result. In this course you write real Playwright tests and watch them run in a practice browser, on three small sample apps. The checker also runs your tests on versions of the apps that have bugs, because a test that cannot find a bug is not worth much.
- Beginner
- 17 lessons
- 6 h 8 min
- Free
Not started
Lessons
- 1Your first testRun a test in the practice browser, read the report, fix a mistake, and write two more tests.15 min
- 2Find elements by roleFind buttons, text boxes, links, and checkboxes the way a person sees them, with getByRole.18 min
- 3Labels, text, and test idsFind form fields by label and placeholder, text by its content, and elements by a test id.18 min
- 4Narrow down a locatorPick one element from many with filter, chaining, first, and last. Learn what strict mode does.20 min
- 5Click, type, and press keysUse fill, press, selectOption, and click on a shop page, and learn what Playwright checks before it acts.20 min
- 6AssertionsCheck the page with assertions that wait, and learn which assertion fits which question.20 min
- 7Waiting and flaky testsLearn why a test that reads the page too early fails, and how assertions that wait fix it.18 min
- 8Tests that catch bugsWrite tests that fail when the app is wrong, and learn how the checker finds out if a test is strong.22 min
- 9Groups and hooksPut tests in groups with describe, and share the setup of the tests with beforeEach.22 min
- 10Project: test the todo appProjectWrite a full set of seven tests for the todo app, and make each one catch a bug.30 min
- 11Page objectsPut the steps of a page in a class, so that each test reads like a short story and one change fixes many tests.25 min
- 12FixturesMake your own fixture with test.extend, so that a test gets a ready page object or a signed-in page.25 min
- 13Mock the networkChange the answers that the server gives, so that you can test empty lists, errors, and failures.25 min
- 14Wait for requests and call the APICheck what the page sends and receives, and set up data through the API before you test the page.25 min
- 15Quiz, Playwright basicsQuizTen questions on locators, waiting, bugs, hooks, mocks, page objects, and fixtures.10 min
- 16Project: test the shopProjectWrite seven tests for the shop app, with a page object, and make five of them catch a bug.35 min
- 17Playwright on your own computerQuizInstall Playwright, run tests in a real browser, read the report and the trace, and learn how the practice browser differs.20 min