More Actions Using Cypress

These are some common actions used in Cypress
  •  Back (browser)
    • cy.go('back')
  • Forward
    • cy.go('forward')
  • Reload
    • cy.reload()
    • cy.reload(true) : without caching
  • Verify title content
    • cy.title().should('include' ,'Text')
  • Verify url content
    • cy.url().should('include', 'contactus')
  • Remove logs printing in the cypress log
    • cy.intercept({resourcetype : /xhr|fetch/} , {log : false})
  • Checkbox actions
    • check
      • cy.get('.element').check().should('be.checked')
    • uncheck
      • cy.get('.element').uncheck().should('not.be.checked')
    • check multiple checkboxes - using value attribute in inspect elements
      • cy.get('.element').check('option-1', 'option-2', 'option-3').should('be.checked')
  • Radio buttons
    • check
      • cy.get('.element').check().should('be.checked')
    • disabled 
      • cy.get('.element').should('be.disabled')
  • Drop down list
    • select item
      • cy.get('.element').select('value 1').should('have.value', 'value 1')
      • cy.get('.element').select('value 1').contains('value 1')
  • Verify background color
    • .... expect($element).to,have.css('background-color', 'rgb(0,255,0)')

No comments:

Post a Comment