From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Playwright test

Playwright test

In the previous lesson we installed the pytest playwright plugin. Now we can go ahead and write our first test using the same. So what we'll test is our playwright website. That is to get started. So we'll visit the playwrights home page. Then first of all we'll test whether or not it has a get started link. That is this right here. And when we click on the link, it should visit the docs url. So that's our test. So let's get started with our test. I will create a test module that is test underscore app. And then I can define our test function which will be let's say test page has the get started link like this. Now one thing I would like to mention here is that if your function name gets lengthy its totally fine but don't compromise readability. Moving on we need the page object that is we need to visit the website and then find the get started link locator and so on. So to get the page object we can simply request for the same as a fixture inside of our test function. need to import…

Contents