QA Interview
Playwright Component Testing Interview Questions for Angular (2026)
Practice Playwright component testing interview questions Angular engineers face, with precise answers on mounting, signals, routing, mocking, and CI.
23 min read | 4,207 words
TL;DR
Strong candidates distinguish browser-realistic component tests from both TestBed unit tests and full E2E tests. They can configure Playwright CT for Angular, mount components with deliberate dependencies, test signals and outputs through user behavior, and explain debugging and CI trade-offs.
Key Takeaways
- Explain that Playwright Component Testing mounts Angular components in a real browser while keeping the test scope below a full application journey.
- Use the experimental component-test package and a dedicated Playwright CT configuration rather than mixing component and end-to-end projects blindly.
- Pass serializable inputs directly, wrap complex providers and projected content in test components, and assert through accessible DOM behavior.
- Test signal inputs, outputs, routing boundaries, HTTP behavior, and change detection at the narrowest useful integration boundary.
- Diagnose failures with traces, screenshots, focused runs, and ownership-aware selectors before adding timeouts.
- Discuss CI isolation, browser caching, sharding, and component-specific coverage as engineering trade-offs, not slogans.
Playwright component testing interview questions angular teams ask usually probe two abilities: can you test an Angular component in a real browser, and can you choose the right boundary without turning every component check into an end-to-end test? A strong answer connects Playwright's browser automation to Angular inputs, outputs, dependency injection, signals, routing, and rendering.
This guide gives you 48 questions grouped by topic. The answers favor observable behavior, controlled dependencies, and maintainable test design. For broader preparation, pair it with Playwright interview questions and practice explaining each decision aloud in the mock interview workspace.
TL;DR
| Topic | Interview-ready point |
|---|---|
| Test boundary | Mount one component or a small wrapper in a real browser |
| Angular integration | Supply inputs directly and dependencies through deliberate wrappers or configuration |
| Assertions | Prefer role, label, text, and visible state over implementation details |
| Async behavior | Wait on web-first assertions and observable UI outcomes |
| Network | Mock at the browser boundary when the question concerns component behavior |
| CI | Separate CT configuration, cache browsers, retain traces on retry, and shard only when useful |
The key comparison is scope. TestBed unit tests are cheapest for class-level logic, component tests validate browser rendering and interaction, and E2E tests prove deployed application journeys. The best candidate does not claim one layer replaces the others.
1. Playwright Component Testing Interview Questions Angular Fundamentals
Q: What is Playwright Component Testing for Angular?
It mounts an Angular component inside a browser page managed by Playwright Test. The test can interact with the rendered DOM using locators, real input events, browser layout, and web-first assertions without launching the entire product. The Angular adapter supplies the development harness that compiles and mounts the component. Because component testing remains experimental, a mature team pins versions and validates upgrades before rolling them across CI.
Q: How does a component test differ from an end-to-end test?
A component test starts at a selected component boundary and supplies the surrounding state intentionally. An E2E test starts from a running application and crosses real routing, authentication, backend, and integration boundaries. Component tests usually make failures easier to localize and can cover UI states that are expensive to create through the whole system. E2E tests provide stronger confidence that independently built parts work together, so keep a smaller set of critical journeys.
Q: How is Playwright CT different from an Angular TestBed test?
TestBed is Angular's native testing environment and works well for dependency injection, class logic, and Angular-aware fixture control. Playwright CT renders through a real browser and gives you Playwright locators, input fidelity, screenshots, traces, and cross-browser execution. It is especially valuable when CSS, focus, browser events, or accessible semantics matter. Choose based on the risk being tested instead of replacing every TestBed test mechanically.
Q: When should you avoid a component test?
Avoid it for a pure function that can be tested without rendering, because browser startup adds cost without useful confidence. Do not use it to claim that production routing, server deployment, or authentication works when those systems were replaced by test doubles. A component with many global dependencies may first need a wrapper or a clearer boundary. If the defect can occur only across services, write an integration or E2E test at that boundary.
Q: What makes a component test valuable in a test pyramid?
It occupies the middle layer between isolated logic and complete workflows. That position lets it test DOM contracts, accessibility, event wiring, and visual state with fewer unrelated failure sources than E2E. A useful suite concentrates component coverage on behavior-rich widgets such as forms, tables, dialogs, and editors. It does not chase a component-test count as a goal by itself.
2. Playwright Component Testing Interview Questions Angular Setup
Q: Which package starts an Angular component-testing project?
Use the Playwright experimental component-testing package for Angular and let its initializer create the baseline files. Keep the CT config distinct so its dev server and mount fixture do not collide with E2E assumptions. Pin compatible Angular, Playwright, and build-tool versions in the lockfile. The following commands expose the supported initializer and run the resulting suite:
npm init playwright@latest -- --ct
npx playwright test -c playwright-ct.config.ts
Q: What belongs in the component-test configuration?
Define the component test directory, browser projects, reporting, retry policy, and trace behavior there. The exact initializer output can evolve, so preserve its Angular-specific generated integration and add team policy around it. Do not copy an E2E baseURL or webServer automatically, because CT has its own mounting development server. A concise policy layer can look like this:
import { defineConfig, devices } from '@playwright/experimental-ct-angular';
export default defineConfig({
testDir: './src',
testMatch: /.*\.ct\.ts/,
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
reporter: [['html', { open: 'never' }]],
use: { trace: 'on-first-retry' },
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } }
]
});
Verify discovery with npx playwright test -c playwright-ct.config.ts --list.
Q: Why separate .ct.ts from .spec.ts?
A distinct suffix makes ownership, discovery, and CI commands obvious. It prevents component tests from being picked up by a browser project configured for a deployed application. It also lets editors and code reviewers identify the intended harness immediately. The suffix is convention, not magic, so align testMatch with whatever the team chooses.
Q: How do you verify the browser installation?
Run npx playwright install --with-deps in a Linux CI image or npx playwright install on a prepared workstation. Then execute one tiny mount test in Chromium rather than trusting package installation alone. Browser binaries are separate from the npm library and their versions should match the installed Playwright release. Cache them carefully, using the lockfile or package version as part of the cache key.
Q: What would you commit to source control?
Commit the CT configuration, generated mount harness, test components, specs, package manifest, and lockfile. Ignore reports, traces, screenshots, and transient build output unless a reviewed baseline system explicitly needs an asset. Never commit tokens embedded in environment files. Document the single local command and CI command so a new engineer can reproduce the suite.
3. Mounting Angular Components and Supplying Inputs
Q: How do you mount a simple standalone component?
Import the component and the test and expect fixtures from the Angular CT package. Pass serializable inputs through the mount options, then locate the resulting accessible UI. This keeps the assertion focused on the component's public contract. For example:
import { Component, input } from '@angular/core';
import { test, expect } from '@playwright/experimental-ct-angular';
@Component({
selector: 'app-greeting',
standalone: true,
template: '<h2>Hello, {{ name() }}</h2>'
})
class GreetingComponent {
name = input.required<string>();
}
test('renders a signal input', async ({ mount }) => {
const component = await mount(GreetingComponent, {
props: { name: 'Asha' }
});
await expect(component.getByRole('heading', { name: 'Hello, Asha' })).toBeVisible();
});
Run npx playwright test -c playwright-ct.config.ts --grep "renders a signal input" to verify it.
Q: Why should props be serializable?
The test runner and browser component harness operate across a process and page boundary. Plain strings, numbers, booleans, arrays, and data objects cross that boundary predictably. Closures, browser handles, and complex service instances usually do not represent stable input data. Put behavior that needs Angular injection or local functions inside a wrapper component instead.
Q: When is a wrapper component appropriate?
Use a wrapper when the subject needs projected content, Angular directives, a form group, injectable collaborators, or parent-child event wiring. The wrapper describes a realistic host contract while still keeping the test boundary small. Give it a descriptive test-only name and avoid reproducing the production application shell. If every test needs an enormous wrapper, that is design feedback about hidden component dependencies.
Q: How do you test content projection?
Create a host whose template places meaningful content between the component tags. Assert the projected content and the container behavior from the user's perspective, including visibility or accessible naming. Do not inspect ng-content internals, because they are not a user-visible contract. Include multiple slots when the component exposes selectors such as [card-title] and [card-actions].
Q: How should you test a required input?
Cover the valid contract with a representative value and assert the resulting DOM. Separately, let Angular compiler checks protect many missing required input errors at build time. If the component implements a runtime empty-state policy, mount with the allowed boundary value such as an empty array and verify that state. Do not deliberately bypass TypeScript merely to create an impossible production call unless defensive behavior is itself required.
4. Locators, Assertions, and User Interaction
Q: Which locator strategy should you prefer?
Start with getByRole and an accessible name because it reflects how controls are exposed to users and assistive technology. Use getByLabel for form fields, then stable visible text where semantics are not available. A test id is reasonable for a non-semantic element whose copy changes frequently. CSS classes tied to styling are a weak contract and make refactors noisy. Review Playwright getByRole examples for locator drills.
Q: Why are web-first assertions important?
Assertions such as await expect(locator).toBeVisible() retry until the expected browser state appears or the assertion timeout expires. This matches Angular's asynchronous rendering better than reading a value once and sleeping. The retry also produces a focused failure tied to the expected condition. Fixed waits hide timing problems and extend successful runs unnecessarily.
Q: How do you test a button interaction?
Locate the button by role and name, click it, and assert the resulting behavior rather than the click itself. The outcome might be changed text, an emitted event exposed by the host, a disabled state, or a request. Playwright sends browser-level input and waits for actionability checks such as visibility and enabled state. If the click fails, investigate overlap, animation, or disabled logic instead of forcing it immediately.
Q: How do you test keyboard accessibility?
Focus the first relevant control, use page.keyboard.press('Tab') or locator-level key presses, and assert focus movement with toBeFocused(). Trigger controls with Enter or Space according to their native semantics. Also confirm that focus returns correctly after closing a dialog and that Escape performs the documented action. Keyboard coverage complements, but does not replace, an automated accessibility scan such as the workflow in accessibility testing with Playwright.
Q: When is getByTestId justified?
Use it when the UI lacks a meaningful accessible or textual handle, such as a canvas region or an icon-only visualization whose semantics are tested elsewhere. Configure a stable test-id attribute and treat it as a public testing contract. Do not add test ids to every node by default. If a button needs a test id because it has no accessible name, fix the accessibility problem first.
5. Signals, Outputs, Forms, and Change Detection
Q: How do signal inputs affect component tests?
A signal input is still part of the component's external API, so supply its value at mount time and assert its rendered consequence. Read-only signal semantics inside the component do not change how the user interacts with the DOM. For updates, drive the parent state through a wrapper rather than reaching into the component instance. This verifies that Angular propagates state through the same binding path used in production.
Q: How do you test an output event?
Wrap the component in a host that binds the output to a host method and renders the received value. Click the child control, then assert the host's visible result. That proves the complete child-to-parent contract without spying on implementation code. If the output carries structured data, render one stable identifying field or store it in host state for assertion.
Q: How do you test reactive form validation?
Fill the field through its label, blur or submit according to the product interaction, and assert the validation message plus relevant accessible state. Cover boundaries such as empty, minimum length, malformed input, and a valid value, rather than duplicating Angular validator internals. Confirm the submit action remains blocked when invalid and proceeds when valid. A good test makes the trigger explicit because validation on change and validation on blur are different product behaviors.
Q: Should a test call detectChanges()?
Normally no, because Playwright CT observes the browser and Angular integration manages rendering around mounted components. User interactions and input bindings should cause production change detection naturally. Repeated manual calls can conceal an OnPush or signal propagation defect. If a special harness truly requires explicit synchronization, explain why that boundary cannot be exercised through public behavior.
Q: How do you test OnPush components?
Update them through the same supported path used by their parent, such as a new input reference, a signal update, or an event handler. Assert the new DOM state with a retrying expectation. Mutating a nested object in place may correctly fail to render under OnPush, and that can be a useful contract test. The answer should distinguish an Angular change-detection rule from a Playwright waiting issue.
6. Dependency Injection, HTTP, and Browser Boundaries
Q: How do you handle an injected service?
First decide whether the service belongs inside the component-test boundary. Provide a deterministic fake through an Angular-aware test host or supported provider configuration when the goal is rendering behavior. Keep the fake small, typed, and state-specific instead of mocking every method on the real class. If DI wiring itself is the risk, use the real provider and replace only its external transport.
Q: Can Playwright intercept a component's HTTP request?
Yes, because the mounted component runs in a browser page and Playwright can route matching network requests. Register the route before the action that triggers the request, fulfill it with valid status, headers, and JSON, then assert the UI. This tests the browser-facing contract without starting a backend:
import { test, expect } from '@playwright/experimental-ct-angular';
import { UserListComponent } from './user-list.component';
test('renders users returned by the API', async ({ page, mount }) => {
await page.route('**/api/users', async route => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify([{ id: 7, name: 'Mina' }])
});
});
const component = await mount(UserListComponent);
await expect(component.getByRole('listitem')).toHaveText('Mina');
});
Verify it with npx playwright test -c playwright-ct.config.ts --grep "renders users".
Q: How do you test an HTTP error state?
Fulfill the request with the exact failure category the UI handles, such as 500, 404, or a delayed response. Assert the visible message, retry control, preserved user data, and loading indicator cleanup where relevant. A generic rejected promise may skip browser transport behavior that matters to an interceptor. Test one error policy per case so the failure explains which contract broke.
Q: Should component tests call a real backend?
Usually no, because shared data and service availability weaken isolation and reproducibility. Browser routing gives deterministic success, empty, slow, and failure responses close to the component boundary. A separate integration suite should prove frontend and backend compatibility, ideally supported by contract tests. Calling a local disposable service can be valid when the purpose is explicitly that integration, but label the test accordingly.
Q: How do you test browser APIs?
Use Playwright's browser context capabilities for permissions, geolocation, locale, color scheme, or reduced motion when the component consumes those signals. For a narrow API unavailable in the environment, install an initialization script before mounting so the page receives the controlled implementation. Assert the user-visible behavior rather than the stub call count. Keep browser-specific tests in the projects where the API is supported.
7. Routing, Overlays, and Complex Angular UI
Q: How do you test a component that uses Angular Router?
Mount it under a small routing host with only the routes needed for the scenario. Trigger navigation through the rendered link or button and assert the destination content or location exposed by the host. Do not boot the complete application route tree for a one-component question. Use an E2E test when guards, server redirects, or production route configuration are the actual risk.
Q: How do you test a dialog rendered in an overlay container?
Locate the dialog from the page by its dialog role rather than assuming it is a descendant of the mounted root. Assert its accessible name, focus placement, dismissal behavior, and focus restoration. Overlay libraries commonly portal content near the document body, so root-scoped CSS selectors can miss it. The accessibility tree provides a more stable boundary than internal overlay classes.
Q: How do you handle Angular animations?
Prefer assertions that wait for the final observable state and avoid coupling to intermediate CSS classes. Respect reduced-motion mode when the application supports it, because that often makes tests faster and more accessible. Disable animations only as a documented suite policy when animation behavior is outside scope. Keep at least one focused test if transition completion, dismissal timing, or layout motion carries product risk.
Q: How would you test projected templates or dynamic components?
Build a host that supplies the template or selects the dynamic type through the component's public input. Interact with the rendered result and verify that bindings and outputs still work. Avoid importing a production feature shell merely to gain one dynamic child. If dynamic loading depends on a registry, provide the smallest real registry that represents the supported contract.
Q: How do you test a virtualized list?
Give the viewport a deterministic size and provide enough items to exercise virtualization. Assert initially visible rows, scroll the component's actual viewport, then assert a later item appears and recycled content remains correct. Do not expect all records to exist in the DOM simultaneously. Include keyboard or focus behavior if recycling can detach the active element.
8. Debugging and Flake Diagnosis
Q: What is your first step when a CT test fails only in CI?
Open the retained trace and compare the action timeline, DOM snapshot, console, and network activity with the local run. Confirm browser and dependency versions from the lockfile before blaming timing. Reproduce with the same project, worker count, environment variables, and container resources. Only after locating the delayed condition should you adjust an assertion-specific timeout. See debugging a failing Playwright test in VS Code for a complementary workflow.
Q: Why is waitForTimeout a poor flake fix?
It waits for elapsed time instead of the condition the test needs. A duration that passes locally can remain too short under load, while making every healthy run slower. Wait for a visible state, response, URL, or count using Playwright's event and assertion APIs. A deliberate delay may belong in a mock used to test a spinner, but the assertion should still wait on behavior.
Q: How do traces help with component tests?
A trace records actions, snapshots, network events, console messages, and timing around the mounted browser page. It can reveal that a button was covered, a request returned unexpected data, or a locator matched multiple elements. Set trace: 'on-first-retry' for a useful CI cost-to-signal balance. Retain the artifact with the exact failed job so it is not lost after the runner exits.
Q: What causes strict-mode locator failures?
A locator intended for one element resolved to multiple matches. Improve the accessible name, scope to a meaningful region, or use a parent-child relationship that reflects the UI. Do not silence ambiguity with .first() unless choosing the first item is the actual requirement. Strictness often exposes duplicate labels or inaccessible component markup worth fixing.
Q: How do you diagnose a mount failure?
Read the browser console and compiler output first, because missing providers, template errors, and incompatible imports often surface there. Reduce the mount to the subject and one dependency at a time. Confirm that the component is exported, compilable, and compatible with the CT builder version. A failure before the first locator usually belongs to harness construction, not assertion timing.
9. Architecture, Coverage, and Test Design
Q: What should a component page object contain?
It can expose stable user actions and semantic regions for a complex reusable widget. Keep assertions in the test when they express scenario intent, while placing repeated mechanics such as filling a multi-step editor behind clear methods. Do not recreate the component's internal class API in the page object. Small components often need no abstraction beyond well-named locators.
Q: How do you decide component-test coverage?
Map coverage to risk: branching UI states, input boundaries, event contracts, accessibility, browser behavior, and regressions seen in production. Use code coverage as a diagnostic for untouched logic, not proof of good tests. Avoid duplicating the same assertion at unit, component, and E2E layers unless each catches a distinct failure. Review the suite periodically as components and ownership boundaries change.
Q: Should snapshots be used for Angular component tests?
Use narrow snapshots when a stable structure or visual output is genuinely the contract. Broad DOM snapshots produce churn from framework attributes, harmless markup changes, and dynamic values. Prefer explicit assertions for roles, names, values, and states because their failures describe intent. For visual regression, control fonts, viewport, animation, data, and operating-system rendering before approving baselines.
Q: How do you test accessibility at component scope?
Start with semantic locators and keyboard behavior, which continuously exercise accessible names and roles. Add an automated scanner to the mounted root or dialog for common rule violations. Then manually reason about focus order, announcements, and interaction because scanners cannot prove usability. A component test is an efficient place to catch violations before several pages reuse the widget.
Q: How do you keep test data maintainable?
Create small typed builders for domain objects and override only fields relevant to the case. Name fixtures by state, such as expiredSubscription, instead of using unexplained JSON blobs. Keep browser route responses close to the test unless many components share a stable contract. Random data needs a recorded seed and should not determine whether the assertion has meaning.
10. CI and Senior-Level Playwright Component Testing Interview Questions Angular Teams Ask
Q: How would you run component tests in CI?
Install dependencies with the lockfile, install matching browsers, run the CT config, and upload the report plus failure artifacts. Start with one browser on pull requests and schedule the broader matrix according to risk and feedback time. Use CI=1 npx playwright test -c playwright-ct.config.ts as the core command. Keep secrets out of CT when mocked browser boundaries make them unnecessary.
Q: When should you shard the suite?
Shard after measurement shows test execution dominates job startup and artifact overhead. Give each shard comparable work, publish its blob report, and merge reports in a later job. A tiny suite can become slower and harder to diagnose when split prematurely. Track total compute as well as wall-clock time when deciding whether parallelism is worthwhile.
Q: How do you control cross-test state?
Let Playwright create an isolated browser context for each test and mount fresh component state. Avoid module-level mutable fixtures, shared server records, and order-dependent tests. If a test changes local storage or permissions, configure them per context rather than cleaning a global browser after the fact. Parallel execution is an effective check that isolation is real.
Q: What would you review before upgrading Playwright or Angular?
Read both projects' migration notes, verify supported runtime and TypeScript versions, and inspect changes to the experimental CT adapter. Upgrade in a branch with the lockfile, rebuild the harness, and run a representative matrix containing inputs, DI, routing, overlays, and network mocks. Compare traces or screenshots for unexplained rendering differences. Pin the accepted versions so CI and developer machines agree.
Q: How would you explain return on investment to a team?
Measure failures caught before E2E, reduction in expensive journey setup, suite duration, and time to diagnose a broken UI state. Component tests are most valuable where they replace slow or brittle setup while preserving browser fidelity. Include maintenance cost, browser infrastructure, and duplicated coverage in the calculation. Propose a pilot around one behavior-rich component, then use its evidence to decide expansion.
How Interviewers Grade Your Answers
Interviewers listen for boundary awareness before API recall. State what is real in the test, what is replaced, and which failure your design can detect. A senior answer names a locator or routing API, then explains why that tool matches Angular rendering and the user-visible contract.
They also look for reproducibility. Mention registering routes before actions, using web-first assertions, isolating contexts, pinning experimental CT dependencies, and retaining traces. When asked for a test strategy, divide logic among unit, component, integration, and E2E layers instead of declaring component testing universally superior.
Use code with complete imports and a verification command. If you do not know whether an adapter supports a particular mount option, say you would check the installed package's generated harness or official type definitions rather than inventing an API. You can sharpen this communication with Playwright coding interview questions and assess a real resume in the QA resume analyzer.
Common Mistakes
- Treating CT as a full deployed application test and overstating the confidence it provides.
- Mounting the entire feature shell when a small host could express the dependency contract.
- Selecting Angular-generated classes or DOM order instead of roles, labels, and meaningful regions.
- Adding sleeps after actions rather than asserting the exact asynchronous outcome.
- Passing non-serializable service objects as props instead of supplying behavior through Angular composition.
- Intercepting requests after the component has already initiated them.
- Calling
.first()to hide duplicate matches without proving that order matters. - Sharing mutable fixtures across parallel tests and then compensating with retries.
- Approving broad snapshots that obscure which behavior changed.
- Forgetting that the Angular adapter is experimental and allowing dependency versions to drift.
Conclusion
The best answers to Playwright component testing interview questions angular hiring panels use connect browser behavior with Angular's public component contracts. Show that you can mount a focused subject, supply deliberate state, drive it through accessible interactions, and distinguish a UI defect from a harness or integration failure.
Practice the examples in Chromium, inspect one trace, and then explain which tests you would keep at the TestBed and E2E layers. That combination demonstrates practical API skill and the judgment expected from an Angular automation engineer.
Interview Questions and Answers
What does Playwright Component Testing validate for an Angular component?
It validates the component's rendered DOM and browser interactions inside a mounted test harness. I use it for accessible semantics, real input events, CSS-dependent state, outputs, and controlled browser network behavior. I do not present it as proof that the deployed application and backend work together.
How do you choose between TestBed, Playwright CT, and E2E?
I use TestBed for cheap Angular logic and DI-focused checks, Playwright CT for browser-realistic component contracts, and E2E for a small set of critical integrated journeys. The deciding factor is the failure boundary, not a preferred tool. I avoid duplicating identical checks at all three layers.
How would you mount a component with complex dependencies?
I create a small test host that supplies Angular providers, projected content, forms, or parent bindings through normal framework mechanisms. External transport is replaced at the browser route boundary when appropriate. If the host grows into an application shell, I reconsider whether the scenario belongs in E2E.
How do you test Angular outputs with Playwright?
I bind the output in a host component and render the received value or resulting state. Then I perform the user action and assert that observable host result. This verifies event wiring without spying on the child's implementation.
How do you prevent timing flakes after Angular state changes?
I use Playwright's retrying assertions against the exact visible condition, such as text, count, enabled state, or focus. I avoid fixed delays and do not force manual change detection as a default. When a failure persists, I use the trace to separate rendering, network, and locator problems.
How do you mock an API response in a component test?
I register `page.route()` before the request can start and fulfill the matching URL with an explicit status, content type, and body. I create separate cases for success, empty data, and meaningful failure categories. The assertions cover what the user sees, not merely whether the route handler ran.
What locator policy would you enforce?
I prioritize roles with accessible names, labels for fields, and visible text that represents the product contract. I allow test ids for non-semantic surfaces where a user-facing locator would be unstable. I reject selectors based on generated Angular attributes or styling classes.
How do you debug a component test that passes locally but fails in CI?
I inspect the trace, console, network events, and DOM snapshot from the failed job. Next I reproduce the same browser, dependency lockfile, worker count, and environment. I change a timeout only after identifying a legitimate condition that needs a different budget.
How would you test an Angular Material dialog?
I locate it at page scope by the dialog role because overlay content may be portaled outside the mount root. I check its accessible name, initial focus, keyboard dismissal, and focus restoration. I avoid coupling the test to internal overlay CSS classes.
How do you make Playwright CT reliable in parallel CI?
Each test mounts fresh state in an isolated browser context and avoids mutable module globals or shared server records. I pin dependencies, cache matching browser binaries, and retain traces on retry. I shard only after measurements show that execution time outweighs job startup and report-merging overhead.
Frequently Asked Questions
Does Playwright support Angular component testing?
Yes. Playwright provides an experimental Angular component-testing package that mounts components in a real browser. Because the feature is experimental, pin package versions and validate upgrades in CI.
Is Playwright Component Testing a replacement for Angular TestBed?
No. TestBed remains efficient for Angular-aware unit tests and dependency injection checks, while Playwright CT adds real-browser rendering and interaction. Use each at the boundary where it provides distinct confidence.
Can Playwright component tests mock Angular HTTP calls?
Yes. Register `page.route()` before mounting or before the action that sends the request, then fulfill it with a deterministic response. This controls the browser network boundary without requiring a backend.
Can Playwright test Angular signal inputs?
Yes. Supply the signal input through the component's public mount props and assert the rendered state. For later updates, use a host component so Angular binding propagation remains realistic.
Which selectors are best for Angular component tests?
Prefer accessible roles and names, followed by labels and meaningful visible text. Use stable test ids only when the element has no suitable semantic contract.
Should Angular component tests run in every browser?
Run the browser matrix that matches product risk. Many teams use Chromium for fast pull-request feedback and run Firefox or WebKit on a scheduled or release gate, especially for browser-sensitive components.
Why are my Angular component tests flaky in CI?
Common causes include fixed sleeps, shared state, late network interception, resource pressure, drifting versions, and ambiguous locators. Inspect the Playwright trace and reproduce with the same project and worker count before changing timeouts.
Related Guides
- Cypress Component Testing Interview Questions for React (2026)
- Contract Testing Interview Questions for Microservices (2026)
- Database Testing Scenario Interview Questions for Senior QA (2026)
- Ecommerce Testing Interview Questions for Senior QA (2026)
- gRPC Testing Interview Questions for QA Engineers (2026)
- Kafka Testing Interview Questions for Senior QA (2026)