P0 / P1 · Chapter 14 / 15
Senior interview Q&A
The 60-second cheat sheet#
Answer in layers: define the concept, give a condition-based choice, show how it works, then name the failure mode and evidence. The bank below covers both automation roles. Each answer contains practical points, a pitfall and a link to the full chapter. Practice saying the short answer before opening it.
Top 25 highest-likelihood questions#
The following shortlist prioritizes the recruiter's Playwright/TypeScript focus and the supplied mock-interview gaps. It is a preparation judgment, not a prediction of actual EPAM questions.
- When should you use Promise.all?
- Does Promise.all cancel other requests?
- Does TypeScript validate JSON?
- How do you group API results by status?
- Is getByRole itself a wait?
- What does click wait for?
- Why prefer toHaveText over innerText plus toBe?
- Why register waitForResponse before clicking?
- How should a response predicate match?
- Does goto prove the app is ready?
- Does page.route mock request.get?
- What does strict locator failure mean?
- What belongs in a Page Object?
- What does await use mean?
- Can a worker fixture use request fixture?
- Does worker scope mean once globally?
- What does storageState contain?
- Why can saved state expire?
- parallelIndex versus workerIndex?
- 401 versus 403?
- How do you find the latest row per user?
- How do you prevent SQL injection?
- What artifacts should be retained?
- How do you prevent invented endpoints?
- What is a mutation kill?
TypeScript / async#
What does async return?
- Always a Promise, including Promise<void>.
- A thrown error becomes rejection; await obtains fulfillment or throws.
Pitfall: Assuming an async function returns its bare value synchronously.
Why can response.status fail after request.get?
- request.get returns Promise<APIResponse>.
- Await it first; status() is synchronous and json() must be awaited.
Pitfall: Confusing response, Promise and parsed body.
When should you use Promise.all?
- Independent operations that can safely overlap.
- Results follow input order; assert each HTTP response.
Pitfall: Concurrent dependent POST and GET.
Does Promise.all cancel other requests?
- No.
- It rejects on a rejected input but remaining operations continue; partial side effects may exist.
Pitfall: Treating rejection as transaction rollback.
When is allSettled better?
- When every outcome matters for reporting or independent cleanup.
- Inspect each status and explicitly fail required operations.
Pitfall: Returning a successful test despite rejected required work.
Why is async forEach dangerous?
- forEach ignores returned callback Promises.
- Use for-of for sequence or Promise.all(map) for independent bounded concurrency.
Pitfall: Awaiting forEach itself.
Does TypeScript validate JSON?
- No, types are erased.
- Parse unknown with a runtime guard or an optional schema library.
Pitfall: Using `as User` as proof of schema.
unknown versus any?
- unknown requires narrowing before use.
- any disables checking and propagates unsafe assumptions.
Pitfall: Casting everything to any to silence compiler errors.
const versus immutability?
- const prevents rebinding, not object mutation.
- Spread is shallow; copy nested values when isolation requires it.
Pitfall: Sharing nested fixture data accidentally.
What does await do to the event loop?
- It suspends that async function.
- Other queued work can run; Promise continuations are microtasks after the current stack.
Pitfall: Claiming await blocks the whole Node process.
Why use try/finally?
- To attempt cleanup on success or failure.
- Preserve the primary error and record secondary cleanup failure.
Pitfall: Assuming finally guarantees deletion during service outage.
How do you group API results by status?
- Use a Map from status to array; iterate once for expected O(n) time and O(n) output space.
- Define handling for malformed input.
Pitfall: Using default lexical sort for numeric ordering.
Playwright locators / waits / network#
Is getByRole itself a wait?
- It creates a Locator.
- Actions perform their checks; web-first assertions retry expected state.
Pitfall: Treating locator construction as success evidence.
What does click wait for?
- Unique target and applicable actionability checks such as visible, stable, enabled and receiving events.
- Business completion still needs assertion.
Pitfall: A successful click proves a saved record.
Why prefer toHaveText over innerText plus toBe?
- toHaveText rereads and retries a live locator.
- innerText returns a single snapshot before a generic comparison.
Pitfall: Thinking any expect automatically retries browser state.
Why register waitForResponse before clicking?
- A fast response may arrive during the click.
- Create the promise first, trigger action, await response and assert status.
Pitfall: Listening after the event already occurred.
How should a response predicate match?
- Use method, exact path and relevant identity/correlation.
- Assert status afterward when failures need immediate evidence.
Pitfall: Broad substring matches an unrelated request.
Does goto prove the app is ready?
- It normally waits for load.
- Asynchronous application and backend state need explicit readiness checks.
Pitfall: Using page load as a Kafka completion signal.
Does page.route mock request.get?
- No.
- It intercepts matching browser requests, not direct APIRequestContext calls.
Pitfall: Calling a mocked UI test real backend coverage.
When use a test ID over role?
- Use role/label for stable user semantics, test ID for an explicit testing contract where semantics are ambiguous.
- Stable CSS IDs can also be appropriate.
Pitfall: Blanket bans on every CSS selector.
What does strict locator failure mean?
- An operation needing one element matched multiple.
- Scope to the intended entity or accessible name.
Pitfall: Blindly adding first() and clicking a wrong record.
How do you handle popup/download races?
- Register waitForEvent first, trigger action, then await the event.
- Assert popup target or download metadata/content as required.
Pitfall: Waiting only after clicking.
expect.poll versus expect.toPass?
- poll retries a returned observation; toPass retries a whole assertion block.
- Use explicit budgets and keep repeated code side-effect safe.
Pitfall: Putting non-idempotent writes inside the retried block.
What timeout should you increase?
- Only the operation whose legitimate latency is demonstrated.
- Fit assertion/action/navigation budgets within test budget.
Pitfall: Globally increasing everything to mask shared-state errors.
What does a browser mock prove?
- Frontend behavior for the supplied contract response.
- Real service correctness needs separate integration evidence.
Pitfall: Passing a mocked VERIFIED response as proof of backend verification.
What does Playwright Test add beyond a browser library?
- Runner, fixtures, projects, workers, assertions, retries and reporters.
- Browser contexts/pages are test-scoped by default.
Pitfall: Writing an unmanaged script and assuming runner isolation/reporting.
POM / fixtures / auth / parallelism#
What belongs in a Page Object?
- Stable locators and semantic page actions.
- Keep business intent/outcome assertions visible in tests unless a cohesive page-specific helper helps.
Pitfall: A giant page class owning DB, Jira and every workflow.
Fixtures versus beforeEach?
- Hooks suit local common setup.
- Fixtures compose typed lazy dependencies with reusable lifecycle and teardown.
Pitfall: Abstracting one trivial navigation into many layers.
What does await use mean?
- Setup before it; dependent test/fixtures execute at the yield boundary; teardown afterward.
- Dependencies set up first and tear down last.
Pitfall: Placing cleanup only on the happy path.
Can a worker fixture use request fixture?
- Not the test-scoped request fixture.
- Create and dispose a separate APIRequestContext for worker lifetime.
Pitfall: A long-lived fixture depending on shorter-lived page/request.
Does worker scope mean once globally?
- No, once per worker lifetime.
- Different shards/jobs have workers and failures may restart them.
Pitfall: One account allocated once for every CI process.
Is test.extend class inheritance?
- No.
- It builds a test API with typed resource dependencies and lifecycle.
Pitfall: Explaining fixture composition as an OOP subclass.
What does storageState contain?
- Cookies/localStorage; IndexedDB opt-in where supported.
- sessionStorage is not automatically persisted.
Pitfall: Assuming it captures every browser or server state.
Why can saved state expire?
- Backend TTL, revocation, password change or single-session policy can invalidate it.
- Re-authenticate/refresh through real protocol.
Pitfall: Rewriting identical expired JSON.
Why do four shards with one account fail?
- Later logins may revoke earlier sessions or writes collide.
- Use independent leased/provisioned accounts across jobs and pipelines.
Pitfall: Treating browser-context isolation as account isolation.
When do tests need unique accounts?
- When mutations, password changes or session policy can interfere.
- Worker sharing is acceptable only with compatible state and ownership.
Pitfall: Sharing a destructive-test account with later read tests.
parallelIndex versus workerIndex?
- parallelIndex is worker slot stable across replacement; workerIndex identifies a process within run.
- Neither is globally unique across jobs.
Pitfall: Using a worker number alone as global account key.
API factory versus UI setup?
- API factory is fast for test preconditions.
- UI setup remains when that interaction itself is under test.
Pitfall: Removing all real login/create coverage.
API / SQL / Kafka / integration#
What is the API testing checklist?
- Assert exact status, runtime body and business effects.
- Cover boundaries, permissions, invalid state, concurrency and cleanup.
Pitfall: Only checking response.ok().
401 versus 403?
- 401 usually means absent/invalid authentication; 403 means authenticated/identified but forbidden under policy.
- Check resource-concealment rules.
Pitfall: Testing only token presence and calling authorization covered.
Is POST idempotent?
- Not inherently.
- An enforced backend idempotency contract can make a particular submission safely repeatable.
Pitfall: Assuming a header name alone prevents duplicates.
How do you test POST then GET?
- Await creation, validate returned ID, fetch that resource and assert contents
- own cleanup.
Pitfall: Hard-coded IDs or concurrent dependent calls.
What if a payment request times out?
- Outcome is unknown.
- Query by operation/correlation identity before replay; use only documented enforced idempotency in sandbox.
Pitfall: Assuming timeout means no charge happened.
What does HTTP 202 prove?
- Acceptance according to contract, not final outcome.
- Poll the operation/status endpoint to a terminal business state.
Pitfall: Equating HTTP code with VERIFIED status field.
How do you test Kafka duplicates?
- Send controlled duplicate business/event identity and verify one logical DB/audit/ledger effect.
- Include restart boundary when relevant.
Pitfall: Assuming delivery semantics guarantee all external effects once.
Is Kafka globally ordered?
- Ordering depends on partition/key and configuration.
- Specify the exact ordering/version contract and test out-of-order handling.
Pitfall: Expecting global order across unrelated partitions.
How do you reconcile source and target?
- Compare keys both directions
- duplicates, values and compatible grouped totals with a stable watermark/snapshot.
Pitfall: Equal counts imply identical records.
Why can LEFT JOIN lose unmatched rows?
- A right-side condition in WHERE can reject NULL extended rows.
- Put intended match restrictions in ON or handle NULL explicitly.
Pitfall: Accidentally turning the outer join into inner behavior.
How do you find the latest row per user?
- ROW_NUMBER partitioned by user ordered by timestamp DESC plus deterministic ID tie-breaker
- select rn=1.
Pitfall: MAX(timestamp) alone returns no associated coherent row.
How do you prevent SQL injection?
- Parameterized driver query with bound values, approved read-only access and bounded queries.
- Identifiers need allowlisting rather than value placeholders.
Pitfall: Concatenating an untrusted user ID into SQL.
CI / debugging / architecture#
Does allow_failure true block merge?
- The job may fail while pipeline succeeds.
- Critical checks need false and project settings requiring successful pipelines.
Pitfall: Thinking job YAML alone enforces every merge policy.
Shards versus workers?
- Shards partition across runs/jobs; workers execute within each run.
- Four by four gives up to sixteen slots.
Pitfall: Allocating accounts only for four total processes.
How should CI install Playwright?
- npm ci from lockfile plus matching browser installation, or approved version-matched official image.
- Keep OS/browser/package compatible.
Pitfall: Fake image tags or stale cached browsers.
What artifacts should be retained?
- Sanitized HTML/JUnit
- traces/screenshots when useful, always-on-failure availability with restricted access and expiry.
Pitfall: Publishing auth state or token-bearing traces broadly.
Why do retries not fix flakes?
- They repeat execution but leave root cause.
- They can also duplicate non-idempotent effects.
Pitfall: Reporting a recovered retry as proven reliability.
What is your first CI-only failure action?
- Preserve exact command/environment/data and evidence.
- Compare trace/network/logs and form hypotheses.
Pitfall: Changing many timeouts before collecting evidence.
What can Trace Viewer show?
- Action timeline, DOM snapshots and network context.
- Link backend events through separate correlation logs.
Pitfall: Assuming trace automatically contains all Kafka/DB evidence.
How do you classify a timeout?
- Distinguish product, test, environment, data and timing.
- Check which observable condition never occurred and why.
Pitfall: Every timeout is a slow server.
How do you reduce a 60-minute UI suite?
- Map risk/coverage
- remove true redundancy, move business combinations lower, use API setup, fix flakes, then shard/tune.
Pitfall: Parallelizing shared-state failures.
Pyramid or trophy?
- Both are heuristics.
- Choose lowest layer proving the risk, retain deployed integration/E2E where needed.
Pitfall: Enforcing fixed percentages regardless of architecture.
How do you quarantine responsibly?
- Issue
- owner, expiry, explicit missing coverage/risk acceptance and replacement checks/manual evidence.
Pitfall: test.skip as a permanent hidden repair.
What framework quality criteria matter?
- Readable intent
- cohesive boundaries, single-test execution, isolation, diagnostic evidence, secure configuration and reasonable maintenance.
Pitfall: More abstractions automatically mean better design.
AI agents / MCP / evals#
What is MCP?
- A protocol for AI applications and servers exposing supported tools/resources/prompts.
- It is not itself the agent or project rules.
Pitfall: Calling MCP a model or autonomous orchestrator.
Skills/Powers versus AGENTS.md?
- Skills/Powers package procedures and potentially scripts/tools where platform supports them.
- AGENTS.md directs project behavior with conditional rules.
Pitfall: Reducing executable capabilities to cosmetic prompts.
What does an agentic workflow change?
- The model selects tools, observes results and adapts actions.
- A deterministic pipeline follows predefined steps.
Pitfall: Assuming autonomy removes the need for permission boundaries.
How do you prevent invented endpoints?
- Conditional rule to inspect actual OpenAPI/repo, verified context tools, runtime contract checks and reviewer evidence.
- Block unresolved work.
Pitfall: Claiming instructions mathematically eliminate hallucination.
Why not one agent per tool?
- Tools are capabilities, agents are decision contexts.
- Use a simple agent plus CI unless separable tasks justify coordination.
Pitfall: More agents guarantee higher quality.
How do you handle prompt injection from Jira?
- Treat retrieved text as untrusted task data, preserve governing instructions and restrict tool/environment permissions.
- Validate changes before review.
Pitfall: Allowing a ticket to authorize production writes.
How do you evaluate generated tests?
- Versioned reviewed dataset
- compile/run, criterion mapping, assertion strength, fault detection, flakiness, cost and review effort.
Pitfall: CI pass rate alone.
What is a mutation kill?
- A valid controlled defect makes the intended generated test fail for the relevant behavior.
- Exclude equivalent/unexercised mutants with evidence.
Pitfall: Counting unrelated setup crash as meaningful detection.
Agent A passes more but covers less: which wins?
- Classify failures and missing risks, compare detection/review cost under same conditions.
- A failure can expose a real product bug.
Pitfall: Automatically choosing 95 passes over 85.
Can an LLM judge be sole authority?
- No.
- Calibrate a rubric and sample disagreements; deterministic checks prove executable facts and humans assess domain meaning.
Pitfall: The judge shares the generator's blind spots.
When is LangGraph justified?
- Use explicit graph orchestration for resumable state, branching or governance.
- Prefer a simple agent or deterministic pipeline when coordination adds little value.
Pitfall: Adding a framework before identifying control-flow needs.
What must a generated MR report include?
- Changed criteria/scenarios, actual commands and results, evidence links and unresolved risks.
- Keep human review before protected merge.
Pitfall: Reporting tests as passed without executed evidence.
How can a custom Skill enforce verification?
- It can include executable branch/environment checks, repository inspection and validation commands.
- Combine those capabilities with constrained permissions and CI enforcement.
Pitfall: Assuming the Skill name alone proves it ran correctly.
Do project rules guarantee zero hallucinations?
- No.
- Verified context, conditional rules, scoped tools, typecheck, tests and review substantially reduce risk but do not eliminate all errors.
Pitfall: Dismissing useful preventive rules because they are not mathematical guarantees.
Senior behavior / strategy#
How do you prioritize under deadline?
- Rank business/regulatory impact, likelihood/change and critical journeys.
- Negotiate scope and report residual risk with owner.
Pitfall: Claiming all testing is complete after smoke passes.
How do you disagree with a developer?
- Share requirement and reproducible evidence
- listen to their hypothesis, agree a discriminating experiment and document outcome.
Pitfall: Arguing from job title instead of evidence.
How do you mentor?
- Use a real skill gap
- pair on a concrete example, explain reasoning, then let them complete and explain the next task.
Pitfall: Invented productivity percentages.
What makes you Senior versus Lead?
- Senior owns dependable technical delivery and diagnosis; Lead often coordinates strategy/people.
- Give grounded Frame.so scope and personal contributions.
Pitfall: Unproven architect or team-size claims.
How much Playwright experience do you claim?
- State actual backoffice use and distinguish earlier Python automation
- broad QA tenure and current preparation.
Pitfall: Turning 2018 QA start into continuous Playwright years.
Why AI QA?
- Ground it in AI feature testing and tool familiarity
- then describe a proposed governed agent/eval workflow.
Pitfall: Presenting proposed architecture as deployed achievement.
What is useful requirements traceability?
- Jira criterion to TestRail scenario/test ID to CI run to defect
- with coverage gaps explicit.
Pitfall: A green CI badge equals all business requirements covered.
How do you own a mistake?
- Use a genuine example
- disclose promptly, contain consequences, fix and describe prevention with true outcome.
Pitfall: A fictional flawless story disguised as a weakness.
Additional worked interview scenarios#
Code calls request.get then status without await: fix it.
- Await request.get first, then inspect synchronous status and await json.
- Let failures reach the runner.
Pitfall: Silencing TypeScript with any.
Save sometimes times out on a very fast API: investigate.
- Trace event ordering
- register response promise before click, match method/path and inspect status.
Pitfall: Adding more waitForResponse timeout after missing the event.
Worker fixture takes page and fails: redesign.
- Worker resources cannot depend on test page
- use separate request context or test-scoped fixture.
Pitfall: Making everything global to avoid the error.
An assertion fails before delete runs: what changes?
- Move owned cleanup into finally/fixture teardown
- preserve original and cleanup diagnostics.
Pitfall: Assuming cleanup succeeds whenever finally executes.
API returns 202 but test claims VERIFIED: review it.
- 202 is acceptance
- poll status to terminal state, assert VERIFIED and corresponding effects.
Pitfall: Changing expected HTTP code to business status string.
Mocked UI passes while live API is broken: explain.
- The test only proved rendering against synthetic response
- add real contract/integration evidence.
Pitfall: Removing mocks everywhere rather than defining separate layers.
Optional critical smoke job fails but MR is green: fix policy.
- Set critical allow_failure false
- require successful pipeline in project merge rules and verify the relevant MR pipeline.
Pitfall: Changing the report color instead of enforcement.
A suite has 30 flaky UI checks: first investment?
- Classify failures and map coverage
- repair synchronization/data, lower redundant tests, then parallelize.
Pitfall: Retrying every failure five times.
Saved JSON exists but user is logged out: why?
- Check backend expiry/revocation
- regenerate via real login or supported refresh, verify auth outcome.
Pitfall: File existence means session valid.
New shard login logs out earlier shard: fix it.
- Single-active-session collision
- allocate independent identities across shards/workers/pipelines.
Pitfall: Separate files alone solve server account policy.
Password test breaks later read tests: isolate it.
- Dedicated per-test account and lifecycle
- password changes can revoke shared sessions permanently.
Pitfall: Restoring only browser cookies.
Agent has high pass rate but checks only headings: evaluate.
- Map assertions to criteria and inject wrong business state in sandbox
- meaningful success test must fail.
Pitfall: Counting assertion quantity instead of relevance.
An AI test uses a nonexistent endpoint: what prevents recurrence?
- Verify source contract
- record evidence, add conditional project rule, enforce validation and review.
Pitfall: A blanket guarantee that better prompting eliminates risk.
Payment POST times out after possible commit: next step?
- Reconcile by supported correlation/key before any replay
- respect enforced deduplication contract.
Pitfall: Automatic generic retry of financial writes.
SQL totals double after joining events: diagnose.
- One-to-many fanout changes grain
- aggregate at intended grain before joining or use EXISTS.
Pitfall: DISTINCT blindly hiding a broken financial query.
Interview delivery#
30 seconds: State the concept and decision rule, then one concrete failure mode. 90 seconds: Add contract assumptions, code sequence, alternatives, isolation, validation and residual risk. Practice the top 25 aloud; revisit linked chapters when reasoning is uncertain.
Memory hook: define → decide → demonstrate → diagnose.
Official references and related topics#
Optional online further reading; all core study material is included above.