Playwright's Trace Viewer is your go-to tool for profiling tests. It lets you view test traces, inspect the log, source, and network at each step, and interact with a DOM snapshot.
To view a trace, click the trace icon next to the test name file name in Playwright's HTML report. Or, open the detailed view of the test, scroll to 'Traces', and click on a screenshot.
// Example code to generate a trace
import { test } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://ray.run/');
// Your test actions here
});
For more on traces, check out the Trace Viewer guide.
The VS Code extension for Playwright allows debugging tests within VS Code. It shows error messages, lets you create breakpoints, and live debug tests.
// Example code to debug a test
import { test, expect } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://ray.run/');
// Your test actions here
expect(await page.title()).toBe('Ray');
});
You can also debug tests live in VS Code by running them with the Show Browser option checked.
Playwright's CodeGen feature auto-generates new tests based on user actions, making it easy to get started with testing.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].