Playwright Beginner Tutorial 9: Assertions ✅
Learn how to use assertions in Playwright for effective testing. Free course and quiz included for beginners.

Automation Step by Step
64.5K views • Sep 8, 2022

About this video
ALL FREE COURSES - https://automationstepbystep.com/
QUIZ - https://forms.gle/CyH64LrA39FLqbtC7
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*
04:07 *Demo App* https://kitchen.applitools.com/
05:10 *Command to Run the test*
06:37 *Check element Present/Not present*
await expect(page.locator('text=The Kitchen')).toHaveCount(1);
await page.$('text=The Kitchen')
11:30 *Check element Visible/Hidden*
await expect(page.locator('text=The Kitchen')).toBeVisible()
await expect(page.locator('text=The Kitchen')).toBeHidden()
12:17 *Check element Enabled/Disabled*
await expect(page.locator('text=The Kitchen')).toBeEnabled()
await expect(page.locator('text=The Kitchen')).toBeDisabled()
15:23 *How to add Soft Assertions*
do not terminate test execution
mark the test as failed
await expect.soft(page.locator('text=The Kitchen')).toHaveText('XYZ')
16:50 *Check element Text matches value or not*
await expect(page.locator('text=The Kitchen')).toHaveText('The Kitchen')
await expect(page.locator('text=The Kitchen')).not.toHaveText('ABCD')
18:12 *Assert Element attribute *
await expect(page.locator('selector')).toHaveAttribute('class', /.*value/)
await expect(locator).toHaveClass('selected row');
23:10 *Screenshot Moment*
23:12 *Check Url of the page*
await expect(page).toHaveURL(/kitchen.applitools.com/);
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
ASK RAGHAV ► https://bit.ly/2CoJGWf
CI CD DEVOPS
JENKINS BEGINNER ► https://bit.ly/2MIn8EC
JENKINS TIPS & TRICKS ►https://bit.ly/2LRt6xC
JENKINSFILE ► https://bit.ly/3JSMSZ7
DOCKER ► https://bit.ly/2MInnzx
KUBERNETES ► http://bit.ly/2MJIlMK
UI TESTING
SELENIUM BEGINNERS ► https://bit.ly/2MGRS8K
SELENIUM JAVA FRAMEWORK ► https://bit.ly/2N9xvR6
SELENIUM PYTHON ► https://bit.ly/2oyMp5x
SELENIUM TIPS ► https://bit.ly/2owxc50
SELENIUM BUILDER ► https://bit.ly/2MKNtlq
SELENIUM 4 ► https://bit.ly/3AiJOlP
KATALON STUDIO ► https://bit.ly/2wARFdi
ROBOT FRAMEWORK with RIDE ► https://bit.ly/2Px6Ue9
ROBOT FRAMEWORK with Eclipse► http://bit.ly/2N8DZxb
ACCELQ ► https://bit.ly/3PlsAsh
TEST PROJECT ► http://bit.ly/2DRNJYE
CUCUMBER BDD ► https://bit.ly/3Cnno4z
CYPRESS ► https://bit.ly/3PpEukM
API TESTING
WEB SERVICES (API) ► https://bit.ly/2MGafL7
SOAPUI ► https://bit.ly/2MGahmd
POSTMAN ► https://bit.ly/2wz8LrW
POSTMAN 2022 ► https://bit.ly/3JWm4qX
JMETER API TESTING ► https://bit.ly/3AgVPar
GENERAL ► https://bit.ly/2PYdwmV
KATALON STUDIO API ► https://bit.ly/2BwuCTN
REST ASSURED ► https://bit.ly/3zUdhRD
KARATE API ► https://bit.ly/3w3H5Ku
API MOCKING ► https://bit.ly/3bYPsjS
PERFORMANCE TESTING
JMETER BEGINNER ► https://bit.ly/2oBbtIU
GATLING ► https://bit.ly/3QrWfkV
IDE
ECLIPSE ► https://bit.ly/3AnRhQP
INTELLIJ IDEA ► https://bit.ly/3AnyDZ8
Visual Studio Code ► https://bit.ly/2V15yvt
PROGRAMMING
JAVA BEGINNERS ► https://bit.ly/2PVUcXs
JAVA TIPS & TRICKS ► https://bit.ly/2CdcDnJ
GROOVY ► https://bit.ly/2FvWV5C
JAVASCRIPT ► http://bit.ly/2KJDZ8o
TYPESCRIPT ► https://bit.ly/3dvJBmz
PYTHON ► http://bit.ly/2Z4iRye
▬▬ BUILD TOOLS ▬▬
MAVEN ► https://bit.ly/2NJdDRS
GRADLE ► http://bit.ly/30l3h1B
▬▬ SOURCE CODE MANAGEMENT ▬▬
GIT & GITHUB ►https://bit.ly/2Q1pagY
GITLAB ► http://bit.ly/2kQPGyQ
▬▬ DATA FORMATS ▬▬
JSON ► https://bit.ly/3w450tq
XML ► https://bit.ly/3PqRneH
▬▬ RAGHAV PAL ▬▬
UDEMY ► https://www.udemy.com/user/raghav-pal-3/
GITHUB PROJECTS ► https://github.com/Raghav-Pal/
STORIES BY RAGHAV ► https://automationstepbystep.com/stories/
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
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
QUIZ - https://forms.gle/CyH64LrA39FLqbtC7
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*
04:07 *Demo App* https://kitchen.applitools.com/
05:10 *Command to Run the test*
06:37 *Check element Present/Not present*
await expect(page.locator('text=The Kitchen')).toHaveCount(1);
await page.$('text=The Kitchen')
11:30 *Check element Visible/Hidden*
await expect(page.locator('text=The Kitchen')).toBeVisible()
await expect(page.locator('text=The Kitchen')).toBeHidden()
12:17 *Check element Enabled/Disabled*
await expect(page.locator('text=The Kitchen')).toBeEnabled()
await expect(page.locator('text=The Kitchen')).toBeDisabled()
15:23 *How to add Soft Assertions*
do not terminate test execution
mark the test as failed
await expect.soft(page.locator('text=The Kitchen')).toHaveText('XYZ')
16:50 *Check element Text matches value or not*
await expect(page.locator('text=The Kitchen')).toHaveText('The Kitchen')
await expect(page.locator('text=The Kitchen')).not.toHaveText('ABCD')
18:12 *Assert Element attribute *
await expect(page.locator('selector')).toHaveAttribute('class', /.*value/)
await expect(locator).toHaveClass('selected row');
23:10 *Screenshot Moment*
23:12 *Check Url of the page*
await expect(page).toHaveURL(/kitchen.applitools.com/);
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
ASK RAGHAV ► https://bit.ly/2CoJGWf
CI CD DEVOPS
JENKINS BEGINNER ► https://bit.ly/2MIn8EC
JENKINS TIPS & TRICKS ►https://bit.ly/2LRt6xC
JENKINSFILE ► https://bit.ly/3JSMSZ7
DOCKER ► https://bit.ly/2MInnzx
KUBERNETES ► http://bit.ly/2MJIlMK
UI TESTING
SELENIUM BEGINNERS ► https://bit.ly/2MGRS8K
SELENIUM JAVA FRAMEWORK ► https://bit.ly/2N9xvR6
SELENIUM PYTHON ► https://bit.ly/2oyMp5x
SELENIUM TIPS ► https://bit.ly/2owxc50
SELENIUM BUILDER ► https://bit.ly/2MKNtlq
SELENIUM 4 ► https://bit.ly/3AiJOlP
KATALON STUDIO ► https://bit.ly/2wARFdi
ROBOT FRAMEWORK with RIDE ► https://bit.ly/2Px6Ue9
ROBOT FRAMEWORK with Eclipse► http://bit.ly/2N8DZxb
ACCELQ ► https://bit.ly/3PlsAsh
TEST PROJECT ► http://bit.ly/2DRNJYE
CUCUMBER BDD ► https://bit.ly/3Cnno4z
CYPRESS ► https://bit.ly/3PpEukM
API TESTING
WEB SERVICES (API) ► https://bit.ly/2MGafL7
SOAPUI ► https://bit.ly/2MGahmd
POSTMAN ► https://bit.ly/2wz8LrW
POSTMAN 2022 ► https://bit.ly/3JWm4qX
JMETER API TESTING ► https://bit.ly/3AgVPar
GENERAL ► https://bit.ly/2PYdwmV
KATALON STUDIO API ► https://bit.ly/2BwuCTN
REST ASSURED ► https://bit.ly/3zUdhRD
KARATE API ► https://bit.ly/3w3H5Ku
API MOCKING ► https://bit.ly/3bYPsjS
PERFORMANCE TESTING
JMETER BEGINNER ► https://bit.ly/2oBbtIU
GATLING ► https://bit.ly/3QrWfkV
IDE
ECLIPSE ► https://bit.ly/3AnRhQP
INTELLIJ IDEA ► https://bit.ly/3AnyDZ8
Visual Studio Code ► https://bit.ly/2V15yvt
PROGRAMMING
JAVA BEGINNERS ► https://bit.ly/2PVUcXs
JAVA TIPS & TRICKS ► https://bit.ly/2CdcDnJ
GROOVY ► https://bit.ly/2FvWV5C
JAVASCRIPT ► http://bit.ly/2KJDZ8o
TYPESCRIPT ► https://bit.ly/3dvJBmz
PYTHON ► http://bit.ly/2Z4iRye
▬▬ BUILD TOOLS ▬▬
MAVEN ► https://bit.ly/2NJdDRS
GRADLE ► http://bit.ly/30l3h1B
▬▬ SOURCE CODE MANAGEMENT ▬▬
GIT & GITHUB ►https://bit.ly/2Q1pagY
GITLAB ► http://bit.ly/2kQPGyQ
▬▬ DATA FORMATS ▬▬
JSON ► https://bit.ly/3w450tq
XML ► https://bit.ly/3PqRneH
▬▬ RAGHAV PAL ▬▬
UDEMY ► https://www.udemy.com/user/raghav-pal-3/
GITHUB PROJECTS ► https://github.com/Raghav-Pal/
STORIES BY RAGHAV ► https://automationstepbystep.com/stories/
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
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
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
64.5K
Likes
613
Duration
29:49
Published
Sep 8, 2022
User Reviews
4.4
(12) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.