Playwright Beginner Tutorial 9 | Assertions

preview_player
Показать описание
00:00 *Intro*

00:21 *What are Assertions*
Checks or Verification
Check actual = expected

00:56 *Assertions in Playwright*
Playwright Test uses expect library for test assertions

01:14 *How to add Assertions*

02:34 *Create a new Test*

05:10 *Command to Run the test*

06:37 *Check element Present/Not present*
await page.$('text=The Kitchen')

11:30 *Check element Visible/Hidden*

12:17 *Check element Enabled/Disabled*

15:23 *How to add Soft Assertions*
do not terminate test execution
mark the test as failed

16:50 *Check element Text matches value or not*

18:12 *Assert Element attribute *
await expect(locator).toHaveClass('selected row');

23:10 *Screenshot Moment*

23:12 *Check Url of the page*

24:28 *Check Title of the page*
await expect(page).toHaveTitle(/.*Kitchen/);

25:36 *Check Page matches screenshot* Visual Validation
await expect(page).toHaveScreenshot();

29:27 *Screenshot Moment | Outro*

#playwright #automation #testing

CI CD DEVOPS

UI TESTING

API TESTING

PERFORMANCE TESTING

IDE

PROGRAMMING

▬▬ BUILD TOOLS ▬▬

▬▬ SOURCE CODE MANAGEMENT ▬▬

▬▬ DATA FORMATS ▬▬

▬▬ RAGHAV PAL ▬▬

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

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
Рекомендации по теме
Комментарии
Автор

6:40 *Explore* button in the automatically opened browser
7:34 add *assertion* : check element present or not
8:04 *toHaveCount(x)*
9:04 locator with $ sign
11:02 helpful to use IT in a condition
11:42 check element hidden
15:25 *soft assertion*
19:55 use regular expression
26:00 toHaveScreenShot

ruixue
Автор

Best playwright series on Youtube. plz add more video.

eco
Автор

You are helping a lot of people and God will reward your for this ameen

Shahzilrind
Автор

Really enjoying these videos. Pace is just right and the quizzes are very useful for checking understanding. Thank you!

simonfermor
Автор

The screenshot feature is just awesome, I'd add it for each new page in my app....marvelously easy and useful.

parasharp
Автор

Hi Raghav

As always, thank you for such easy to understand learning sessions. Have a que - on my playwright inspector, I can't see "Explore".

I can only see "Locator" and "Log"

MamzP_
Автор

Hi Raghav,
Thank you for this wonderful session.
Can we click on PDF forms button using playwright. (Like: PDF appeared and then we have to click client consent "I Agree" button placed on PDF)

piyushpranav
Автор

Hi Raghav, can we pass the path where the screenshot to be saved. I may need to take multiple screenshot in a test or a page and dont want it to be overwritten. Thanks !

anandmohandas
Автор

Hello Sir,
You are doing such an amazing job, this way explanation is more useful for everyone like from scratch.

I have some doubts, I am a new in the playwright tool. i am used to selenium. now I want to move on Playwright. so,

1. if the playwright is handled automatically element/locator is visible/enable/clickable etc... before the transaction/action then why do we check manually? using assertion or if else condition.
2. if the timeout is set larger like 1 minute or maybe more so never get an error for that. ideally, our goal is once the element/locator is intractable then after performing action on it right? So why not set it this way.
3. how to get text from the element/locator so we can use in the next transaction.
4. In Selenium we have 2 options of locator like findElement and findElements then in Playwright, we have such things.
5. how to manage TAB, means opening new TAB/Window and action on it and returning back to the main TAB/Window.

NOTE-
can you create the one video where open the browser and open the appropriate URL and then perform some action on it and redirect to new TAB then perform actions on it and return to main.

here you can do like all the possible operations using different ways like
1. using different locators, like selector, XPath, id etc.... each one example
2. perform action on different elements like textbox, radio button, checkbox, list, dropdown etc....

this demo is more useful for everyone either newer or experience one as well.

also use this in any suitable or easy framework like POM.

nileshthummar
Автор

Thank you so much for this series..it is really helping me to learn..

tejashreerane
Автор

Thank you Raghav, you are my teacher in youtube. You help me to build knowledge in a very step-by-step way. I enjoy you being your student.
And I'm wondering, if it's possible and how to make a screenshot only in case of check failure?

manzhoska
Автор

thank you it is helping me a lot with my playwright journey

grooveneedy
Автор

Hi. i am running into a probelm. when i am waiting for a dynamically changing test on a button, my script is failing. what is the assertion i need to use to wait for the button toget updated with the expected text.

bobbilibiker
Автор

Lets say I already have an older screenshots which I had taken manually. How do I use it to assert with webpage. How and where to put its path in the code? Thanks in advance

cardozclive
Автор

there is a typo on the quiz

'await '

locator would not exist in the context by itself (it would be page.locator), but is a valid answer

CCleanerShot
Автор

hi~
And I suddenly got import and test in the middle, but I think the explanation of this part was omitted. Please explain!

D온뉘
Автор

Is it feasible to configure an automated email notification in case specific assertion or condition fails during script execution?

MudassirDar
Автор

Hi Raghav, In the playwright inspector tool am not seeing the explore option next to the playwright selector what u have in the video am only seeing pick up a locator are they both the same?

sirishapochiraju
Автор

Video was fantastic sir
i have worked in selenium and want to follow that POM but i have failed,
In sleneium i had a class where i passed all the paths
and in another class i had called the class and run it, but i have failed to do that in playwright, can you give a demo of that ?

aurigaqa
Автор

hey sir,
i really need your help . when i make soft.except and put the locator then use toHaveCount it will always provide an error even it is a soft how can i make it a soft exception i really need it

abdoubouji