Hi, In grouping test, while maintaining same page between test as mentioned in your vid about using page once in beforeAll, how to use fixtures in same scenario ?
@@letcode I watched the next part-26, there its mentioned with fixtures we can not achieve same context across the test in a describe. So, if we want to use same context, fixtures can't be used.
ji Actually first i choose the protractor for angular web automation..after seen your video i will choose the playwright...i give the poc to my TL about protractor because of stackholder report we can add easily in protractor..finally i saw one video protractor is dead.on that movement i stop to implementation of protractor.all are need open source only.even most of the company cost wise they analysed so i choose this playwright...is it good and i am new to this automation.i already create our own framework stuff.so we choose this playwright for implementation.no one video told about your in depth experience.thanks a lot koushik...i try to create the web automation with this...
Hi @letcode How will continue with test in sequence if the the browser is closing and opening again for another test for another test I will have to again write the code for login
Hi Kaushik, I have a doubt. lets say I have 3 tests inside describe block. 1) I want to run my 2nd and 3rd test only if 1st test is passed.(something like depends method in selenium). can you guide. 2) If my first test is failed, then 2nd and 3rd should be skipped.
can you tell which one is best in prod. is it playwright test runner or jest config..according to your tutorials playwright is very easy i think so and eaily config with one single configuration file.
@@letcode Thanks bro...Actually i am also new and if some one like you already seen this so i asked this...then only i had a confident to implement in my project so that only i ask...
Hi, Page is the class and page is the object that is coming from the fixture. So within the test block ({page}) right that is fixtures. That means the page object is already created we are just using it.
Hi Koushik, Could you please suggest how to write test.beforeAll() function that should execute only ONCE before all the test methods that are present in all the test files (i.e. *.test.ts files). In TestNG I know that this can be achieved by writing it in the BaseTest method. But here the test files are not classes right.
It is not possible as per my knowledge. We don't write test in classes so inheritance support also not here. Before all hooks run before all the test but with in a file. How ever you can achieve based on the fixture concept that we have in playwright test runner..
@@letcode But even with fixtures, not sure how to achieve it across multiple files. Is it possible to give me a sample program? All that I need to achieve is to call some shell script/python script at the end of executing all the test cases that are scattered across multiple test files. Inorder to achieve that, I should have something similar to @AfterSuite in TestNG.
Hi Kaushik, My scenario is capturing the getattribute value in a variable in one test and then compare that variable data in next test scope. so where this variable have to declare so that in can use the same variable in consecutive test scope. below is my requirement: test('Step1', async () => { const abc= page.locator("").getAtribute(''); }); test('Step2', async () => { const def = await page.locator(' ').getAtribute(''); await expect(abc).toEqual(def); });
@@letcode I’m sorry I should have explained a bit better when I start test execution I log in one time and use the same log in for every test skipping authentication by saving login in storage state. I want to use the afterAll hook to log out of the application once all tests are complete but idk how to do that because the afterAll hook does not take the Page object and I cannot figure out how to go to the base url in the afterAll hook
@@letcode i actually figured it out, afterAll is not viable to use for the use case i explained, correct way to do it is to create a global teardown and add that to the config file
Hi Koushik, I tried however, function in page are running fast compare to test case. Slowmo is applicable to page level functions. How to slowdown execution. Please help
Hello 👋 guys
Hi, In grouping test, while maintaining same page between test as mentioned in your vid about using page once in beforeAll, how to use fixtures in same scenario ?
Hi, i have covered that in the following video.
@@letcode I watched the next part-26, there its mentioned with fixtures we can not achieve same context across the test in a describe. So, if we want to use same context, fixtures can't be used.
@@rohanp2466 yes, that is the disadvantage, i asked to the playwright team and they said this is how fixtures is designed.
@@letcode Thank you
ji Actually first i choose the protractor for angular web automation..after seen your video i will choose the playwright...i give the poc to my TL about protractor because of stackholder report we can add easily in protractor..finally i saw one video protractor is dead.on that movement i stop to implementation of protractor.all are need open source only.even most of the company cost wise they analysed so i choose this playwright...is it good and i am new to this automation.i already create our own framework stuff.so we choose this playwright for implementation.no one video told about your in depth experience.thanks a lot koushik...i try to create the web automation with this...
Happy automation brother.
Playwright is really good and better than protractor.
Hi @letcode
How will continue with test in sequence if the the browser is closing and opening again for another test
for another test I will have to again write the code for login
Storage state is used to handle the login.
Hi Kaushik, I have a doubt. lets say I have 3 tests inside describe block.
1) I want to run my 2nd and 3rd test only if 1st test is passed.(something like depends method in selenium). can you guide.
2) If my first test is failed, then 2nd and 3rd should be skipped.
Hi, you can use test.deecribe.serial
If any one of the tests fail the next tests will be skipped.
can you tell which one is best in prod. is it playwright test runner or jest config..according to your tutorials playwright is very easy i think so and eaily config with one single configuration file.
Test runner is better, trust me go for it 😊
@@letcode Thanks bro...Actually i am also new and if some one like you already seen this so i asked this...then only i had a confident to implement in my project so that only i ask...
Hi Koushik, I have a doubt here. Why did you use Page instead of page?
Hi, Page is the class and page is the object that is coming from the fixture.
So within the test block ({page}) right that is fixtures.
That means the page object is already created we are just using it.
@@letcode thanks koushik but with this implementation will we be able to achive parallel exeucution
100% yes.
I have covered the fixture in detail, you can refer to that video.
@@letcode superb . But this is not working for me. I am using js. Is there any new changes
No change, use the latest version.
Hi Koushik,
Could you please suggest how to write test.beforeAll() function that should execute only ONCE before all the test methods that are present in all the test files (i.e. *.test.ts files). In TestNG I know that this can be achieved by writing it in the BaseTest method. But here the test files are not classes right.
It is not possible as per my knowledge.
We don't write test in classes so inheritance support also not here.
Before all hooks run before all the test but with in a file.
How ever you can achieve based on the fixture concept that we have in playwright test runner..
@@letcode But even with fixtures, not sure how to achieve it across multiple files. Is it possible to give me a sample program? All that I need to achieve is to call some shell script/python script at the end of executing all the test cases that are scattered across multiple test files. Inorder to achieve that, I should have something similar to @AfterSuite in TestNG.
Sure, I will upload a sample video by this weekend.
@@letcode Thank you so much.
Hi Kaushik,
My scenario is capturing the getattribute value in a variable in one test and then compare that variable data in next test scope. so where this variable have to declare so that in can use the same variable in consecutive test scope. below is my requirement:
test('Step1', async () => {
const abc= page.locator("").getAtribute('');
});
test('Step2', async () => {
const def = await page.locator(' ').getAtribute('');
await expect(abc).toEqual(def);
});
Can you please help me how I can achieve this
Change the scope to file level.
Eg.
Let abc;
Test block
Abc = get attribute
Another test block
Use abc
very helpful 👍
I cannot figure out how to log out of my tests after test execution, can you create a video detailing how to log out using test.afterall ?
Log out is the sense ?
@@letcode I’m sorry I should have explained a bit better when I start test execution I log in one time and use the same log in for every test skipping authentication by saving login in storage state.
I want to use the afterAll hook to log out of the application once all tests are complete but idk how to do that because the afterAll hook does not take the Page object and I cannot figure out how to go to the base url in the afterAll hook
@@3D0OM ok gotcha now. Will make a video on this.
@@letcode thank you so much!!!
@@letcode i actually figured it out, afterAll is not viable to use for the use case i explained, correct way to do it is to create a global teardown and add that to the config file
How to pass the previous tests test data to the next test in a single spec file?
You can store the data in JSON, and use the same in multiple test.
Hi Koushik,
I tried however, function in page are running fast compare to test case. Slowmo is applicable to page level functions. How to slowdown execution. Please help
To slow do the test we can use slow Mo option.
For a static wait we can use waitForTimeout
Thanks a lot!
👍👍👌👌
❤️