Home / Blog / Onboarding a team onto Playwright

How to get a team writing Playwright tests: what to settle, and what to leave alone

Quick answer

Settle four things before the first spec: who decides the conventions, where they are written down, which ones a machine enforces, and who reads a red build. Leave most of Playwright alone for a month — sharding, visual comparison and component testing all wait. You will know it took when someone who was not in the room follows a convention without being told.

Nothing about the framework changes when a team goes from one engineer to four. The repository changes completely. One engineer decides where a spec lives by putting it somewhere; four engineers decide it four times, in four pull requests opened on the same afternoon, and none of them is wrong.

The decisions themselves are already written down elsewhere. Where the suite sits, what a locator may be, what a test may assume about the data and what runs per pull request all get settled while building a first suite by hand, and the catalogue of what good looks like is the practice list, linked further down. This page answers the question neither of those has to: how four people settle each of those decisions once, and how the answer outlives the person who made it.

What does a team have to agree before anyone writes the first spec?

The technical decisions have answers one engineer can reach alone, and the tutorial reaches them. The four settlements below arrive only because there is more than one person in the room.

None of those is a rule about testing; they are decisions about who and where. Skipping them costs nothing at first, which is why they get skipped.

What do the first two weeks look like when four engineers start at once?

Four engineers green-fielding in parallel produce four answers to questions nobody asked them. Four locator styles, two helper folders with a third set of helpers living inside the spec files, and two views on whether a spec may log in through the interface. By day ten there are specs in the repository and no shape to them, and the merge that would give them one is a rewrite. It is the sort nobody budgets for, because nothing is broken and every test passes.

The alternative costs something visible in week one: three of the four are not writing tests. One person builds the walking skeleton, which is the config, the way the suite logs in, one spec that goes end to end, and the check that runs it on every pull request. The other three read it, review it and argue with it. When they start writing, they start against a repository that already has a shape.

A lead who has just been given four people will feel that week, and it is the cheapest week in the quarter to spend. Neither arrangement has a number attached to it here: nobody has counted how many specs a team writes either way, so the paragraph above is an argument from cost rather than a finding.

Which parts of Playwright can a team safely ignore in month one?

The official best practices page runs twenty-seven headings below its title, from testing philosophy through locators, codegen, the VS Code extension, debugging, all browsers, dependency currency, CI, linting, parallelism and sharding, to soft assertions. None of them is marked optional and there is no order in them, which is what a manual has to do: it does not know which reader it has, so everything arrives at the same weight. A team that adopts all of it in month one adopts none of it.

Each deferral below has a cost it avoids and a trigger that ends it. A deferral with no trigger is neglect.

Whatever that project list eventually says, it is a list of browsers. Playwright's device emulation gives a spec a phone-sized viewport, a phone's user agent and touch input, which is mobile web. The iOS or Android build your users downloaded from a store is not something this suite reaches, and no entry in the config changes that.

Two things do not get deferred, because every later week is cheaper for having them. Turn the trace on for the first retry, so a failure can be read instead of re-run; a team without traces learns to press the retry button, and that habit is much harder to remove than to prevent. And put the type check and the lint gate in while there are five specs to fix rather than forty.

Which conventions can a machine enforce, and which need a person?

A convention a person has to remember is a convention that survives until that person is on holiday. So the first question to ask about anything the team agrees is whether a machine can hold it, and some of the ones that matter most cost a line of configuration.

The test id attribute is the clearest case. Four engineers will otherwise answer "what do we hang test hooks off" four ways, in four pull requests, all defensible. Naming it once turns it into a fact about the repository. Everything below was written and run against Playwright 1.62.1, the current release of the 1.62 line.

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    testIdAttribute: 'data-qa',
  },
});
Playwright 1.62.1 · TypeScript · playwright.config.ts

That option replaces the default rather than adding to it. With the config above, page.getByTestId('save') resolves <button data-qa="save">, and an element carrying data-testid stops resolving at all; both halves were run here as two tests and both passed. Which attribute to put in that string is a question about locators, and it has more than one defensible answer.

The second machine-held convention is the gate on every pull request, and the documentation is specific about what goes in it. Under Lint your tests, the best practices page says: "We recommend TypeScript and linting with ESLint for your tests to catch errors early. Use @typescript-eslint/no-floating-promises ESLint rule to make sure there are no missing awaits before the asynchronous calls to the Playwright API. On your CI you can run tsc --noEmit to ensure that functions are called with the right signature."

package.json

{
  "name": "e2e",
  "private": true,
  "scripts": {
    "test": "playwright test",
    "typecheck": "tsc --noEmit"
  },
  "devDependencies": {
    "@playwright/test": "1.62.1",
    "typescript": "5.9.3"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "commonjs",
    "moduleResolution": "node",
    "strict": true,
    "skipLibCheck": true,
    "noEmit": true
  },
  "include": ["tests", "playwright.config.ts"]
}
Playwright 1.62.1 · TypeScript 5.9.3 · both scripts run

The gate is now a thing in the repository instead of a paragraph in an onboarding document. npm run typecheck runs the compiler over the tests and the config without emitting anything, which is the check the documentation names for CI.

The two checks catch different defects and neither covers for the other, which is why the documentation names both. Run against the samples above, tsc --noEmit caught a misspelled assertion option: toBeVisible({ timeuot: 1000 }) came back as error TS2561: Object literal may only specify known properties, but 'timeuot' does not exist. It said nothing at all about an assertion written with no await in front of it, and the missing await is the ESLint rule's job.

What is left over needs a person, and it is a short list: whether the test should exist at all, and whether it is testing your product or testing Playwright. Once the machine holds the rest, that is the only thing review time is being spent on. The practice list is what a reviewer holds a spec against.

Who owns the suite when everyone owns it?

"The whole team owns the suite" is how a suite ends up owned by nobody, because a red build belonging to everyone is nobody's morning. Ownership here is two named jobs, and neither of them is "write all the tests".

Where both jobs stay implicit, the suite belongs to whoever wrote most of it. That is a person, and a person has a notice period.

How do you tell whether it worked?

These are observations rather than measurements. None of them carries a number, a percentage or a timeframe, because nobody here has measured one, and a lead can check every one of them by reading the repository for ten minutes.

When this bites you: the quarter the suite goes quiet

Nothing breaks. The suite is green every morning and no meeting is called about it. It has also not grown in five weeks, and the last four commits come from the same person.

None of what happened underneath was reported. Features shipped without tests and nobody blocked them, because blocking one was never anybody's job. The newest engineer could not find the conventions, invented their own, and nobody minded. Nobody read a red build any more; it just got retried.

Every one of those traces back to a decision that was made in a conversation and never written anywhere a new person would look, which is what makes the first move small. Read the last ten merged pull requests and count how many touched the suite. If the answer is one or two, then writing tests is not part of the job as anyone on the team currently understands it, and no amount of framework knowledge changes that.

Reading those ten pull requests sometimes turns a process problem into a staffing one: the conventions are fine, and nobody has the hours to hold them. That is the point at which teams hire an engineer who already works in Playwright every day to hold them from inside the repository.

Questions

How long does it take to get a team writing Playwright tests on their own?

Nobody here has published a number for that, and a range invented for an article would be worth less than the three things that decide it. The first is how the application logs in, because a form post and an SSO round trip with a one-time code are different pieces of work. The second is whether test data can be created through an API instead of being clicked into existence. The third is whether the conventions were written down anywhere the fourth engineer can find without asking. Answer those three for your own application and you can estimate this better than anyone can estimate it for you.

Should everyone on the team write tests, or one person?

Everyone writes them, and one person owns the conventions. Those are two jobs and merging them gives you either a bottleneck who has to review every spec or a repository with four dialects in it. The conventions owner answers whether a convention is still right and changes it when it is not; they do not become the only person allowed to add a test.

Do we need the page object model before we start?

No. Specs that read top to bottom are easier to review while the team is still agreeing what a spec looks like, and the trigger to factor something out arrives on its own: the same three lines copied into a fourth spec. The page object argument holds both positions.

What if two engineers disagree about a convention?

The named owner settles it once and it gets written down where the next person will look. A convention decided per pull request is decided again every pull request, and the engineer who joins in week three inherits an argument instead of an answer. Where the disagreement is about something a machine could hold, settle it in the config or in a lint rule and it stops coming back.

How do we know it is working before the suite is big enough to matter?

The size of the suite is not the thing to watch this early. Watch the behaviour around it: somebody opens a trace when the build goes red, a spec arrives from an engineer who never asked how, a test gets deleted with a reason in the commit message. A coverage percentage is the wrong instrument at this size, because with a dozen specs it moves on whether one file was added that week and says nothing about whether a red build gets read.

Tell us how many engineers have to be writing specs by the end of the quarter

That is answerable with the number itself and with what your application's login looks like, because an SSO round trip with a one-time code is a different first fortnight from a form post. Send those two and the reply is the order we would settle things in, and the list we would leave alone until its trigger arrives. If what you want is somebody who has spent that fortnight before, working inside your repository, engineers are billed hourly, from $50 an hour, minimum one full-time engineer for one month. Teaching your team is a separate purchase, bought by the hour with no month attached, and that page states its own rate.