From the course: Learning Playwright
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Handling cookie authentication in Playwright
From the course: Learning Playwright
Handling cookie authentication in Playwright
- [Instructor] Now that we've got a few homepage tests in place, let's look at what it's like testing the system from a logged-in user's perspective. We created a login spec already, but from the last lesson, you may notice a challenge we may be facing. Every test creates a new browser context. How can we quickly and easily get our test into a logged-in state for the tests that require login? The simple answer is we just go through the login steps before each step. But this will add a lot of time to our test execution time and it'd be a lot of repeated code. Thankfully the Playwright team has built some awesome tools to help us store an authentication state, all within Playwright. When we were setting up the project section in the Playwright config file, You may remember that, with the setup project, with something we built, we'll be using this project to handle authentication within the system once, and saving the state to be used within other tests. So let's start by creating a new…
Contents
-
-
-
-
(Locked)
Overview of the website under test5m 3s
-
Generating tests with codegen4m 31s
-
(Locked)
Overview of locator strategies in Playwright5m 39s
-
(Locked)
Overview of assertions in Playwright12m 56s
-
Structuring Playwright tests9m 8s
-
(Locked)
Handling cookie authentication in Playwright12m 4s
-
(Locked)
Visual testing in Playwright10m 58s
-
(Locked)
API testing in Playwright13m 31s
-
(Locked)
Automating the right things with Playwright2m 24s
-
(Locked)
Challenge: Create three automated tests1m 29s
-
(Locked)
Solution: Create three automated tests10m 2s
-
(Locked)
-
-