Component Testing Interview Questions for Playwright Testing
30 Component Testing questions with answers for playwright testing roles — 8 easy, 15 medium, 7 hard.
About Component Testing
Covers Playwright component testing for React, Vue and Svelte: the mount fixture, setup files, providers through hooksConfig, props and callbacks across the Node and browser boundary, mocking and visual checks per state. Interviews test when to test at component level instead of end to end, and how to keep such tests fast and reliable.
How do you set up Playwright component testing in an existing React project?
Show answer
Write a component test for a Counter that increments on click.
Show answer
What does the mount fixture return?
Show answer
How is a component test different from an end-to-end test?
Show answer
Which frameworks does Playwright component testing support?
Show answer
Component tests render without any styling. What is missing?
Show answer
Why are component tests usually faster than end-to-end tests?
Show answer
How is a Playwright component test different from a Jest unit test with jsdom?
Show answer
Write a component test that checks an onSubmit callback receives the form data.
Show answer
What is the playwright/index.tsx file used for?
Show answer
How do you wrap a component in a theme or router provider using hooksConfig?
Show answer
How do you change a mounted component's props during a test?
Show answer
How do you mock API calls made by a component in a component test?
Show answer
How do you pass slots and listen to events in a Vue component test?
Show answer
What is ctViteConfig and when do you need it?
Show answer
Component tests fail because imports like @/utils cannot be resolved, though the app builds fine. How do you fix it?
Show answer
How do you take visual snapshots of each component state in component tests?
Show answer
When should you choose a component test over an end-to-end test?
Show answer
Write a component test that checks a required field shows an error on blur.
Show answer
Component and end-to-end tests run together and slow down every commit. How do you separate them?
Show answer
How do you test a dropdown component's keyboard support in a component test?
Show answer
Tell me about a time you introduced component tests to a frontend team.
Show answer
Why do component tests run in two processes, and what limits does that create?
Show answer
A component under test needs a complex class instance as a prop and the test fails to serialise it. What do you do?
Show answer
The team wants to replace all end-to-end tests with component tests to save time. What do you advise?
Show answer
How do you test a component that reads from a global state store?
Show answer
A component test passes alone but fails when the full component suite runs. What do you check?
Show answer
What are the risks of relying on an experimental testing feature in a large codebase?
Show answer
Describe a time you had to decide which testing level a feature belonged to.
Show answer
Frequently asked questions
How important is Component Testing in Playwright Testing interviews?
Covers Playwright component testing for React, Vue and Svelte: the mount fixture, setup files, providers through hooksConfig, props and callbacks across the Node and browser boundary, mocking and visual checks per state. Interviews test when to test at component level instead of end to end, and how to keep such tests fast and reliable.
How should I use the Component Testing sheet?
Go top to bottom — easy to hard. Answer before opening each answer, tick what you solved and save misses to Last-Minute Revision.