Setup & Re-Use Authentication with Playwright Dependencies!

preview_player
Показать описание

In this tutorial, you'll learn:

How to set up Playwright dependencies using projects
How to re-use authentication across multiple tests using playwright
Best practices approach for using global setup

Рекомендации по теме
Комментарии
Автор

As someone who is just learning playwright, this video genuinely helped me. In my case, my project folder structure is quite complex and I wanted to have my setup file in the specific location. In playwright docs regarding authetication, there is no testDir inside setup project in the config. This gave me some head scratching as my auth setup wasn't running and I didn't know why. Good, informative video, thank you.

traced_soul
Автор

Thank you so much for the thorough explanation- I had the hardest time understanding the documentation, but watching your video really made it click for me. (and your voice is so soothing, it made learning tons easier, so thanks for that from a poor little neurodivergent developer)

cybercarotte
Автор

Thank you! Thank you! Thank you! You just got me out of a big mental block. Top notch.

zenmushie
Автор

Hello, thank you very much for the information, just what I was looking for for more than 2 days, I adapted it in js and it was great. 😊✨

demetrixrobels
Автор

very helpful video, thanks man appreciate the effort and clarity!

huseinfadh
Автор

Thanks a lot for your help. This video was very useful to complete with this auth task.

castrillonfrank
Автор

Thank you so much for your outstanding videos. I tried to follow playwright doc to use dependencies and I failed. I abled to follow your instruction and created setup. Would you please create a video on how to run through CI/CD? There are some videos regarding CICD but they don't cover reporting and/or sending email.

moridwaqif
Автор

Hi, Noticed when you have global-setup using this approach ie setting the dependency instead of this: globalSetup: './support/setup/globalSetup', - UI mode when lunched only shows the global-setup test, it doesn't show all your tests in UI mode?

RichardForjoe-du
Автор

But if I need the setup to be picked up for all browsers, do I need to specify this setup for each browser?
And when the tests are launched for Chrome, the login occurs and then all the tests, Safari opens and again the login for Safari occurs and then all the tests are already logged in?
How can I make the login happen once for all browsers?

bo_irookanji
Автор

Hi, thank you for the well explained video. As someone that is jumping over from a .NET background, explanations like this are great for breaking down the main concepts in a typescript framework.

If you don't mind answering a question related to this, but to do with weaving API calls in amongst the browser tests to seed and verify data. What is the best way to use something like setup dependencies, but for storing an authorization token from a response, that does not provide a cookie response to store into storageState?

Do we simply use the setup test anyway, but store the token into a json file, or to a process.env value? Really not sure of best practice here when working outside of cookies.

Thanks.

ragequit_nz
Автор

Many thanks for the video!
What should the global setting look like if required cross-browser tests and login by different users?

РоманШабанов-юг
Автор

Thank you for the video and for clearly explaining how to re-use the authentication. Could you tell me how to handle auto-log-out when re-using the authentication? My session logs out when running the tests which re uses Authentication.

MsAbhi
Автор

Great video. What if you have another set of tests in your suite that test the login functionality only? In this case, how can you make you the setup dynamic for signed-in and unsigned-in tests?

kakfew
Автор

Thank you, Have a question- how to pass the stored authenticated state to tests written in page object model ?

dpdeepakparmar
Автор

do you know the best practice for renew auth?

rezah
Автор

Thanks for your video. Could you please show me how can I deal with different url on ‘setup’. Thanks

khaivinhnguyen
Автор

Hello. Cool video. Continue..
Can I use api fixtures in setup file? I am creating user via api but getting error
If I use this fixture in the test itself, then it works successfully and the user is created.
Where is the catch?

frols
Автор

Thanks for the video! Could you introduce data validation test with playwright and
Database?

gerigan
Автор

Can you run multiple tests in one browser context Playwright? If so can you please make a video on it using this global test?

DilseOn
Автор

Great video👍 but I am still unable to understand why do we need to place global set up outside of test directory

Snehaandsahasra