Skip to content

American Express Playwright Testing Interview Questions & Answers

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

About American Express hiring for Playwright Testing roles

American Express is a global payments and card company offering charge and credit cards, travel services and merchant acquiring. Its India centres in Gurugram and Bengaluru support technology, risk, analytics and servicing. It hires for software engineers, QA engineers, data analysts, data scientists and credit risk analysts.

For Playwright Testing roles, this American Express practice set focuses most on API Testing (7), Network Mocking (4), Debugging and Trace Viewer (4), Parallel Runs, Sharding & Reporting (4). It has 5 easy, 35 medium questions, so you can start easy and work up to the harder ones.

Company type
Banking & finance
Headquarters
New York, USA
Main India offices
Gurugram, Bengaluru

American Express Playwright Testing interview process

  1. Online assessment (aptitude + coding or analytics)
  2. Technical round
  3. Case or domain round
  4. Hiring manager round
  5. HR round

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

Solved for American ExpressStart 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

When should you choose a component test over an end-to-end test?

Save to ▾
Show answer
Choose a component test when the behaviour lives inside one component: validation messages, disabled states, sorting in a table, keyboard handling in a dropdown or rendering of edge-case data. These are slow and awkward to reach through full flows. Choose end-to-end when the risk is in integration, such as routing, authentication or data saved on the server.
02

How does this behave in arrow functions compared with regular functions?

Save to ▾
Show answer
A regular function gets this from how it is called, so passing a class method as a callback can lose this. An arrow function has no own this and uses the value from the surrounding code. In page objects, arrow functions in callbacks such as map keep access to this.page, which avoids undefined errors.
03

How do you test API error scenarios?

Save to ▾
Show answer
Send invalid payloads or missing auth and assert 400, 401 or 404 codes and the error message bodies.
04

How do you perform drag and drop and hover?

Save to ▾
Show answer
locator.hover() and locator.dragTo(target) perform these actions, with auto-waiting for actionability.
05

Why can beforeAll run more than once in a Playwright run?

Save to ▾
Show answer
Each worker is a separate process with its own state. When tests from a file are split across workers, or a worker restarts after a failure, beforeAll runs again in the new worker. So never assume it runs only once globally. For one-time setup across the whole run, use a setup project with dependencies or globalSetup.
06

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

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

How do you reproduce a flaky test locally?

Save to ▾
Show answer
Run it many times in isolation: npx playwright test cart.spec.ts -g 'apply coupon' --repeat-each=30 --workers=4 --trace=on. Repeating it with several workers creates the timing pressure CI has. Add --retries=0 so failures are not hidden. Once it fails, open the trace for that run and compare it with a passing run.
10

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

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

A toast message disappears after two seconds and the assertion on it is flaky. How do you test it reliably?

Save to ▾
Show answer
Assert immediately after the action that triggers it, using a web-first assertion like toBeVisible and toHaveText, which start checking at once. Do not add sleeps before the check. If the toast is still missed, control time with page.clock so it does not auto-hide, or verify the result through the data it confirms, such as the saved record.
13

What are projects in playwright.config?

Save to ▾
Show answer
Named configurations that run the same tests across different browsers, devices or environments.
14

How do you handle secrets such as passwords and tokens in CI?

Save to ▾
Show answer
Store them in the CI system's secret store and pass them as environment variables, never in the repository or config files. Read them through process.env and fail fast if they are missing. Use dedicated test accounts with limited rights. Avoid printing them in logs, and make sure traces and screenshots do not expose them in reports.
15
Save to ▾
Show answer
npx playwright codegen records user actions and generates test code with suggested locators, handy for starting tests.
16

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

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.
18
Save to ▾
Show answer
--repeat-each=N runs every selected test N times in the same run, spread across workers. It is useful for checking a new or fixed test for flakiness before merging, for example npx playwright test checkout.spec.ts --repeat-each=20. Combined with several workers it also surfaces tests that collide with each other over shared data.
19

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

Why should you start waitForResponse before the action that triggers it?

Save to ▾
Show answer
If you click first and then wait, the response may already have arrived, so the wait misses it and times out. Create the promise first, then act, then await it: const resp = page.waitForResponse('**/api/cart'); await addButton.click(); await resp. waitForRequest works the same way for outgoing requests.
21

How do you mock network requests?

Save to ▾
Show answer
page.route('**/api/items', route => route.fulfill({ json: [...] })) intercepts and replies with test data; route.abort() simulates failures.
22

CI fails with an error saying the browser executable does not exist. How do you fix it?

Save to ▾
Show answer
The browsers are not installed on the CI machine. Add a step that runs npx playwright install --with-deps after npm ci, which downloads the browsers and the OS libraries they need. Or run inside the official Playwright Docker image that matches your Playwright version. Cache browsers to speed this step up.
23

Visual tests pass on developers' laptops but fail in CI with tiny font differences. Why, and how do you fix it?

Save to ▾
Show answer
Font rendering, anti-aliasing and installed fonts differ between Windows, macOS and Linux, so the same page produces slightly different pixels. The fix is to generate and compare baselines in one fixed environment, usually the official Playwright Docker image used in CI. Developers update baselines by running that container locally or through a CI job, not from their own machines. Loosening thresholds should be the last resort.
24

How do you take screenshots and videos?

Save to ▾
Show answer
page.screenshot() for captures and config options use: { screenshot: 'only-on-failure', video: 'retain-on-failure' } for automatic evidence.
25

What can automated accessibility tools not catch?

Save to ▾
Show answer
Scanners like axe find rule-based problems such as missing labels, bad contrast or invalid ARIA, which is roughly a third to a half of real issues. They cannot judge whether alt text is meaningful, whether focus order makes sense, whether error messages are understandable, or whether a screen reader user can actually finish the task. So automated scans are combined with keyboard tests and periodic manual checks with screen readers.
26

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

interface vs type in TypeScript?

Save to ▾
Show answer
Both describe object shapes. Interfaces can be extended and merged; type aliases can also describe unions and primitives. Use interfaces for page or test-data shapes, types for unions.
28

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

What are automatic fixtures?

Save to ▾
Show answer
A fixture defined with { auto: true } runs for every test even when the test does not ask for it. It is useful for cross-cutting work such as attaching console logs on failure, setting a feature flag or checking for leftover data. Keep auto fixtures light, because they add cost to every test in the suite.
30

A third-party analytics script makes tests slow and flaky. What do you do?

Save to ▾
Show answer
Block it in tests with context.route on its domain and route.abort, or fulfill it with an empty script. Analytics is not what you are testing, and blocking it removes delays and random network errors. If tracking events matter, write a few separate tests that capture the requests with waitForRequest and assert their parameters.
31

How do you test file upload via API?

Save to ▾
Show answer
Use request.post with multipart: { file: { name, mimeType, buffer } } and assert the response and stored file details.
32

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

Write a test that updates a user with PUT and verifies the change.

Save to ▾
Show answer
test('update user', async ({ request }) => { const res = await request.put('/api/users/12', { data: { name: 'Neha', city: 'Jaipur' }, }); expect(res.status()).toBe(200); const get = await request.get('/api/users/12'); expect(await get.json()).toMatchObject({ name: 'Neha', city: 'Jaipur' }); });
34

CI runners have 2 CPU cores and workers is set to 8. Tests start timing out randomly. Why?

Save to ▾
Show answer
Eight browsers compete for two cores and limited memory, so pages render slowly, actions hit timeouts and the app under test may also be overloaded. More workers than cores rarely helps. Set workers to match the runner, such as 2, and scale out with shards on more machines instead. Watch CPU and memory metrics in CI to confirm.
35

Write an API test with the request fixture.

Save to ▾
Show answer
test('get user', async ({ request }) => { const res = await request.get('/api/users/1'); expect(res.ok()).toBeTruthy(); expect((await res.json()).id).toBe(1); });
36

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

What is the difference between API testing and UI testing?

Save to ▾
Show answer
API testing checks services directly and is fast and stable; UI testing checks the full user experience in the browser and is slower.
38

How do you test the difference between 401 and 403 responses?

Save to ▾
Show answer
401 Unauthorized means the caller is not authenticated, such as a missing or expired token. 403 Forbidden means the caller is known but lacks permission. Test 401 by calling without a token or with an invalid one. Test 403 by calling an admin endpoint with a normal user's token. Assert the status and that no data leaks in the body.
39

What happens before and after await use() in a fixture?

Save to ▾
Show answer
Code before await use(value) is setup and runs before the test. use hands the value to the test and waits while the test runs. Code after it is teardown and runs when the test finishes, even if it failed. This keeps setup and cleanup for one resource in one place, which is cleaner than a separate beforeEach and afterEach pair.
40

How do you handle file uploads and downloads?

Save to ▾
Show answer
setInputFiles on the input for uploads; for downloads wait on page.waitForEvent('download') and save or inspect the file.

Tips to crack the American Express Playwright Testing interview

  • Learn credit card business basics like spend, revolve, delinquency and customer lifetime value for analytics interviews.
  • Practise SQL, Python and statistics, including model evaluation for risk or marketing use cases.
  • Read about American Express's Blue Box values and its strong focus on customer service.
  • 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; American Express interviewers usually ask follow-ups on your first answer.

Frequently asked questions

How many rounds are there in the American Express Playwright Testing interview?

Candidates usually go through 5 stages: Online assessment (aptitude + coding or analytics); Technical round; Case or domain round; Hiring manager 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 American Express Playwright Testing interview?

This practice set leans on API Testing (7), Network Mocking (4), Debugging and Trace Viewer (4), Parallel Runs, Sharding & Reporting (4). Revise those first, then practise explaining one or two of your own projects end to end, because most American Express interviewers ask you to walk through real work.

Are these the exact questions asked at American Express?

No. These are curated practice questions that match the skills and difficulty usually tested in banking & finance interviews like American Express's. They are not a leaked or verified list of past questions.

Where does American Express hire Playwright Testing professionals in India?

American Express has large teams in Gurugram, Bengaluru. Openings and locations change often, so check the American Express careers page and filter by city and experience.

Playwright Testing questions for similar companies