Rayrun
← Back to videos

Playwright Test Generator: Create tests without writing Code!

Playwright comes with the ability to generate tests out of the box and is a great way to quickly get started with testing. It will open two windows, a browser window where you interact with the website you wish to test and the Playwright Inspector window where you can record your tests, copy the tests, clear your tests as well as change the language of your tests.

In this video, Jared from Commit Quality demonstrates how to create Playwright tests without writing any code using the Codegen (Test Generator) tool. Playwright's Codegen tool allows users to record their actions on a web page, which then gets converted into reusable test code.

The video starts by explaining that although the Codegen tool is a quick and easy way to create UI tests, it's not recommended to rely solely on the tool due to potential issues with code maintainability and adherence to company standards and best practices. Nevertheless, the tool is praised for its usefulness and ability to help developers figure out how to perform certain actions in their code.

In the demonstration, Jared starts by opening the Playwright inspector and command line, loading up the Codegen tool, and recording a set of actions performed on a web page. The video then continues by showing the generated test script and highlighting how it is possible to copy the script, make changes to it, and run the test again using the npx command or Visual Studio Code.

The video explains the different options available when running the Codegen tool, such as specifying a URL to load, emulating different viewport sizes, taking different actions on the web page (record, stop, explore), and generating test scripts in different languages and bindings (such as Java, Python, and C#).

Towards the end of the video, Jared briefly demonstrates how to use Playwright's Page.pause command to stop the execution of the test and then continue recording from that point forward using the Codegen tool.

Overall, the video serves as a helpful guide for developers who are interested in quickly generating UI tests using Playwright's Codegen tool without writing any code, while still keeping in mind the potential pitfalls associated with relying solely on the tool.

Related Videos

Playwright - How to control scrollbar
Playwright - How to control scrollbar
#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
How to Code a Test Automation on Youtube | Playwright JS
How to Code a Test Automation on Youtube | Playwright JS
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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].