Thank you! Thank you! Thank you! You just got me out of a big mental block. Top notch.
@CommitQuality Жыл бұрын
Thank you! These type of comments really motivate me to continue
@traced_soul6636 Жыл бұрын
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.
@CommitQuality Жыл бұрын
This is awesome to hear! Thanks for the support!
@cybercarotte Жыл бұрын
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)
@CommitQuality Жыл бұрын
Thanks for the kind words! I'm glad I can help you 🙂
@huseinfadh3 ай бұрын
very helpful video, thanks man appreciate the effort and clarity!
@demetrixrobels64566 ай бұрын
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. 😊✨
@castrillonfrank1144 ай бұрын
Thanks a lot for your help. This video was very useful to complete with this auth task.
@moridwaqif11 ай бұрын
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.
@CommitQuality11 ай бұрын
Great suggestion I will get something created
@RichardForjoe-d6u3 ай бұрын
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?
@MsAbhi119 ай бұрын
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.
@CommitQuality9 ай бұрын
Is that because the app is logging out? I'm not sure what would cause that
@MsAbhi119 ай бұрын
Thanks for the reply. Yeah, the app logs out and I am trying to check the URL before running the tests to see if the app is logged in or out.
@MsAbhi119 ай бұрын
Is there a way to run the setup as a dependency at the feature file (test file ) level instead of as a dependency at the project level
@dpdeepakparmar4 ай бұрын
Thank you, Have a question- how to pass the stored authenticated state to tests written in page object model ?
@CommitQuality4 ай бұрын
It should all be setup in your config file so if you are using POM or not, it will be the same.
@kakfew Жыл бұрын
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?
@CommitQuality Жыл бұрын
Yes you can choose for a group of tests to not use the saved state and it will treat it as a fresh test (not logged in)
@bo_irookanji Жыл бұрын
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?
@rezah5859Ай бұрын
do you know the best practice for renew auth?
@khaivinhnguyen Жыл бұрын
Thanks for your video. Could you please show me how can I deal with different url on ‘setup’. Thanks
@CommitQuality Жыл бұрын
Thank you:) do you mean go to a different URL? If so, you can use the page.goto() method and enter whatever you want
@РоманШабанов-ю6г Жыл бұрын
Many thanks for the video! What should the global setting look like if required cross-browser tests and login by different users?
@CommitQuality Жыл бұрын
You can take the approach of logging out, however that can become messy. I would instead create multiple "tests" that execute logging in as different users and then saving those states to different JSON files.
@ragequit_nz Жыл бұрын
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.
@CommitQuality Жыл бұрын
Thank you for the support! I personally do this in my work test packs and I always use setup to grab the Auth token and then store that in a process.env variable to pass through to the different tests I use.
@gerigan9988 Жыл бұрын
Thanks for the video! Could you introduce data validation test with playwright and Database?
@CommitQuality Жыл бұрын
Yes no problem. I will add it to my list :)
@AntonijoCosic-q7s9 ай бұрын
Hi, i dont know if you can help me. In my case the weba pp is using SSO from google, only username and password are needed, 2FA is not enabled. The setup part creates the LoginAuth.json file but the tests after in the chromium project are stuck on the loading screen of the web app. When i look into the console I can see that the token in app.vue is undefined and the session is also undefined. Seems like playwright is not sending necessarry information to the web applications local storage...
@CommitQuality9 ай бұрын
Is the issue that you're hitting bot detection?
@demetrixrobels64566 ай бұрын
@@CommitQuality Hi, how can I bypass bot detection when I need to log in with an integration app like Google or something similar?
@mihaelacostea5783 Жыл бұрын
How do you write a test where the user needs to do something on the website and where he needs to be logged in? When i run my tests, the set-up will execute the log in correctly but the 2nd test (e.g. writing and publishing a blog post) doesnt pass as it needs logging in...
@CommitQuality Жыл бұрын
This video covers reusing your logged in state. You may want to watch this one first kzbin.info/www/bejne/oXfTemNpqbV_gq8 But these videos will cover being logged in
@Snehaandsahasra Жыл бұрын
Great video👍 but I am still unable to understand why do we need to place global set up outside of test directory
@CommitQuality Жыл бұрын
It can be inside but you need to change the location in your config so it reads from the right place
@DilseOn9 ай бұрын
Can you run multiple tests in one browser context Playwright? If so can you please make a video on it using this global test?
@CommitQuality9 ай бұрын
Just to check so you mean persist the browser through multiple tests? It's kind of an anti-practice to do this, but I can create a video around it if you can give me some context please
@ffgaming-fe3cx9 ай бұрын
how to find multiple elements using python? which locator or selector should i need?
@CommitQuality9 ай бұрын
Use all to get them all playwright.dev/python/docs/api/class-locator#locator-all
@ffgaming-fe3cx9 ай бұрын
thank you@@CommitQuality
@hamzawaykonect201610 ай бұрын
hello sir thank u for explaining , i have 3 users role so i created 3 json , the third user dont wanna use any auth state he want to login from the start what should i do ? i create empty json noAuth.json but didnt work , i noticied each test i launched , he launch the 2 tests to create the 2 json files how can i avoid that i only launch them when i need the auth state
@CommitQuality10 ай бұрын
Good question. There are a few different ways you can achieve this. It depends on which one fits your need, but you can either do as you suggested and use an empty file (I wouldn't do that just because it's a bit out of place having a file that's just empty), but other options include, not setting an Auth file to select in your config, but that means in each test file you then have to specify it, which if you want that used everywhere, it becomes overkill, or the better option in my opinion, if you only want a few tests not logged in, clear all cookies before the test executed and that will set everything back to a non authenticated user.
@hamzawaykonect201610 ай бұрын
@@CommitQuality thanks for the suggestion ^^ i will do the cookies solution its seems great
@frols1 Жыл бұрын
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?
@CommitQuality Жыл бұрын
Yes that should work fine because the setup file should just be a basic playwright test (under the hood)
@alex_rpascual Жыл бұрын
Do you have any suggestions on testing oauth? I had issues with it and I suspect it's due to the provider interpreting my pw test as a bot or something.
@CommitQuality Жыл бұрын
What is the exact issue you are having?
@sakibahmed6051 Жыл бұрын
One issue i have is usiing UI mode, whenever i run a test, it reruns the setup project which is annoying. The auth file is already there. Why is it rerunning the setup project??? in your video it doesn't do that. so confused
@sakibahmed6051 Жыл бұрын
workaround is to untick the project in ui mode
@CommitQuality Жыл бұрын
Glad you found the resolution. I was going to say playwright made an update after this to uncheck the filter means it won't run the setup
@_unreal_engineer9 ай бұрын
I dont understand why i need setup project and teardown project for the setup and teardown method ? How can i define globalSetup and globalTeardown method ?
@CommitQuality9 ай бұрын
Sorry I don't understand your question. This video is the global setup example where you run once before all tests
@singh07neeraj8 ай бұрын
How to incease the session timeout as it is working for 4-5 test case after that Login screen started coming it means session is getting expired , I have more then 200 test case which run around 2 hours How to use it so that the session should not get expired
@CommitQuality8 ай бұрын
That's likely an issue you will want to solve with your authentication system. If it allows you can update the session timeout value when it's saved into the auth.jsok file, but if not you would need to do it via your Auth system
@singh07neeraj8 ай бұрын
@@CommitQuality after generating auth file I set "expires": -1, but looks like it is not working It run for 2-3 test case after that login screen starts coming it means the session has expired
@arjunsrajvth7 ай бұрын
This solution failed for me - It opens a blank page and stays idle after executing the login. It dies not execute the second test in same logged in session. I am using Playwright 1.38.0
@CommitQuality7 ай бұрын
Are you sure the logged in state was captured? Are you testing this on CommitQuality website?