---
title: 'Playwright Tutorial: Zero to CI (Free TypeScript Course)'
description: A hands-on Playwright tutorial in TypeScript, from your first test to
  GitHub Actions and a cloud browser grid. Every demo in this video is a real run
  of the course code.
source_url:
  html: https://testingbot.com/resources/videos/playwright-tutorial-course
  md: https://testingbot.com/resources/videos/playwright-tutorial-course.md
---

# Playwright Tutorial: Zero to CI (Free TypeScript Course)

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

https://www.youtube.com/embed/-PtTgliBgvE

A hands-on Playwright tutorial in TypeScript, from your first test to GitHub Actions and a cloud browser grid. Every demo in this video is a real run of the course code.

## What you'll learn

- Install Playwright and write a first test with the Playwright Test runner
- Role-based locators, filtering and strictness
- Auto-waiting and web-first assertions (and the habits that make tests flaky)
- Fixtures, hooks, and logging in once with a setup project
- Debugging with UI mode, the trace viewer and codegen
- Chromium, Firefox and WebKit projects, parallel workers and sharding
- Running the suite in GitHub Actions
- Running the same suite on remote Windows and macOS browsers on TestingBot

The full course, with code, quick checks and a knowledge check, is free and needs no account: [Playwright Tutorial: Zero to CI](https://testingbot.com/resources/courses/playwright). Free TestingBot Playwright certification (pass the exam and run your suite green on TestingBot; issued by TestingBot, not by Microsoft or the Playwright project): [certification details](https://testingbot.com/resources/courses/playwright/certification).

## Chapters

- 0:00 Course introduction
- 1:05 Introduction: how Playwright works
- 1:29 Chapter 1: Install Playwright and Run a First Test
- 2:13 Chapter 2: Locators: Find Elements the Way Users Do
- 2:55 Chapter 3: Auto-Waiting and Web-First Assertions
- 3:34 Chapter 4: Fixtures, Hooks and Logging In Once
- 4:19 Chapter 5: Debugging: UI Mode, Trace Viewer, Codegen
- 5:01 Chapter 6: Multiple Browsers, Workers and Sharding
- 5:40 Chapter 7: Run Playwright in CI with GitHub Actions
- 6:24 Chapter 8: Run Your Playwright Suite on a Cloud Grid
- 8:35 Chapter 9: Knowledge check

_The presenter is an AI avatar of Jochen Delabie (TestingBot), voiced by a stock AI voice._

## Video transcript

### Course introduction

Hi, I'm Jochen from TestingBot. This free course teaches Playwright the way most teams use it today: in TypeScript, with the Playwright Test runner. It's for you if you're new to Playwright, or if you're coming from Selenium or Cypress. You'll need some JavaScript or TypeScript, including async and await, plus Node.js and a code editor. Chapter by chapter, you build one small test suite. You find elements with role-based locators, rely on auto-waiting and retrying assertions instead of sleeps, log in once with a setup project, and debug failures with the trace viewer. Then you run the suite in parallel on Chromium, Firefox and WebKit, and on every push in GitHub Actions. In the final chapter, the same tests run unchanged on TestingBot's cloud grid, against remote browsers on Windows and macOS. When you're done, you can earn the free TestingBot certification: pass the exam, and run your suite green on TestingBot. Let's get started.

### Introduction: how Playwright works

Before we write any code, three ideas explain most of Playwright. Actions and assertions wait for the page, so you don't add sleeps. Every test gets a fresh browser context, so tests can't leak state into each other. And one API drives Chromium, Firefox and WebKit. The rest of the course builds on those three.

### Chapter 1: Install Playwright and Run a First Test

Chapter one. You scaffold a project with npm init playwright, read the config it generates, and replace the sample with your first real test: add a todo, then check that it's in the list. The generated config runs every test in Chromium, Firefox and WebKit. Here's that first test, running in all three. This runs every test in all three configured browsers. Three projects, three passes, in about three seconds. Here's the Chromium run again, slowed down. It opens the demo app, types Buy milk, presses Enter, and the assertion finds exactly that item in the list.

### Chapter 2: Locators: Find Elements the Way Users Do

Chapter two is about locators: how you find elements. Prefer what a user sees, like a role and an accessible name, over CSS classes. Every action needs exactly one match, so you narrow a list by filtering on a row's text, then find the control inside that row. Here's that pattern on three todos. One test, in Chromium only. It passes in under two seconds. Slowed down: it adds three todos, checks there are three rows, and ticks the checkbox in the Walk the dog row only. The assertions then check the completed filter.

### Chapter 3: Auto-Waiting and Web-First Assertions

Chapter three. Most flaky tests check the page before it's ready. Playwright waits before every action, and web-first assertions keep retrying until they pass or time out. You'll learn the habits that switch that off, like fixed sleeps, and when soft assertions help. Here are two tests that use them. Two tests in Chromium. Both pass. Nothing in them waits for a fixed time. Each expect keeps retrying on its own until the page matches: here, until there are three todo items, and the title matches TodoMVC.

### Chapter 4: Fixtures, Hooks and Logging In Once

Chapter four. Instead of repeating setup in every file, you write a fixture that opens the app and hands your test a small page object. Then you log in once in a setup project, save the session to a file, and start every other test already signed in. Watch the setup run first. Running the Chromium project also runs its setup dependency. The setup test logs in once and saves the cookies to a file. Then the browser tests start already signed in, and the logged out group starts empty. Four passed. Here's the login again, slowed down: fill in the form, submit, and wait for the Secure Area heading before saving the state.

### Chapter 5: Debugging: UI Mode, Trace Viewer, Codegen

Chapter five is about debugging: UI mode for everyday work, the inspector to step through a test, codegen to discover locators, and the trace viewer for failures you can't reproduce. Wrapping actions in test steps makes a trace easy to read. Here's a run that records a trace, and that trace in the viewer. Trace on, for one test. It passes, and the trace is saved under test results. Opened in the trace viewer, the two test steps appear as named groups. Select one, and you see the page as it was at that moment, along with the locator and the expected text.

### Chapter 6: Multiple Browsers, Workers and Sharding

Chapter six. Projects run the same tests in different browsers and devices. Workers run them in parallel on one machine, and sharding splits a suite across several machines. You'll also see how much parallelism is actually worth it. Here's the suite so far, in three browsers, on four workers. Four workers, three browsers, four tests each. Chromium, Firefox and WebKit run side by side. Twelve tests passed in about six seconds. Here's one of the Firefox runs again, slowed down.

### Chapter 7: Run Playwright in CI with GitHub Actions

Chapter seven puts the suite in GitHub Actions. You read the workflow the installer generated, keep secrets out of the code, and download the report and traces when a CI run fails. On CI, the config retries failed tests and uses one worker. Here's the workflow's test command, with CI set, on my machine. With CI set, the config switches to one worker and up to two retries. So the twelve tests run one after another. Twelve passed in about eight seconds. On GitHub, the workflow then uploads the HTML report as an artifact you can download.

### Chapter 8: Run Your Playwright Suite on a Cloud Grid

Chapter eight. Until now, your browsers ran on your own machine or on a Linux CI runner. In this chapter, we point the same suite at TestingBot's cloud grid. Playwright connects to a remote browser over a WebSocket, so the tests themselves don't change. You add a small helper for the endpoint, a separate config for the grid, and a fixture that reports pass or fail to the dashboard. Here it is, running for real. First, your credentials. In the TestingBot member area, open Settings, then Security. The API Credentials card has your TestingBot key and secret, each with a copy button. Keep them out of your code. Export them as TB\_KEY and TB\_SECRET in the shell where you run Playwright. The endpoint helper reads them from there. On GitHub Actions, add both as repository secrets, and pass them to the test step as environment variables. One worker, so one remote session at a time. Playwright opens a WebSocket to the TestingBot grid, which starts a fresh Chrome on Linux for the setup project. It logs in once, saves the session to a local file, and setup passes. Next, the grid starts Chrome 156 on Windows 11 for the browser project, which reuses the saved login. The first test adds a todo, and passes. The second filters the list to active items. Three passed, in about thirty-two seconds. In the TestingBot dashboard, every session from this run is in your test list, with its build, browser, platform and result. Open a test to see its status, environment and duration, the session video, and every step Playwright sent. Expand a step to see its parameters. Clicking a step seeks the video to that moment. And the Logs tab has the session log, which you can search, filter and download.

### Chapter 9: Knowledge check

That's the course. The last chapter is a knowledge check: nine questions, each with a short explanation. If you'd like something to show an employer, take the free TestingBot certification: pass the exam, and run your suite green on TestingBot. Both are linked from the course page.

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Other videos

[![Appium Tutorial with WebdriverIO in JavaScript (Free Course + Certification)](https://testingbot.com/assets/videos/appium-webdriverio-course-e7519b511b317da2db984af8a9517de74535de8a33a055a89e9cd34980663951.jpg)](https://testingbot.com/resources/videos/appium-webdriverio-tutorial-course)

#### Appium Tutorial with WebdriverIO in JavaScript (Free Course + Certification)

A hands-on Appium tutorial with WebdriverIO, in JavaScrip...

[Watch video →](https://testingbot.com/resources/videos/appium-webdriverio-tutorial-course)

[![Cypress Tutorial in JavaScript (Free Course + Certification)](https://testingbot.com/assets/videos/cypress-course-a12eb8c833003156f19867fc7cc4c56c12120cdcfad9ca8c658ca392a6614a14.jpg)](https://testingbot.com/resources/videos/cypress-tutorial-course)

#### Cypress Tutorial in JavaScript (Free Course + Certification)

A hands-on Cypress tutorial in JavaScript: from npm insta...

[Watch video →](https://testingbot.com/resources/videos/cypress-tutorial-course)

[![WebdriverIO Tutorial in TypeScript (Free Course + Certification)](https://testingbot.com/assets/videos/webdriverio-course-b963320836ab60610065c7f987c171329c5bcf168b5525cee18c93c9236ce5ec.jpg)](https://testingbot.com/resources/videos/webdriverio-tutorial-course)

#### WebdriverIO Tutorial in TypeScript (Free Course + Certification)

A hands-on WebdriverIO tutorial for web apps, in TypeScri...

[Watch video →](https://testingbot.com/resources/videos/webdriverio-tutorial-course)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
