When we are automating and maintaining tests we need good feedback on test runs. Playwright gives quick and useful feedback in its Trace Viewer which provides feedback on the run of tests. Trace Viewer’s feedback is one reason I like automating tests with Playwright. Through Trace Viewer you can:
- View the UI of the application under test at each step and before and after each step:
- See on the UI where the mouse has clicked:
- See the UI of the application under test over time:
- Read the content of the network and console tabs from dev tools as they were at any point in the test run:
- See how long each step in the test takes:
- See the source code of the test that is executed at each step:
- If a test fails I can read an error message that includes the name of the file and line number where the test failed:
- Get metadata about your test:
- Find the built-in locator for an element in the UI, I could not find this feature in the documentation. To find the built-in-locator for an element:
- click on the circles next to Locator
- click on the UI element in the screenshot that you would like to know the built-in-locator for
- then the built-in locator will be displayed in the Locator tab:
If a Playwright test fails, Trace Viewer can help you:
- see a screenshot of where the test failed
- investigate the UI of the application under test at the point it failed and use the browser’s dev tools to investigate the failure
- see the lines of test code in the test where the failure occurred
- because you can share the URL from CI of the Trace View
Trace Viewer can help you develop new tests because
- run locally by adding an option to the command line
- it can show you the built-in locator for an element
- if a test fails it shows you where in the test it failed
I have automated tests with several tools and never found a feature as helpful as Playwright Trace Viewer. I will also likely find more ways that Trace Viewer provides valuable feedback over time. If you are considering automating tests with Playwright I would recommend investigating Playwright’s Trace Viewer because it may be the factor which persuades you to use Playwright!