Playwright Tutorial for turning Page Object Model Pages into fixtures. This is the preferred approach when using Playwright test and page object model
In this video tutorial, Jared from Commit to Quality shows us how to extend the Page Object Model in Playwright by creating new fixtures for the classes. This method tidies up tests and makes them more readable.
To start with, Jared creates a new folder called 'fixtures' inside the test folder and inside it, he creates a new file called 'basePage.ts'. Inside the file, he imports the necessary classes and then extends the basic test provided by Playwright to add new fixtures for the page object model classes or pages. Here's a quick rundown of the steps:
With these simple steps, you can easily convert your page object models into fixtures, making your tests more readable and maintainable. So, go ahead and give it a try, and if you have any questions along the way, don't hesitate to drop a comment on the video tutorial!
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].