← All topics

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.

Questions by level

Sample questions

A few questions from each level with the correct answer and an explanation.

Playwright · Junior

  1. Which command creates a new Playwright Test project with a config and an example test?
    Show the answer

    Correct answer: npm init playwright@latest

    The init command asks a few questions (TypeScript or JavaScript, test folder, GitHub Actions workflow), installs @playwright/test and browsers, and creates playwright.config.ts with an example test.

  2. What does npx playwright install do?
    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 install downloads them; --with-deps also installs system libraries, which is handy on Linux CI machines.

  3. 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 channel option.

  4. Which command runs all Playwright tests in the project?
    Show the answer

    Correct answer: npx playwright test

    npx playwright test finds test files in testDir, runs them in parallel across the configured projects, and prints results with the configured reporters.

All 75 questions with answers →

Playwright · Middle

  1. What does fullyParallel: true change?
    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. fullyParallel spreads individual tests across workers, which requires every test to be independent.

  2. 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.

  3. What does retries: process.env.CI ? 2 : 0 achieve?
    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.

  4. 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-tests turns them into failures.

All 75 questions with answers →

Playwright · Senior

  1. 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.

  2. How does --shard=2/4 split 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.

  3. Why does fullyParallel help 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.

  4. How do you get one report from four sharded CI jobs?
    Show the answer

    Correct answer: Use the blob reporter in each and merge-reports at the end

    Each shard uploads its blob report as an artifact, and a final job merges them into one HTML report.

All 77 questions with answers →

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 →