Cypress Hooks

Hooks are special methods that get executed before or after test.
  • before - This is executed before describe block.
  • after - This is executed after describe block..
  • beforeEach - This is executed before each test
  • afterEachThis is executed after each test

describe('Softpost Hook Test', function () {
    
    beforeEach(function(){
       cy.log('This will be executed before every test')
    })

    it('Sample Test', function (){
       
       cy.visit("https://softpost.org/selenium-test-page")
       
       cy.get('#fn').type(this.data.firstName)
    });
 });

                    

Web development and Automation testing

solutions delivered!!