A pull request shows a small green check mark next to the commit, and the text under it says all checks have passed. Your machine is off. So who ran them, where, and what exactly? This lesson clicks that check mark and walks back layer by layer to its root, and along the way the lesson 7 suite goes red twice, over two things your machine has and the other one does not. It follows the official docs (Continuous Integration, Setting up CI, Authentication), and every command and output comes from a real run.
What you need
- Node.js. 22, 24, 26.
- Playwright 1.65.1. The lesson was recorded with this version; other versions may print slightly different output.
- The code. Subscribers see the lesson repository in the Source code box under the video, with the tags
pw08-startandpw08-end. It has the workflow in.github/workflows/playwright.ymland its own config,playwright.lesson08.config.ts, which you run with-c. - A GitHub repository where you can add a secret named
AE_PASSWORD, and the shared test account from lesson 7.
The tests run against automationexercise.com, which sometimes shows a waiting page to automated browsers, so a test can fail once and pass on the retry. Times are not the point of this lesson and will differ.
Step 1: Click the check mark
Click it and GitHub opens the page of one run, called Playwright Tests. Inside there is exactly one job, named test, and opening it gives a list of steps, each with its own check mark. The first line tells you which machine ran it: Ubuntu, the latest. Not your machine.
You do not need to rent a server for this: every time you push, GitHub lends you a machine. The catch is that it is brand new and wiped when the run ends, like an exam room that hands you a computer with nothing installed: none of your code, no Node, no browser, not even your password.
Step 2: The log of the tests
Click the step called Run Playwright tests: the familiar log, like your own terminal. It is the lesson 7 suite, one login step and five pages that check Logged in as Vi. Look at the first lines and two things are odd.
| What you see | Why |
|---|---|
| a single worker, while your machine runs more | the config limits it on CI (Step 6) |
| a page fails the first time, is retried and goes green | the config allows retries on CI (Step 6) |
Both are explained in Step 6.
Step 3: Missing browsers
Right above that step sits Install Playwright Browsers. On your machine the browsers were installed in lesson 1, so it is easy to forget they need installing at all. Drop that step and run on a machine with the code and Node but no browser: the login test dies the moment it launches the browser, with Executable doesn't exist. The five tests that wait behind login never run. Right under the error Playwright prints the fix, one command that installs the browsers. That is npx playwright install --with-deps in the workflow: the browsers plus the system libraries the empty machine lacks. Red, number one.
Step 4: The password
The test step has two extra lines your original file does not: they pass in a password. Remember lesson 7: you log in once and save a login file, and the docs say keep that file out of git. So on a new machine there is no badge. No problem, the setup step makes a new one, but it needs the password.
A password written in the code is visible to anyone who reads the repository, so tests/helpers/user.ts only reads an environment variable:
export const user = {
name: 'Vi',
email: 'pw07-vi@example.com',
password: process.env.AE_PASSWORD ?? '',
};
Your machine has that variable. The new one does not. Run it just like CI, without the variable:
CI=1 npx playwright test -c playwright.lesson08.config.ts
Fails on purpose. The login test fails and the five tests behind it do not run.
Login goes red, is retried, red, retried again, still red: 1 failed and 5 did not run. Red, number two. So where does the password live? GitHub has a vault for each repository, called secrets. Add one in the repository settings, named exactly like the variable the code reads, AE_PASSWORD. Once pasted, nobody can view the value again, not even you. At run time GitHub hands it to the empty machine, and those two extra lines in the workflow are where it is received.
Step 5: The to-do list
Who wrote this list of steps? One more layer back, in the repository's code: a folder .github, inside it workflows, inside that one YAML file. Everything you saw comes from this file: the run name, the job name, every step.
And here is the promised root. In lesson 1, when creating the project, Playwright asked whether to add a GitHub Actions workflow, and the answer was No, with a promise to come back in the CI lesson. Answer Yes to npm init playwright@latest and Playwright writes this file for you.
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
env:
AE_PASSWORD: ${{ secrets.AE_PASSWORD }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
| Part | What it says |
|---|---|
on | when to run: every push, or a pull request into main (this is why the check mark appears without anyone clicking) |
runs-on, timeout-minutes | which machine (the latest Ubuntu) and at most 60 minutes |
checkout, setup-node, npm ci | fetch the code, install Node, install the packages from the lock file |
playwright install | install browsers |
| Run Playwright tests | run the tests, taking the password from the vault |
upload-artifact | pack the HTML report and keep it on GitHub for 30 days |
Each step answers one thing the empty machine is missing. The last one is different: !cancelled() makes it run even when the tests fail, skipped only if you cancel the run, because a red run is exactly when you need the report most. In the lesson repository the test step is npx playwright test -c playwright.lesson08.config.ts, because the repository holds the earlier lessons' tests too.
Step 6: A config that knows where it is
The answer to the two odd things has been in the config since lesson 1. Three lines, each asking one question: is there a CI variable? GitHub machines always set it. Yours does not.
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
| Line | On CI | Why |
|---|---|---|
retries | a failed test gets up to two retries | that is why the login in Step 4 failed three times before giving up |
workers | one worker, tests run one after another | the docs recommend it: each test gets the whole machine, results are more stable |
forbidOnly | the run refuses to start if test.only is in the code | see below |
The third line is a very human mistake: you are fixing a test, add only to run just that one, forget to remove it and push. On your machine: one test, green. On CI, Playwright refuses to run at all and points at the line with only. Without it the whole suite quietly shrinks to one test and stays green.
To see what CI would do on your own machine, set the variable yourself:
CI=1 AE_PASSWORD=pw07pass npx playwright test -c playwright.lesson08.config.ts
You should see 6 passed: the setup test plus five.
Step 7: Green, but with a mark
Is a flaky test that is still green fine? Reread the log of Step 2: the Contact us page waits 10 seconds without finding the text and goes red, then the retry goes green. Playwright calls that test flaky: sometimes red, sometimes green, with no code change. The run still counts as green, and so does the check mark on the pull request. Retries keep CI from going red over one unlucky run, but they fix nothing: in a real project, flaky is where you open the report.
Step 8: The report package
The machine is gone, so is the report? At the bottom of the run page there is Artifacts, and inside it the package the last step stored. Download it and you get a zip. The docs warn: do not open the HTML directly. Unzip it and use the show-report command. It opens like a local report, so a test that failed on a machine that no longer exists can still be replayed step by step.
One catch, the docs add: reports and traces can contain your test account's password. Treat that package as carefully as the vault itself.
Tests that fail on purpose
None. The failures in this lesson come from the environment: missing browsers, a missing password, a test.only.
Check your result
CI=1 AE_PASSWORD=pw07pass npx playwright test -c playwright.lesson08.config.ts→ 6 passedCI=1 npx playwright test -c playwright.lesson08.config.ts→ 1 failed
Recap
| What the empty machine lacks | Where it comes from |
|---|---|
| Your code and Node | checkout, setup-node, npm ci |
| Browsers | npx playwright install --with-deps |
| The password | a secret in the vault, read as AE_PASSWORD |
| The right behaviour on CI | the config: retries, workers, forbidOnly |
- A brand new machine follows one to-do list exactly: the workflow file.
- A flaky test is green with a mark; open the report.
- The cloud is not the hard part: it is just a machine that knows nothing about you.
Next lesson
This is the last lesson of the Playwright TypeScript series. Eight lessons ago you had not even installed Playwright. Since then you wrote tests, called elements by name, read errors, built fixtures, wrapped pages in page objects, logged in once for the whole suite, and today put the whole suite on a machine that is not yours. Each lesson's code stays in the series repository, one checkpoint per lesson. What this series never touched, like splitting the suite across many machines at once, is saved for the advanced Playwright series.