Skip to content

Playwright Testing Interview Questions in Gurgaon

36 practice questions with answers for Playwright Testing interviews in Gurgaon.

Playwright Testing jobs in Gurgaon

Gurgaon (Gurugram) is home to many multinational, consulting, fintech and consumer-internet offices. Interviews often expect strong business understanding along with technical skills, especially for analytics and product-facing roles.

Below are 36 questions that match the mix of service, product and domain employers hiring Playwright automation engineers in Gurgaon.

Solved for GurgaonStart 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

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

Your mocked route never fires. What do you check?

Save to ▾
Show answer
Check that the route is registered before the request is sent, usually before goto. Compare the pattern with the real URL in the trace network tab, including query strings and host. Make sure a service worker is not handling the request, and set serviceWorkers: 'block' if it is. Also check that another handler is not matching first or the route was not removed.
03

How is toBeVisible different from toBeAttached?

Save to ▾
Show answer
toBeAttached only checks that the element exists in the DOM. toBeVisible also needs it to have a non-empty bounding box and no visibility:hidden style. A hidden modal can be attached but not visible. Use toBeVisible for anything a user should see, and toBeAttached for hidden inputs or elements whose presence matters more than appearance.
04

Explain the event loop.

Save to ▾
Show answer
JavaScript runs one call stack and uses queues for async work; the event loop pushes callbacks from the microtask (promises) and task queues when the stack is empty.
05

What is a generic type parameter constraint, such as T extends object?

Save to ▾
Show answer
A constraint limits what types a generic can accept. function pick<T extends object, K extends keyof T>(obj: T, key: K) only accepts objects and keys that exist on them, so pick(user, 'emial') fails at compile time. In test helpers this catches typos in field names and keeps return types precise without using any.
06

How do you rerun only the tests that failed in a sharded CI run?

Save to ▾
Show answer
--last-failed works only on the machine that kept the .last-run.json file, so it does not help across shards. Instead collect the failed tests from the merged JSON report or the blob reports, then run them in a follow-up job by file and line or with --grep on their titles. Many teams simply rely on retries and treat any test needing a rerun as flaky.
07

Why choose Playwright over Selenium?

Save to ▾
Show answer
Auto-waiting, a built-in test runner, Chromium/Firefox/WebKit with one API, network interception, the trace viewer and parallel runs out of the box — usually faster and less flaky.
08

How do you mock third-party APIs in UI tests?

Save to ▾
Show answer
Use page.route to intercept the call and fulfil it with fixed JSON so tests do not depend on external systems.
09

What are the risks of relying on an experimental testing feature in a large codebase?

Save to ▾
Show answer
APIs may change between minor versions, so upgrades can break many tests at once, and documentation or community examples are thinner. To reduce risk, pin versions, wrap mount setup in shared helpers, keep stories simple and read release notes before upgrading. Also keep the end-to-end suite healthy so you are not dependent on one tool for all UI confidence.
10

What do locator.and() and locator.or() do?

Save to ▾
Show answer
and() returns a locator that matches elements satisfying both locators, for example a button that also has a certain title. or() matches either locator, which helps when the UI may show one of two states, such as a New email button or a security dialog. With or(), wrap the assertion carefully, because if both appear the strict check fails.
11

What are the serial and parallel modes of test.describe.configure?

Save to ▾
Show answer
test.describe.configure({ mode: 'serial' }) runs tests in order in one worker, and if one fails the rest are skipped. mode: 'parallel' lets tests in one file run across workers. Serial mode suits a true step-by-step flow, but it makes tests depend on each other, so prefer independent tests and use serial only when there is no alternative.
12

How many workers does Playwright use by default, and how do you change it?

Save to ▾
Show answer
By default Playwright uses about half of the logical CPU cores on the machine. You can set workers in playwright.config as a number or a percentage string such as '50%', or override it on the command line with --workers=4. Many teams use process.env.CI ? 2 : undefined so CI runners with few cores are not overloaded while laptops use their full power.
13

Developers keep changing CSS class names and 40 tests break every sprint. How do you fix this long term?

Save to ▾
Show answer
Replace class-based selectors with role, label and text locators, and agree on data-testid for widgets without good semantics. Move all locators into page objects so future changes touch one file. Add a code review rule and a lint check that flags raw CSS selectors. Share a short locator guide with developers so they know which attributes tests depend on.
14

How do you check colour contrast in Playwright tests?

Save to ▾
Show answer
Playwright has no built-in contrast assertion, so you run axe-core through @axe-core/playwright, whose color-contrast rule checks text against WCAG ratios such as 4.5 to 1 for normal text. Scan pages in each theme, for example after emulating dark mode with colorScheme. Axe may report some elements as needing review, for example text over images, and those need a manual look.
15

Tell me about a time you refactored duplicated setup into fixtures.

Save to ▾
Show answer
Situation: forty test files each repeated twenty lines of login and data setup. Task: reduce duplication and maintenance. Action: I created fixtures for the logged-in page, a test customer and page objects, migrated files in small reviewed pull requests and wrote a short guide. Result: test files became half the size and setup changes now touch one file.
16

Locator vs ElementHandle?

Save to ▾
Show answer
A Locator is lazy, re-resolved on every action and auto-waits (recommended). An ElementHandle points to one DOM node and can go stale.
17

Why is sharing state between tests through module-level variables a bad idea?

Save to ▾
Show answer
Each worker has its own copy of module variables, so values set in one worker are invisible to others, and order changes between runs. Tests that pass alone fail in parallel or after a retry. Pass data through fixtures, or store it in an external source like the API. Each test should be able to run alone, in any order.
18

Why does Playwright start a new worker after a test fails?

Save to ▾
Show answer
A failed test may leave the browser or worker-scoped fixtures in a bad state, such as an open dialog or corrupted login. To protect the remaining tests, Playwright throws that worker away and starts a fresh one for the next tests. This means worker fixtures run again and beforeAll hooks may run more than once, which is normal and something your setup must tolerate.
19

In what order do hooks and fixtures run?

Save to ▾
Show answer
Worker fixtures and beforeAll run first for the worker. For each test, the test fixtures it needs are set up, then beforeEach hooks run, then the test body. Afterwards afterEach hooks run, then test fixtures are torn down in reverse order. afterAll and worker fixture teardown run when the worker finishes. Fixtures are lazy, so unused ones never run.
20

What is testInfo and what can you do with it?

Save to ▾
Show answer
testInfo is passed as the second argument to tests and hooks. It gives the test title, project name, retry number, status and output path. You can attach files, add annotations, change the timeout with testInfo.setTimeout, or skip conditionally. For example, attach extra logs only when testInfo.status differs from testInfo.expectedStatus.
21

One shard finishes in 4 minutes and another takes 15. How do you balance them?

Save to ▾
Show answer
Check whether fullyParallel is off, because file-level sharding puts big files together. Turn it on if tests are independent, or split the largest files. Use reportSlowTests and the merged report's durations to find heavy files, and move slow setup into API calls or shared storage state. Also check that one shard is not getting all the tests of a slow project such as WebKit.
22

How do you install and start a Playwright project?

Save to ▾
Show answer
Run npm init playwright@latest, which sets up config, example tests and browsers; execute with npx playwright test.
23

Your test clicks a button before the page's JavaScript has attached its handler, so nothing happens. What do you do?

Save to ▾
Show answer
This is a hydration problem: the button is visible and enabled but not yet interactive. Wait for a signal that the app is ready, such as a loaded data request or a visible element that only appears after hydration, then click. A better fix is to report it to developers, because real users hit the same issue. Avoid fixed waitForTimeout calls.
24

What are arrow functions?

Save to ▾
Show answer
A short function syntax that does not have its own this and arguments, taking them from the surrounding scope.
25

How do you shard tests across machines?

Save to ▾
Show answer
Use npx playwright test --shard=1/4 in each CI job and merge reports afterwards to reduce total run time.
26

Tell me about a time you automated a difficult UI flow.

Save to ▾
Show answer
Situation: a booking page had a custom calendar, drag-to-select seats and a timer. Task: automate the full booking. Action: I used role locators for the calendar, mouse actions for seat selection and page.clock to control the timer, keeping each part in a page object method. Result: the flow ran reliably in CI and replaced a 20-minute manual check.
27

What is the difference between toHaveScreenshot and toMatchSnapshot?

Save to ▾
Show answer
toHaveScreenshot is for images of a page or locator. It waits for the page to become visually stable, retries the capture until two shots match, and supports options like mask and animations. toMatchSnapshot compares any value you pass in, such as a string, a buffer or text output, against a stored file, without waiting or retrying. Use toHaveScreenshot for UI and toMatchSnapshot for generated text or file content.
28

How do you handle dialogs such as alerts?

Save to ▾
Show answer
Register page.on('dialog', d => d.accept()) before the action triggers the dialog.
29

let vs const vs var?

Save to ▾
Show answer
var is function-scoped and hoisted. let and const are block-scoped; const can't be reassigned (though an object it points to can change). Prefer const, then let.
30

What does npx playwright test --last-failed do?

Save to ▾
Show answer
It reruns only the tests that failed in the previous run, using the results stored in the test-results folder. It saves time while you fix failures locally because you do not rerun the whole suite. Combine it with --headed or --debug to investigate. Run the full suite again before pushing to confirm nothing else broke.
31

How do you test that a modal dialog traps focus and returns it when closed?

Save to ▾
Show answer
Open the dialog with a button and assert the dialog role is visible and focus moved inside it. Press Tab more times than there are controls and check with toBeFocused that focus never leaves the dialog. Press Escape, assert the dialog is hidden, and check that the opening button is focused again. Running the same test with Shift+Tab covers backward navigation as well.
32

How do you attach axe results to the Playwright HTML report?

Save to ▾
Show answer
test('cart is accessible', async ({ page }, testInfo) => { await page.goto('/cart'); const results = await new AxeBuilder({ page }).analyze(); await testInfo.attach('axe-results', { body: JSON.stringify(results.violations, null, 2), contentType: 'application/json', }); expect(results.violations).toEqual([]); });
33

Tell me about a time you introduced component tests to a frontend team.

Save to ▾
Show answer
Situation: our end-to-end suite took 40 minutes and most failures were in form validation. Task: speed up feedback. Action: I set up Playwright component tests for the form library, wrote ten examples and a short guide, and paired with two developers on their first tests. Result: validation checks moved to component level, the end-to-end suite dropped to 25 minutes and developers began writing component tests themselves.
34

What does eslint-plugin-playwright help with?

Save to ▾
Show answer
It is a lint plugin with rules for common Playwright mistakes, such as missing await on assertions, leftover test.only or page.pause, forced clicks, fixed waits with waitForTimeout and element handles instead of locators. Running it in pull requests stops bad patterns before review. Teams usually enable the recommended rule set and add a few stricter rules over time.
35

What does the webServer option do?

Save to ▾
Show answer
webServer tells Playwright to start your app with a command, such as npm run start, and wait until a URL or port responds before running tests. reuseExistingServer: !process.env.CI lets you use an already running dev server locally. You can define several servers, for example frontend and a mock API. It shuts them down after the run.
36

How do you make an API request in Playwright?

Save to ▾
Show answer
Use the request fixture: const res = await request.get('/api/users'); expect(res.ok()).toBeTruthy(); const body = await res.json();

Companies with offices in Gurgaon (51)

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
Product

Amazon

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Bengaluru, Hyderabad, Chennai +2

View questions
Product

Google

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Bengaluru, Hyderabad, Gurugram +2

View questions
Product

Meta

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Gurugram, Bengaluru, Hyderabad +1

View questions
Product

Microsoft

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Hyderabad, Bengaluru, Noida +2

View questions
Hardware & semiconductors

Apple

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Hyderabad, Bengaluru, Mumbai +1

View questions
Product

Adobe

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Noida, Bengaluru, Gurugram

View questions
Product

Salesforce

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Hyderabad, Bengaluru, Mumbai +1

View questions
Product

LinkedIn

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Bengaluru, Gurugram, Mumbai

View questions
Product

Uber

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Bengaluru, Hyderabad, Gurugram

View questions
E-commerce & consumer tech

Walmart

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Bengaluru, Chennai, Gurugram

View questions
E-commerce & consumer tech

Zomato

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram

View questions
Fintech

Mastercard

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Pune, Vadodara, Gurugram +1

View questions
Fintech

DE Shaw

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Hyderabad, Bengaluru, Gurugram

View questions
Fintech

Tower Research Capital

Playwright Testing interview questions

  • 40 questions
  • 5 rounds

Gurugram

View questions
IT services

IBM

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Pune, Hyderabad +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
IT services

Nagarro

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Jaipur

View questions
IT services

EPAM Systems

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Hyderabad, Bengaluru, Pune +2

View questions
IT services

GlobalLogic

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Noida, Bengaluru, Gurugram +2

View questions

Frequently asked questions

Which companies hire Playwright Testing professionals in Gurgaon?

Companies with large offices in Gurgaon include Accenture, Deloitte, Amazon, Google, Meta, Microsoft, Apple, Adobe, Salesforce, LinkedIn. Use their company pages below to practise employer-specific sets.

Are Playwright Testing interviews in Gurgaon different from other cities?

The questions depend more on the company than the city. Gurgaon's mix of employers decides the style: Interviews often expect strong business understanding along with technical skills, especially for analytics and product-facing roles

How do I find Playwright Testing jobs in Gurgaon?

Shortlist companies with Gurgaon offices, keep your CV focused on Playwright Testing projects, apply on company career pages and job portals with the Gurgaon filter, and practise the questions on this page before each interview.