Generating Tests Using Playwright CLI | Bondar Academy
Course: Claude Code for Playwright
Module: Playwright Workflows with Claude Code
Instructor: Artem Bondar
Lesson Summary
This video lesson discusses an alternative method for automating tests using Playwright CLI when access to the source code is not available. While this method is slower than direct source code access, it is still faster than using Playwright MCP . Key Concepts Playwright CLI Installation: The skill PWNewTestCLI checks for the installation of Playwright CLI and installs it if necessary. Test Exploration: The CLI reviews existing tests and explores user flows by opening the application and generating locators using the generate locator method from Playwright CLI. Scenario Automation: The video demonstrates automating a scenario where a user logs in, selects an article, posts a comment, and deletes the article. Execution Process The execution involves the following steps: Check if Playwright CLI is installed. Install Playwright CLI if not present. Open the application and explore user flows. Generate valid locators for elements. Write and execute the test. While the exploration is slower, it allows for precise interaction with the live application, capturing dynamic content that may not be available in static code exploration. Considerations Using Playwright CLI has its pros and cons: Pros: Can automate test case creation without source code access. Cons: Slower execution and potential instability in locators due to lack of access to the source code. In conclusion, if source code access is available, it is the preferred method for automation. Otherwise, Playwright CLI serves as a viable alternative.