Cypress Beginner Tutorial 9 | Assertions
Automation Step by Step Automation Step by Step
511K subscribers
33,841 views
0

 Published On Sep 23, 2021

Cypress Quiz - https://automationstepbystep.com/quiz...
Stories by Raghav - https://automationstepbystep.com/stor...
Cypress Udemy Course - https://bit.ly/3wJAdjq
What is Cypress
Features of Cypress
How to setup Cypress project from scratch
Elements and Assertions
Cypress with JavaScript and TypeScript
Page Object Model
CLI
File Handling
Reporting
API Testing
Custom Commands
Cypress Dashboard
Cypress Studio
Git
Jenkins

Hi, In this video, we will start learning Assertions in Cypress

Implicit - in-built assertions
Command in cypress like should() check for the expected condition without having to use any assert or expect command separately
should( )
and( )

Explicit - not in-built or referred
Have to use specific assertion commands like assert() or expect()
expect( )
assert( )

Step 1 - Create a sample test for https://example.cypress.io/
Step 2 - Test the following assertions

should-contain
.should('contain', 'Button')

should-have
.should('have.class', 'query-btn')
have.text
have.html

should-be
.should('be.visible')
be.selected
be.disabled
be.focused

should-equal
.invoke('attr', 'id').should('equal', 'query-btn')

chained assertion
and

expect
expect(true).to.be.true

let name = 'cypress';
expect(name).to.be.equal('cypress')

to.not.equal()
to.be.a('string')
to.be.true
to.be.false
to.be.null
to.exist

assert
assert.equal
.notEqual
.true
.strictEqual
.false
.isAbove
.isString
.isBelow
.isNotString
.exists
.isNumber
.notExists
.isNotNumber

Join Automation Step By Step channel: https://www.youtube.com/automationste...
#CypressTutorial

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
To save cows - https://radhasurabhi.com/donate/

Never Stop Learning
Raghav

show more

Share/Embed