Absolute Path

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

Start the course

Lessons

  1. 1Your first testRun a test in the practice browser, read the report, fix a mistake, and write two more tests.
  2. 2Find elements by roleFind buttons, text boxes, links, and checkboxes the way a person sees them, with getByRole.
  3. 3Labels, text, and test idsFind form fields by label and placeholder, text by its content, and elements by a test id.
  4. 4Narrow down a locatorPick one element from many with filter, chaining, first, and last. Learn what strict mode does.
  5. 5Click, type, and press keysUse fill, press, selectOption, and click on a shop page, and learn what Playwright checks before it acts.
  6. 6AssertionsCheck the page with assertions that wait, and learn which assertion fits which question.
  7. 7Waiting and flaky testsLearn why a test that reads the page too early fails, and how assertions that wait fix it.
  8. 8Tests that catch bugsWrite tests that fail when the app is wrong, and learn how the checker finds out if a test is strong.
  9. 9Groups and hooksPut tests in groups with describe, and share the setup of the tests with beforeEach.
  10. 10Project: test the todo appProjectWrite a full set of seven tests for the todo app, and make each one catch a bug.
  11. 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.
  12. 12FixturesMake your own fixture with test.extend, so that a test gets a ready page object or a signed-in page.
  13. 13Mock the networkChange the answers that the server gives, so that you can test empty lists, errors, and failures.
  14. 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.
  15. 15Quiz, Playwright basicsQuizTen questions on locators, waiting, bugs, hooks, mocks, page objects, and fixtures.
  16. 16Project: test the shopProjectWrite seven tests for the shop app, with a page object, and make five of them catch a bug.
  17. 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.