Report Playwright component test results with embedded trace viewer, screenshots, and video. Same experience as E2E tests.
Playwright component testing mounts UI components in a real browser without a full application. TestDino supports component tests with traces, screenshots, and videos, the same as E2E tests.
Component testing requires the @testdino/playwright streaming reporter, which is currently in Beta. The standard tdpw upload CLI does not support component test reporting. See Real-Time Streaming for setup.
Playwright component testing is experimental. The API may change between Playwright versions. See the Playwright component testing docs for full API details.
Run the Playwright scaffolding command to create a playwright/ directory with index.html and index.ts files:
npm
yarn
pnpm
npm init playwright@latest -- --ct
yarn create playwright --ct
pnpm create playwright --ct
2
Install the TestDino reporter
npm install @testdino/playwright
3
Write a component test
Create a test file next to your component. Import test and expect from the framework-specific package, and use the mount fixture to render the component:
React
Vue
Svelte
src/App.spec.tsx
import { test, expect } from '@playwright/experimental-ct-react';import App from './App';test('renders the homepage', async ({ mount }) => { const component = await mount(<App />); await expect(component).toContainText('Welcome');});
src/App.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue';import App from './App.vue';test('renders the homepage', async ({ mount }) => { const component = await mount(App); await expect(component).toContainText('Welcome');});
src/App.spec.ts
import { test, expect } from '@playwright/experimental-ct-svelte';import App from './App.svelte';test('renders the homepage', async ({ mount }) => { const component = await mount(App); await expect(component).toContainText('Welcome');});
Experimental API. The component testing API may change between Playwright releases.
Plain data only for props. Complex objects like class instances do not serialize across the browser boundary. Pass plain objects, strings, numbers, and dates only.
Callbacks are async. Event handler callbacks run in Node.js while the component runs in the browser. Synchronous return values from callbacks do not work.