From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Implementing an advanced fixture in Playwright

Implementing an advanced fixture in Playwright

- [Instructor] In video 3, we implemented a page.fixture, shown in this graphic, where we abstracted away the login.page using the page.fixture within the login.spec. In this lesson, we're going to implement a more advanced fixture that will fail if any console error messages show up on the page. So this is what you would see if you inspect your browser, and you look at the browser console, and there's any JavaScript errors. This will require us to create a new fixture file, and we're going to use a function that Playwright provides to merge these fixtures together to add another layer of abstraction. In the end, this will simplify the implementation or adding some complexity on the backend. Before we get started, though, let's go ahead and take this login.page in our login.spec and let's go ahead and further abstract that. So as a part of the repo, I've already committed two new pages to the repository. One is an account page. So in pages, account, accounts.page, we have a new page…

Contents