Cypress Hooks - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Thursday, 16 July 2020

Cypress Hooks

Cypress Hooks

beforeEach
afterEach
before
after

describe('Practice Hooks',function(){

    before(function(){
        cy.log('***********This is SETUP Block**********')
    })
    
    after(function(){
        cy.log('***********This is TEAR DOWN Block**********')
        
    })
    
    beforeEach(function(){
        cy.log('***********This will be executed before Each test case**********')
        cy.visit('https://www.google.com/')
        cy.get('input[name="q"]').type('bugreaper.blogspot.com/')
        cy.get('input[name="btnK"]').click({force: true,multiple: true})
        
        
    })
    
    afterEach(function(){
        cy.log('***********This will be executed after  Each test case**********')
        cy.clearCookies
        
    })

    it('Test case 1',function(){
        cy.log('First test case')
        cy.visit('https://www.google.com/')
       
    })
  
    it('Test case 2',function(){
        cy.log('Second  test case')
        cy.visit('https://www.google.com/')
       
    })
    
})

Order Of Execution

Before
Before Each
After Each
After


No comments:

Post a Comment