From the course: Playwright: Design Patterns
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Combining BDD with page object model - Microsoft Playwright Tutorial
From the course: Playwright: Design Patterns
Combining BDD with page object model
- [Instructor] Now that we have centralized our browser setup, let's take the next step by introducing the page object model. This approach helps make our tests cleaner and easier to maintain by encapsulating the interactions with the login page into a dedicated class. So as you can see in the code, we have got the URL of the navigation page on the line number six. And then we have got, on line number 10 and 11, we have got the locator values inside the test. So what we are going to do is we are going to create a page object model. So I'm going to create a new folder. And I will create the page object for the login page. You should already be familiar with how page object model works and what they are from one of my previous videos. This is more of like combining page object model with BDD. So I'm going to import Page, Locator from playwright. And we'll create a class called LoginPage. And inside that class we'll have the readonly page. We'll have the locator for the email. We'll have…
Contents
-
-
-
-
-
-
(Locked)
Introduction to behavior driven development (BDD)2m 49s
-
(Locked)
Writing BDD scenarios using Cucumber2m 9s
-
(Locked)
Setting up Cucumber in your project3m 57s
-
(Locked)
Writing your first step definition7m 27s
-
(Locked)
Centralizing setup and running a BDD test2m 8s
-
(Locked)
Combining BDD with page object model5m 56s
-
(Locked)
-
-