How easy is it to debug test failures in Playwright?

In an engaging AMA session with Playwright guru @utchbe, we delved deep into the world of Playwright.

Among the many questions asked, was this question from Zoe C:

How easy is it to debug test failures in Playwright?

This question touches on an important aspect of working with Playwright. We’re interested in hearing about your experiences and insights on debugging with Playwright.

3 Likes

Debugging on your computer when building and writing tests is super nice with the playwright UI mode (npx playwright test --ui) or by using the VS Code Playwright Test Extension and adding break points to your test to debug variable values and step through code.

When debugging after a test is complete, as long as you have enabled traces in your playwright.config file and have HTML report enabled, you can view the report, and view the trace files, which gives you access to all the network http requests (headers and bodies) along with responses. You also have access to any console errors that occurred. These can be saved from runs in Continuous Integration pipelines for reviewing after automation runs. Also enabling screenshot and videos can be helpful if you want to see what was happening at the time as well.

With these tools at your fingertips I’ve found its super easy!

2 Likes