Skip to content

Cyient Playwright Testing Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

About Cyient hiring for Playwright Testing roles

Cyient is an Indian engineering and technology solutions company that started in geospatial services and now covers aerospace, rail, communications, medical and utilities engineering. It provides product design, embedded software, network engineering and data services to global manufacturers and operators. In India it hires freshers and experienced engineers for design, software, testing, GIS and analytics roles at its delivery centres.

For Playwright Testing roles, this Cyient practice set focuses most on Playwright Core (9), Framework Design and CI/CD (5), Network Mocking (5), Locators and Assertions (4). It has 18 easy, 20 medium, 2 hard questions, so you can start easy and work up to the harder ones.

Company type
IT services
Headquarters
Hyderabad, India
Main India offices
Hyderabad, Bengaluru, Noida

Cyient Playwright Testing interview process

  1. Online assessment (aptitude + technical MCQs)
  2. Technical interview
  3. Managerial round
  4. HR round

Typical pattern based on public candidate experiences. Rounds vary by role, team and year.

Solved for CyientStart 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 is the Playwright Inspector and how do you open it?

Save to ▾
Show answer
The Inspector is a debug window that lets you step through test actions one by one, see the locator being used and highlight it on the page. Open it with npx playwright test --debug, with PWDEBUG=1, or by calling page.pause(). It runs headed with no timeout, so you can explore the page at each step and edit locators live.
02

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

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

What is the difference between click and dispatchEvent?

Save to ▾
Show answer
click simulates a real user click with actionability checks; dispatchEvent fires a DOM event directly without those checks.
05

Where should Playwright tests run in a delivery pipeline?

Save to ▾
Show answer
Run a fast smoke set on every pull request against a preview or test environment, so feedback arrives in minutes. Run the full regression suite on merge to main or nightly, sharded across machines. After a deploy, run a few read-only production smoke checks. Match the suite size to the stage so pipelines stay fast but coverage is complete.
06

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

How do you test a dropdown component's keyboard support in a component test?

Save to ▾
Show answer
Mount the dropdown, focus the trigger and press Enter or ArrowDown to open it. Assert the listbox is visible and the first option has aria-selected or focus. Press ArrowDown again and check the active option moves, then press Enter and assert the trigger shows the chosen value and the list is closed. Finally press Escape on an open list to confirm it closes without changing the value.
08

What is the difference between the request fixture and request.newContext()?

Save to ▾
Show answer
The request fixture is a ready APIRequestContext that uses the config's baseURL and extraHTTPHeaders and is cleaned up automatically per test. playwright.request.newContext() creates your own context with custom settings, such as a different base URL or auth token, for example in a worker fixture. You must dispose a manually created context yourself.
09

What is locator strictness in Playwright?

Save to ▾
Show answer
Locators are strict: an action such as click or fill throws a strict mode violation if the locator matches more than one element. This prevents a test from silently clicking the wrong item. Fix it by making the locator more specific with a name, filter or chaining. Methods like count(), all() or first() are allowed to work with many matches on purpose.
10

How does visual testing work in Playwright?

Save to ▾
Show answer
await expect(page).toHaveScreenshot('home.png') compares against a baseline image; tune maxDiffPixels and mask dynamic areas like dates.
11

An axe scan reports 40 violations on a legacy page. How do you add accessibility checks without blocking every build?

Save to ▾
Show answer
Record the current violations as a known baseline, for example by snapshotting violation ids and targets, and fail only on new ones. Fix the worst issues first, such as missing labels and contrast on key flows, and shrink the baseline every sprint. Make new pages and components meet zero violations from day one. Report the trend to the team so the debt is visible rather than silently ignored.
12

What are the key options in playwright.config.ts?

Save to ▾
Show answer
Main options are testDir for where tests live, timeout, retries, workers, fullyParallel, reporter, and the use block for shared settings like baseURL, trace, screenshot and video. projects define browsers or setups, and webServer can start the app before tests. Most values can depend on process.env.CI so local and CI runs behave differently.
13

How do you open a trace file?

Save to ▾
Show answer
Download trace.zip from the test results or CI artifact. Run npx playwright show-trace path/to/trace.zip to open it locally, or drag the file into trace.playwright.dev, which processes it in the browser without uploading it. In the HTML report, failed tests with a trace show a trace link you can click directly.
14

How can you apply extra CSS only while a screenshot is taken?

Save to ▾
Show answer
Pass the stylePath option to toHaveScreenshot or set it in the expect.toHaveScreenshot section of the config. The stylesheet is injected just for the capture, so you can hide scrollbars, freeze a carousel, or set visibility hidden on dynamic widgets without changing the app. It is cleaner than adding test-only classes and also works when a mask box would cover too much of the layout.
15

What is the difference between ES modules and CommonJS?

Save to ▾
Show answer
ES modules use import and export and are the modern standard, loaded statically. CommonJS uses require and module.exports and is the older Node.js style. Playwright supports both, and TypeScript test projects usually write import syntax. Mixing them causes errors such as require is not defined, so set type in package.json and tsconfig consistently.
16

How do you handle date pickers and custom dropdowns?

Save to ▾
Show answer
Click to open the control, then use getByRole('option') or a text locator for the target item, instead of relying on fragile index-based selectors.
17

How do you test a file download?

Save to ▾
Show answer
const [download] = await Promise.all([ page.waitForEvent('download'), page.getByText('Export').click(), ]); await download.saveAs('reports/file.csv');
18

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

What does page.route do?

Save to ▾
Show answer
page.route registers a handler for requests whose URL matches a pattern. Inside the handler you can let the request continue, change it, return a fake response or abort it. It lets you test the UI against controlled data without depending on a real backend. Register routes before the action that triggers the request, usually before page.goto.
20

Why are screenshot baselines specific to browser and operating system?

Save to ▾
Show answer
Each browser engine lays out and paints text, shadows and form controls slightly differently, and each operating system has its own fonts and smoothing. A Chromium image on Linux will rarely match WebKit on macOS pixel for pixel. That is why Playwright includes project and platform in the file name and why teams fix one rendering environment for baselines.
21

What does response.ok() check?

Save to ▾
Show answer
response.ok() returns true when the status code is in the 200 to 299 range. It is a quick success check but not enough on its own. Also assert the exact status, such as 201 for a create, and the body content. For a negative test, assert the specific error status like 400 or 404 and the error message.
22

What is the difference between toHaveText and toContainText?

Save to ▾
Show answer
toHaveText checks that the element's full text matches the expected string or regex, after normalising whitespace. toContainText passes if the expected text appears anywhere inside it. Use toHaveText for exact labels like a heading, and toContainText for longer messages where only part matters. Both are web-first assertions, so they retry until the timeout before failing.
23

What is a HAR file?

Save to ▾
Show answer
HAR stands for HTTP Archive. It is a JSON file that records the requests and responses a browser made, including URLs, headers, bodies and timings. Browsers can export one from DevTools, and Playwright can record and replay them. In testing it is used for mocking whole sets of API calls and for sharing network evidence in bug reports.
24

What does fullyParallel change?

Save to ▾
Show answer
By default Playwright runs test files in parallel but tests within one file in order in a single worker. fullyParallel: true lets tests inside a file run in parallel across workers too. It speeds up suites with big files, but every test must be independent. You can also enable it per file with test.describe.configure({ mode: 'parallel' }).
25

How do you block images and fonts to speed up tests?

Save to ▾
Show answer
await page.route(/\.(png|jpe?g|webp|woff2?)$/, route => route.abort()); // or by resource type await page.route('**/*', route => route.request().resourceType() === 'image' ? route.abort() : route.continue() );
26

What is the difference between page.route and context.route?

Save to ▾
Show answer
page.route applies only to requests from that page. context.route applies to every page in the browser context, including pop-ups and new tabs opened later. Use context.route when a flow opens new windows, such as a payment pop-up, or when you set up mocks in a fixture before the page exists. Page routes take priority over context routes.
27

What is the use block in playwright.config?

Save to ▾
Show answer
The use block sets default options for every test, such as baseURL, headless, viewport, locale, trace, screenshot and video. Each project can override them in its own use block, and a file can override again with test.use. This layered setup keeps shared settings in one place while still allowing browser- or file-specific changes.
28

How do you handle shadow DOM?

Save to ▾
Show answer
Playwright locators pierce open shadow roots by default, so getByRole and CSS locators work without special handling.
29

How do you override options like baseURL or viewport for one file?

Save to ▾
Show answer
Call test.use at the top of the file or inside a describe block, for example test.use({ viewport: { width: 375, height: 812 }, locale: 'hi-IN' }). The options apply only to tests in that scope. Options you can set this way include baseURL, storageState, colorScheme and extraHTTPHeaders. Global defaults stay in the use block of playwright.config.
30

How do you handle a new tab?

Save to ▾
Show answer
const [newPage] = await Promise.all([ context.waitForEvent('page'), page.getByText('Open').click(), ]); await newPage.waitForLoadState();
31

What is a worker process in Playwright Test?

Save to ▾
Show answer
A worker is a separate operating system process that runs test files. Each worker starts its own browser, and tests inside a worker run one after another, while different workers run at the same time. Workers do not share memory, so you cannot pass variables between them. Worker-scoped fixtures are created once per worker, which is why expensive setup is often placed there.
32

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

How do you mock network traffic using a HAR file?

Save to ▾
Show answer
Record once with page.routeFromHAR('data/orders.har', { url: '**/api/**', update: true }) while running against a real server. Later runs replay the saved responses from the HAR instead of hitting the backend. You can edit the stored JSON to create edge cases. Re-record when the API changes, otherwise the replay drifts from reality.
34

What is Playwright and which browsers does it support?

Save to ▾
Show answer
An open-source end-to-end testing framework from Microsoft that automates Chromium, Firefox and WebKit through one API, in multiple languages.
35

How do you check a checkbox and verify it is checked?

Save to ▾
Show answer
const terms = page.getByRole('checkbox', { name: 'I agree to the terms' }); await terms.check(); await expect(terms).toBeChecked(); await terms.uncheck(); await expect(terms).not.toBeChecked(); // setChecked(true) works for both cases
36

How do you run a single test or file in Playwright?

Save to ▾
Show answer
npx playwright test tests/login.spec.ts, add -g "test title" to match a name, or use test.only while debugging.
37

How do you keep test code, page objects and utilities organised as a repository grows?

Save to ▾
Show answer
Use a clear layout: tests grouped by feature, a pages folder for page objects, a fixtures folder that exposes them, and api and data folders for helpers and builders. Add path aliases in tsconfig, a lint config with the Playwright plugin, and a short contributing guide. Review new helpers in pull requests so duplicate utilities do not spread.
38

What is the difference between beforeEach and fixtures?

Save to ▾
Show answer
beforeEach runs the same code before every test in scope; fixtures are lazy, composable and only set up what a test uses.
39

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

How do you share cookies between API login and UI?

Save to ▾
Show answer
Log in with request.post, call request.storageState(), and create a browser context using that state.

Tips to crack the Cyient Playwright Testing interview

  • Revise fundamentals of your engineering branch, since Cyient roles often mix domain engineering knowledge with software or data skills.
  • Practise basic programming, SQL queries and simple aptitude problems, which commonly feature in the first screening stage.
  • Learn about Cyient business units such as aerospace, rail and geospatial to explain which area interests you and why.
  • Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
  • Practise the hard questions on this page aloud; Cyient interviewers usually ask follow-ups on your first answer.

Frequently asked questions

How many rounds are there in the Cyient Playwright Testing interview?

Candidates usually go through 4 stages: Online assessment (aptitude + technical MCQs); Technical interview; Managerial round; HR round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.

Which topics should I prepare for the Cyient Playwright Testing interview?

This practice set leans on Playwright Core (9), Framework Design and CI/CD (5), Network Mocking (5), Locators and Assertions (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Cyient interviewers ask you to walk through real work.

Are these the exact questions asked at Cyient?

No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Cyient's. They are not a leaked or verified list of past questions.

Where does Cyient hire Playwright Testing professionals in India?

Cyient has large teams in Hyderabad, Bengaluru, Noida. Openings and locations change often, so check the Cyient careers page and filter by city and experience.

Playwright Testing questions for similar companies