Cypress, Mocha ve Chai gibi çeşitli kütüphanelerden elde edilen birden fazla assertion türüne sahiptir.
Implicit Assertions
describe('Assertion Lesson', function () {
it('Scenario 1', function (){
// test step to launch a URL
cy.visit("https://www.iddaa.com")
// assertion to validate count of sub-elements and class attribute value
cy.get('.toc chapters').find('li').should('have.length',5)
.and('have.class', 'dropdown')
});
});
Explicit Assertions
describe('Tutorialspoint', function () {
// it function to identify test
it('Scenario 1', function (){
// test step to launch a URL
cy.visit("https://accounts.google.com")
// identify element
cy.get('h1#headingText').find('span').then(function(e){
const t = e.text()
// assertion expect
expect(t).to.contains('Sign')
})
})
})