Playwright Interview Questions and Answers
End-to-end test automation with Playwright: locators and auto-waiting, web-first assertions, fixtures and projects, authentication with storageState, network mocking and API testing, traces and debugging, parallel runs, sharding and CI, flaky tests and suite architecture.
227 questions for Playwright interviews with answers and explanations - Junior, Middle and Senior levels. Sample questions, online quizzes and coding tasks.
- Locators
- Fixtures
- Network mocking
- Trace viewer
- CI and sharding
Questions by level
Junior
Core concepts and syntax · 50 questions
Middle
Practice, nuances and optimization · 50 questions
Senior
Architecture, internals, edge cases · 50 questions
Sample questions
A few questions from each level with the correct answer and an explanation.
Playwright · Junior
- Which command creates a new Playwright Test project with a config and an example test?
Show the answer
Correct answer:
npm init playwright@latestThe init command asks a few questions (TypeScript or JavaScript, test folder, GitHub Actions workflow), installs
@playwright/testand browsers, and createsplaywright.config.tswith an example test. - What does
npx playwright installdo?Show the answer
Correct answer: Downloads the browser builds Playwright needs
Each Playwright version is tested against specific Chromium, Firefox and WebKit builds.
npx playwright installdownloads them;--with-depsalso installs system libraries, which is handy on Linux CI machines. - Which three browser engines does Playwright Test support out of the box?
Show the answer
Correct answer: Chromium, Firefox and WebKit
Playwright bundles Chromium, Firefox and WebKit builds. It can also run branded Chrome and Edge through the
channeloption. - Which command runs all Playwright tests in the project?
Show the answer
Correct answer:
npx playwright testnpx playwright testfinds test files intestDir, runs them in parallel across the configured projects, and prints results with the configured reporters.
Playwright · Middle
- What does
fullyParallel: truechange?Show the answer
Correct answer: Tests inside one file also run in parallel
By default files run in parallel, but tests within a file run in order in one worker.
fullyParallelspreads individual tests across workers, which requires every test to be independent. - Why do many configs set
workers: process.env.CI ? 1 : undefined?Show the answer
Correct answer: CI machines are often small, and one worker is more stable
Locally Playwright uses about half the CPU cores. On a small CI runner, many browsers fight for CPU and cause timeouts. Teams with bigger runners or sharding raise the number.
- What does
retries: process.env.CI ? 2 : 0achieve?Show the answer
Correct answer: Retries failures in CI but shows them at once locally
Locally you want to see a failure immediately. In CI, retries absorb rare infrastructure glitches, and tests that pass on retry are reported as flaky so they can be fixed.
- What does a test marked "flaky" in the Playwright report mean?
Show the answer
Correct answer: It failed first and passed on a retry
Flaky tests pass the run but need attention: they hide race conditions or shared state.
--fail-on-flaky-teststurns them into failures.
Playwright · Senior
- A Playwright suite takes 50 minutes in CI. What is usually the most effective first step?
Show the answer
Correct answer: Profile the slowest tests and setup, then shard and move checks lower
The report shows where time goes: UI logins, long flows, waits. Fixing those, moving logic checks to API or unit tests, and sharding across machines usually gives the biggest gain.
- How does
--shard=2/4split the work?Show the answer
Correct answer: It runs about a quarter of the tests, the second part
Shards split tests between machines. With
fullyParallel: true, splitting is per test, which balances better than per file. - Why does
fullyParallelhelp balance shards?Show the answer
Correct answer: Tests, not whole files, are distributed between shards
Without it, a shard gets whole files, so one huge file can make that shard much slower than the others.
- How do you get one report from four sharded CI jobs?
Show the answer
Correct answer: Use the blob reporter in each and
merge-reportsat the endEach shard uploads its blob report as an artifact, and a final job merges them into one HTML report.
Combined quizzes with this topic
Questions from several topics at once - just like an interview for a specific role.
Coding tasks
Write your solution right in the browser, and tests check it instantly. JavaScript interview classics (debounce, deepClone, Promise.all, an LRU cache), TypeScript tasks on generics, narrowing and utility types checked by the real compiler, Node.js backend logic (middleware, rate limiters, job queues), SQL queries in real PostgreSQL, and React components and hooks like a todo list, tabs, useDebounce and useInterval.
Open tasks →