From the course: Playwright: Design Patterns
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Implementing the page object model in tests - Microsoft Playwright Tutorial
From the course: Playwright: Design Patterns
Implementing the page object model in tests
- [Instructor] Let's implement the Login Page form that we created in the previous video. This will allow us to run a playwright test that uses the pom to interact with the login page of binaryville. So as you can see, login_page.pom.ts is still in this project. I've got a folder called test and inside here I've got test.spec.ts. Here I will start writing a code, which is import test, expect from playwright, and I will also import the LoginPage pom from page-objects folder. And we have got login-page.pom. And we will use this inside the test. So test should login using POM, and the body of the test, first of all we are going to use a built-in fixture page and then we'll create the body. In the body of the test, we'll create loginPage object for the LoginPage pom and we will pass in page. So first things first, we need to visit the URL, so await page.goto and https://binaryville.com/account is the URL. On that page we have got three fields. So we will fill in, sorry, two fields, email…
Contents
-
-
-
-
-
(Locked)
What is a page object model?1m 33s
-
(Locked)
Creating a basic page object model3m 40s
-
(Locked)
Implementing the page object model in tests3m 29s
-
(Locked)
Combining page object model with fixtures2m 39s
-
(Locked)
Creating reusable and maintainable page object models4m 2s
-
(Locked)
Best practices for page object models2m 55s
-
(Locked)
-
-
-