Skip to content

Playwright Testing Interview Questions for Consulting Companies

40 questions weighted to the interview style of consulting companies — 5 easy, 32 medium, 3 hard.

How consulting companies interview for Playwright Testing

Consulting firms look for people who can structure messy business problems and explain them simply to clients. Expect case and guesstimate questions, data interpretation, and questions on how you handled stakeholders, along with the technical skills for the role.

This set focuses on Locators and Assertions (5), JavaScript and TypeScript (5), Visual & Accessibility Testing (5), Parallel Runs, Sharding & Reporting (4).

Technical interview Partner or HR round Managerial round Online assessment (aptitude + technical) HR round
Solved — consulting companiesStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

How do you run one group of tests serially while the rest of the suite runs in parallel?

Save to ▾
Show answer
Put the group in its own project with fullyParallel: false and limit it to one worker, which recent versions allow with a workers setting on the project, or run it in a separate CI step with --project=serial --workers=1. Inside a file, test.describe.configure({ mode: 'serial' }) keeps order. Use project dependencies if the group must run after the parallel tests.
02

How do you locate elements inside a specific row or card?

Save to ▾
Show answer
Chain locators: find the container first, then search inside it. Example: page.getByRole('row', { name: 'INV-104' }).getByRole('button', { name: 'Download' }). Each step narrows the search area, so short names like Edit or Download stay unique. Chaining also documents intent clearly and avoids long CSS paths that break when markup changes.
03

How do you test offline behaviour?

Save to ▾
Show answer
Call context.setOffline(true) to cut all network access for the context, then check that the app shows an offline banner or queues actions. Switch back with setOffline(false) and verify it syncs. You can also set offline: true in the context options. For a single failing endpoint, use route.abort instead of going fully offline.
04

How do you validate JSON schema?

Save to ▾
Show answer
Use a library such as zod or ajv to define the expected schema and parse the response to fail on missing or wrongly typed fields.
05

How do you decide how many shards a suite should use?

Save to ▾
Show answer
Start from the target wall-clock time and the total test time per machine. If one machine with its workers takes 40 minutes and the goal is under 10, you need about four or five shards, plus some margin for setup like installing browsers. Past a point each shard spends more time on setup than on tests, and the app or test data may become the bottleneck, so measure each change.
06

What are web-first assertions?

Save to ▾
Show answer
Assertions like expect(locator).toBeVisible() that retry until they pass or time out, unlike one-off checks.
07

What happens if you forget an await?

Save to ▾
Show answer
The action runs without waiting, so the next step may run first — causing flaky failures or 'Target closed' errors. The @typescript-eslint/no-floating-promises rule catches it.
08

Write a visual assertion that masks a live clock and an ad banner.

Save to ▾
Show answer
// masked areas are painted with a solid box await expect(page).toHaveScreenshot('home.png', { mask: [ page.getByTestId('live-clock'), page.locator('.ad-banner'), ], maskColor: '#FF00FF', animations: 'disabled', fullPage: true, });
09

How do you test a page in dark mode or with reduced motion?

Save to ▾
Show answer
Set colorScheme: 'dark' or reducedMotion: 'reduce' in the context options or test.use. You can also switch during a test with page.emulateMedia({ colorScheme: 'dark' }). Then assert the right styles or take a screenshot comparison. Reduced motion also helps stability, because many apps skip animations when that preference is set.
10

Write a test that checks keyboard Tab order through a login form.

Save to ▾
Show answer
test('login form is keyboard friendly', async ({ page }) => { await page.goto('/login'); await page.getByLabel('Email').focus(); await page.keyboard.press('Tab'); await expect(page.getByLabel('Password')).toBeFocused(); await page.keyboard.press('Tab'); await expect(page.getByRole('button', { name: 'Sign in' })).toBeFocused(); await page.keyboard.press('Enter'); });
11

What are fixtures in Playwright?

Save to ▾
Show answer
Reusable setup/teardown units injected into tests (page, context, request). You can extend test with custom fixtures such as loggedInPage.
12

Tell me about a time you reduced pipeline time with parallel runs or sharding.

Save to ▾
Show answer
Situation: our regression suite took 55 minutes, so developers skipped it. Task: bring it under 15. Action: I removed shared test data so fullyParallel could be turned on, split the three slowest files, and ran four shards with blob reports merged into one HTML report. Result: the suite finished in 12 minutes and it became a required check on every pull request.
13

A multi-select filter test passes even when an extra option stays selected. How do you tighten it?

Save to ▾
Show answer
The test probably checks only that the wanted options are selected, for example with a loop of toBeChecked or a contains check. Replace it with await expect(select).toHaveValues(['red', 'green']), which passes only when exactly those values are selected, and it retries until the timeout. For custom multi-select widgets, assert the full list of selected chips with toHaveText on the chip locator.
14

The app polls a status endpoint every few seconds. How do you test the change from Pending to Done?

Save to ▾
Show answer
Mock the endpoint with a counter: return Pending for the first two calls and Done after that. Then assert the UI shows Pending and later Done using web-first assertions with a suitable timeout. You can also use page.clock to speed up the polling interval instead of waiting real seconds. This makes a slow real-world process quick and deterministic.
15

A locator matches three Delete buttons and the test fails with a strict mode violation. How do you fix it?

Save to ▾
Show answer
First scope the locator to the item you mean, for example the row that contains the user's name: page.getByRole('row', { name: 'Ravi Kumar' }).getByRole('button', { name: 'Delete' }). Do not reach for first() or nth() as a quick fix, because the order can change and the test may delete the wrong record. Scoping by meaningful context is stable and readable.
16

The app logs in through a third-party OAuth pop-up. How do you automate it?

Save to ▾
Show answer
For most tests, avoid the pop-up: get a session through a test login API or a test identity provider and save it with storageState. Keep one test for the real flow, using const popup = page.waitForEvent('popup') before clicking, then fill the provider's form inside popup. Third-party pages can change and add captchas, so limit how often you depend on them.
17

A test uses forEach with an async callback and the checks inside never seem to run. Why?

Save to ▾
Show answer
forEach does not wait for async callbacks, so it starts each callback and returns at once. The test may finish before the assertions run, or their errors are lost. Use for...of with await to run steps in order, or Promise.all with map when the steps can safely run in parallel. A lint rule can flag this pattern.
18

How do you reuse login state across tests?

Save to ▾
Show answer
Log in once in global setup, save storageState to a JSON file and set use.storageState in the config so every test starts logged in.
19

How do you capture browser console messages and page errors?

Save to ▾
Show answer
Listen with page.on('console', msg => ...) for console.log, warnings and errors, and page.on('pageerror', err => ...) for uncaught exceptions. Collect them in an array and attach them to the report on failure. Traces also show console output. Uncaught page errors often explain why a button did nothing or a page stayed blank.
20

Tell me about setting up CI for a test suite.

Save to ▾
Show answer
Situation: our team ran tests only on laptops before releases. Task: run them automatically on every pull request. Action: I created a CI workflow with browser install, sharding over four machines, merged HTML reports and traces on retry. Result: feedback came within twelve minutes on each pull request, and release-day surprises dropped sharply.
21

How do you exclude a third-party widget or switch off one rule in an axe scan?

Save to ▾
Show answer
// scan the page but skip the chat widget you do not own const results = await new AxeBuilder({ page }) .include('main') .exclude('#third-party-chat') .disableRules(['duplicate-id']) .analyze(); expect(results.violations).toEqual([]); // log a ticket for anything you exclude
22

How do you test file downloads and verify their content?

Save to ▾
Show answer
Capture the download event, save it with download.saveAs, then read the file in Node and assert on name, size or content.
23

Show a config with a setup project and a browser project that reuses its login.

Save to ▾
Show answer
projects: [ { name: 'setup', testMatch: /auth\.setup\.ts/ }, { name: 'chromium', use: { ...devices['Desktop Chrome'], storageState: '.auth/user.json' }, dependencies: ['setup'], }, ],
24

What are interfaces and types in TypeScript?

Save to ▾
Show answer
Both describe the shape of data. Interfaces are extendable and suit object contracts; type aliases can also model unions and primitives.
25

What are union types and type narrowing in TypeScript?

Save to ▾
Show answer
A union type allows several types, such as string | number or 'admin' | 'user'. Before using type-specific methods, you narrow the type with checks like typeof, instanceof, in or comparing a literal field. TypeScript then knows the exact type inside that branch. In tests, unions model options like a role parameter that accepts only known values.
26

A setup fixture creates expensive test data and suite time has doubled. How do you redesign it?

Save to ▾
Show answer
Measure first with the report timings. Then create data through the API instead of the UI, move read-only shared data into a worker-scoped fixture, and seed common reference data once in a setup project. Keep per-test data only for things a test changes. Cache login with storageState. This usually cuts setup time sharply without losing isolation.
27

What do beforeAll and afterAll do?

Save to ▾
Show answer
beforeAll runs once before the tests in its file or describe block, and afterAll runs once after them. In Playwright they run once per worker, so if tests are spread over workers they can run more than once. They suit cheap shared setup. They cannot use test-scoped fixtures like page, so open your own page from the browser fixture if needed.
28

How is a Playwright component test different from a Jest unit test with jsdom?

Save to ▾
Show answer
jsdom is a JavaScript imitation of the DOM running in Node, so layout, CSS, real focus and many browser APIs are missing or fake. A Playwright component test renders in real Chromium, Firefox or WebKit, so visibility, scrolling, styles and keyboard behaviour are real. The cost is a build step and a browser, so it is slower than jsdom. Pure logic and hooks are still cheaper in unit tests.
29

Describe a time you argued against mocking every API in the suite.

Save to ▾
Show answer
Situation: a teammate proposed mocking all APIs to make the suite fast. Task: keep speed without losing integration coverage. Action: I showed two recent bugs caused by API changes that mocks would have hidden and proposed mocking only third parties and error states, keeping ten real end-to-end journeys. Result: the team agreed and the next contract change was caught before release.
30

What do maxDiffPixels, maxDiffPixelRatio and threshold control in a screenshot comparison?

Save to ▾
Show answer
threshold sets how different two pixels can be in colour, from 0 to 1, before they count as different; the default is 0.2. maxDiffPixels allows a fixed number of differing pixels, and maxDiffPixelRatio allows a fraction of the total image. Keep them tight so real regressions fail, and set them in the expect section of the config rather than loosening single tests one by one.
31

How do test.slow() and longer timeouts help or hurt debugging?

Save to ▾
Show answer
test.slow() triples the timeout for a test that is genuinely long, such as a report export. It is honest and visible in code. But raising timeouts to make a flaky test pass hides the real cause, such as a missing wait or slow backend, and makes failures take longer. Investigate the trace first and change timeouts only with a reason.
32

Component and end-to-end tests run together and slow down every commit. How do you separate them?

Save to ▾
Show answer
Give them separate configs, such as playwright-ct.config.ts with its own testDir for component specs and playwright.config.ts for end-to-end tests, because component tests also need the bundler options and framework test import. In CI, run component tests on every commit as a fast job and end-to-end tests later or in parallel. Shared settings like reporters can live in a common module both configs import.
33

Parallel tests create users with the same email and fail with 'already exists'. How do you fix it?

Save to ▾
Show answer
Generate unique data per test, for example by adding testInfo.testId, the parallel index or a random suffix to the email, or by using a data builder that creates a fresh user through the API. Avoid hard-coded shared records in test files. Clean up created users in a fixture teardown so the database does not fill up over time.
34

What is a Promise and what states can it have?

Save to ▾
Show answer
A Promise represents a value that will be available later, such as an API response. It is pending at first, then either fulfilled with a value or rejected with an error, and it never changes after that. You consume it with await or then and catch. Almost every Playwright call returns a Promise, which is why tests use await so much.
35

What is a locator in Playwright?

Save to ▾
Show answer
An object describing how to find an element, re-evaluated on every action so it always targets the current DOM.
36

Tell me about a bug you found through API testing that UI tests missed.

Save to ▾
Show answer
Situation: the UI hid a delete button for normal users, so UI tests passed. Task: check permissions properly. Action: I called the delete endpoint directly with a normal user's token and it returned 204. Result: the team fixed the server-side permission check, and I added role-based API tests for every admin endpoint.
37

What does a Playwright trace contain?

Save to ▾
Show answer
A trace contains every action with its timing, DOM snapshots before and after each action, screenshots in a filmstrip, console messages, network requests with headers and bodies, the source line of each step and the error. Because the DOM snapshots are real, you can inspect elements after the run. It is usually the fastest way to understand a CI failure.
38

How do you handle authentication to avoid logging in every test?

Save to ▾
Show answer
Log in once in a setup project, save storageState to a file and reuse it in other projects or tests.
39

What do toHaveAccessibleName and toHaveAccessibleDescription check?

Save to ▾
Show answer
They assert the name and description that assistive technology computes for an element, using the accessibility tree rather than raw attributes. The name may come from a label, aria-label, aria-labelledby or inner text, and the description often from aria-describedby. For example an icon-only close button should have the name Close. These checks catch problems that a plain text assertion would miss.
40

How do you write data-driven API tests with many inputs?

Save to ▾
Show answer
const cases = [ { email: '', status: 400 }, { email: 'bad', status: 400 }, { email: 'ok@test.in', status: 201 }, ]; for (const c of cases) { test(`signup with '${c.email}'`, async ({ request }) => { const res = await request.post('/api/signup', { data: { email: c.email } }); expect(res.status()).toBe(c.status); }); }

Consulting companies (13)

Consulting

Accenture

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Hyderabad, Pune +2

View questions
Consulting

Deloitte

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Hyderabad, Bengaluru, Mumbai +2

View questions
Consulting

EY

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Kolkata, Gurugram +2

View questions
Consulting

KPMG

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Bengaluru, Mumbai +2

View questions
Consulting

PwC

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Kolkata, Bengaluru, Mumbai +2

View questions
Consulting

Publicis Sapient

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Gurugram, Noida, Bengaluru

View questions
Consulting

Thoughtworks

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Pune, Bengaluru, Chennai +2

View questions
Consulting

ZS Associates

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Pune, Gurugram, Bengaluru

View questions
Consulting

McKinsey & Company

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Mumbai, Bengaluru +1

View questions
Consulting

Boston Consulting Group

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Mumbai, New Delhi, Bengaluru +1

View questions
Consulting

Bain & Company

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Mumbai, Bengaluru

View questions
Consulting

Grant Thornton Bharat

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Mumbai, Bengaluru +3

View questions
Consulting

Protiviti

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Mumbai, Bengaluru +1

View questions

Frequently asked questions

How are Playwright Testing interviews at consulting companies different?

Consulting firms look for people who can structure messy business problems and explain them simply to clients. Expect case and guesstimate questions, data interpretation, and questions on how you handled stakeholders, along with the technical skills for the role.

Which consulting companies are covered?

This page links to 13 consulting companies, including Accenture, Deloitte, EY, KPMG, PwC, Publicis Sapient, Thoughtworks, ZS Associates. Each has its own page with rounds and a separate practice set.

What rounds should I expect?

Common rounds at these companies include: Technical interview; Partner or HR round; Managerial round; Online assessment (aptitude + technical); HR round. The exact process varies by company and role.