Playwright Test Fixtures Made Easy
Вставка
- Опубліковано 15 жов 2024
- Playwright Test is based on the concept of the test fixtures. Test fixtures are used to establish environment for each test, giving the test everything it needs and nothing else.
Playwright Test looks at each test declaration, analyses the set of fixtures the test needs and prepares those fixtures specifically for the test. Values prepared by the fixtures are merged into a single object that is available to the test, hooks, annotations and other fixtures as a first parameter.
Brilliant!!! Thanks for sharing your knowledge.
Super informative for someone who has recently started using playwright
Glad to hear it is helping
You are an amazing teacher 🙏🏻 looking for more videos on playwright
Thank you :) more are coming 😊
@@CommitQuality thank you do you mentor as well 🙏🏻
Its something I have done in the past & I have considered it online as part of memberships, however its finding the time and not spreading myself too thin.
A comprehensive video on fixtures. Waiting for some more content on fixtures
Thank you! The next released video will go over how to convert a hook into a fixture
Very good video, thank you. Would you use fixtures, like a code developer would use functions? Specifically for re-use. So have a Login fixture and a Logout fixture that could then be included and called by many other tests. Am I correct in my thinking or is there a better way for 're-usability' ?
I personally wouldn't use fixtures for Logging in each time. Instead I would save the state before all tests run (video coming in the next few weeks around this). I do have a video around using fixtures instead of using hooks though and that is definitely a use case. I wouldn't say fixtures replace functions though, there's definitely use cases for both.
@@CommitQuality Thank you. Look forward to your upcoming videos. 👍
Great video! One question - how can I add a page class to a helper.ts file for cases where I'm just trying to run some ancillary code to set up some test data? If the page classes are instantiated in the fixture how can I use them in other places than just "test" cases?
You can instantiate the classes like you would with any other class. You can view my page object model video which will provide examples of instantiating a class in a test without using fixtures ua-cam.com/video/Hp4QIBJO3yY/v-deo.htmlsi=-HlUMbSRBIwsUGGr
thanks a lot. great video
You are great! Thanks a lot!
Glad it helped!
Clearly explained. Thanks
Thank you !
thanks
Thank you!