microsoft / playwright-pytest

Pytest plugin to write end-to-end browser tests with Playwright.
https://playwright.dev/python/docs/test-runners
Apache License 2.0
443 stars 69 forks source link

How to use this official fixture and have every test method include the auth after login? #229

Open two867 opened 5 months ago

two867 commented 5 months ago

I want to use the code in pytest_playwright.py, but each page in there is a separate context, how can I use the page fixture in pytest_playwriht.py while carrying the auth information?

BBmykola commented 2 months ago

Hi @two867,

What i did is a bash script of 2 commands.

  1. run login with --save-storage=path_to_auth
  2. my tests with --load-storage=path_to_file

Don't know how good this solution is, but it works