Debugging is very essential to identify the problem of the script in the run time.
In this video, the presenter demonstrates how to debug test code using VS Code and Playwright. The video is quite short and straightforward.
The first step is to go to the Playwright config file and ensure that the file to be debugged is within the test match. It is recommended to have only one file for debugging to avoid multiple debugging sessions.
Next, the presenter suggests going to the test file, which can be a page object model or any basic script, and selecting the lines where debug points are desired. These debug points will be the points where the code execution will pause for inspection.
To start the debugging process, the presenter instructs viewers to press Ctrl + Shift + P to bring up the command palette. Then, they should type "debug npm script" and select it. This will initiate the debugging process.
The video shows how the code execution pauses at the debug points and allows the viewer to inspect variables and objects. The presenter demonstrates how to evaluate expressions in the debug console and add variables to the watch panel for easier monitoring. They also show how to navigate between breakpoints and stop the debugging session when needed.
The presenter mentions that the instructions shown in the video are applicable to both JavaScript and TypeScript.
In conclusion, the video provides a quick tip on how to debug test code using VS Code and Playwright. The presenter encourages viewers to ask any further questions or provide feedback in the comments section.
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].