Playwright Beginner Tutorial 11 | Hooks & Groups

preview_player
Показать описание
00:00 *Intro*
00:24 *What are Hooks*
00:42 *How to use Group and Hooks in Playwright*
Step by Step hands-on demo

*Hooks:*
beforeAll
beforeEach
afterAll
afterEach

*Groups:*
describe

20:27 *Organising & Grouping Tests*
*beforeAll*
executed before all tests in the file
when used inside describe, runs before all tests in the group
If multiple beforeAll is used, they will run in the order of their registration

*beforeEach*
executed before each test in the file
when used inside describe, runs before each test in the group
If multiple beforeEach is used, they will run in the order of their registration

*afterAll*
executes after all tests in the file
when used inside describe, runs after all tests in the group
If multiple afterAll is used, they will run in the order of their registration

*afterEach*
executes after each test in the file
when used inside describe, runs after each test in the group
If multiple afterEach is used, they will run in the order of their registration

*CI CD DEVOPS*

*UI TESTING*

*API TESTING*

*MOBILE TESTING*

*PERFORMANCE TESTING*

*IDE*

*PROGRAMMING*

*BUILD TOOLS*

*SOURCE CODE MANAGEMENT*

*CLOUD SERVICES*

*DATA FORMATS*

*VIRTUALIZATION*

*OTHERS*

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Every LIKE & SUBSCRIPTION gives me great motivation to keep working for you

You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can

*NEVER STOP LEARNING*
Raghav Pal
Рекомендации по теме
Комментарии
Автор

Such a great teacher, thank you Raghav. Can you also teach Cucumber integration into Playwright and Jenkins please? This would be very helpful.

fusiform.g
Автор

Thanks much Raghav. Sending a support and appreciation from Bangkok, Thailand!

gowinidea
Автор

Wonderful videos! Thank you much for your effort!

paolamontanofernandez
Автор

thanks as usual, very easy and nicely explained

Floweenka
Автор

Crack!! mostro!! master!! muchisimas gracias Raghav, sos the best teacher!!😁👍

cristiancruciani
Автор

as usual thank you very much for your great work

ooozzzoo
Автор

Super bhargav thank you so much. Expecting more videos from you

parthipan
Автор

Thanks again for this tutorials :) great work.

jarver
Автор

Please release more playwright tutorial raghav, thank you for the videos

rianwardana
Автор

Thank you so much Raghav. Found it useful.
Getting an error though:
Error: "context" and "page" fixtures are not supported in "afterAll" since they are created on a per-test basis.
Help?

kaushiks
Автор

Hi @raghav, could you make a video please also about integration of cucumber into playwright and jenkins ! Thanks a lot

ayseturk
Автор

Hi Raghav, Thanks for your help, Please can you release one more video for POM Playwright with a detailed explanation.

kiranmaiisukapalii
Автор

Hello Raghav, I want to thank you for your hard work, you're a great teacher, thank you for doing this! I have a question for you: How does your playwright inspector provide comments for each step during recording? Mine just records the step without any comments.

rumpelshtilcken
Автор

Thank you for the amazing content Raghav. From what I understand, these hooks can be used in a file and so can the grouping in order to utilise their respective hooks. But what if I need to apply common hooks to more than one file? Is it a possibility? eg. I need to click on accept cookies button everytime a test case executes, can I have a hooks file which caters to the entire test suite?

kshitizsingh
Автор

Thanks for the videos

I have a question acording to use a login like a hook

I've heard about that every test need to be unique and not to depende to another ones, that's correct?

PerpetuoBeats
Автор

Thanks for the great content. I have a question about the afterAll hook. Im currently having an error that reads "Error: "context" and "page" fixtures are not supported in "afterAll"" when i try and run the test. I can't see any difference between our syntax. Any advice is appreciated!

mikeyjpk_
Автор

how to do for example I have multiple users with different passwords and I want to test each or how can I put random text into field or select random value from select box so for example when I run test it will select 1st value in dropdown but another run will select 3/5/10 etc so it is kind of random because i need to test if this value is selected in needs to execute test 3 but if this value is selected it needs to execute test number 9?

peterinvestor
Автор

Hi Raghav..

Could you please help in understanding the following error message:

TypeError: Cannot read properties of undefined (reading 'close')

17 |
18 | test.afterAll(async() => {
> 19 | await page.close();

sagarikamandal
Автор

First of all, thank you very much Raghav for these informative and useful recordings. I am repeating your tutorials exactly, but even though I run three tests (login, add to card, logout) with the same (npx playwright test --project chromium --headed) code, it runs separately with 3 separate workers (chrome), not one after the other with a single worker like yours. What could be the reason? Do I need a setting in the config file? Thank you in advance. Alparslan

alpozturk
Автор

Hi Raghav, I have a question. There is a vertical scrolling bar in my test. How would I be able to capture a vertical scrolling bar to get down to the bottom of the page. Thanks

sirishapochiraju