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.

Pytest config

Pytest config

In the previous lesson, we learned how to run our playwright tests. That is, we can simply use the pytest command. It will use all the files or test modules in the current directory, run the test functions and give us the report. Now here you can see it passed all of it. But one thing is that by default, PyTest does not run our tests in the headed mode. And if you'd like to enable it, we would have to provide it as a flag that is hyphen hyphen headed like this. And because it's headed, we'd like to slow down the execution as well. And to do that, we'd have to use slow mo and set it to something like, let's say 500 times. It's all great that we can configure the behavior of playwright and the tests but providing all of these options every time we run our tests is not good. Wouldn't it be great if we provide this or specify these options somewhere and playwright or pytest can use them every time we just use the pytest command. Well, we can do that using the pytest's configuration file…

Contents