To enable detailed logging for local testing with @playwright/test, follow these steps:
Run your tests with the --debug
flag:
npx playwright test --debug
This allows you to step through your test, view actionability logs, and edit the locator live.
Install the VS Code extension for live debugging. Set a breakpoint by clicking next to the test line, and the browser will pause at the breakpoint.
Run a specific test with the --debug
flag:
npx playwright test example.spec.ts:9 --debug
Replace example.spec.ts:9
with the test file and line number.
For CI failures, use the Playwright trace viewer instead of videos and screenshots. It provides a full trace of your tests as a local Progressive Web App (PWA).
import { test, expect } from '@playwright/test';
test('example test', async ({ page }) => {
await page.goto('https://ray.run/');
// Your test code here
});
These methods will help you get detailed logging information for local testing with Playwright.
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].