How to Write Test case in Cypress - 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

How to Write Test case in Cypress

Cypress test consists of
describe(): It is is simply a way to group our tests. It takes two arguments, the first is the name of the test group, and the second is a callback function. 

it(): We use it for an individual test case. It takes two arguments, a string explaining what the test should do, and a callback function which contains our actual test.

Test Case-->We will Open the page in different view ports

View ports can be found in 


First Test case

/// <reference types="cypress" />

context('Window', () => {
  beforeEach(() => {
    cy.visit('https://bugreaper.blogspot.com')
  })

  it('open in Mac 15', () => {
    // https://on.cypress.io/window
    cy.viewport('macbook-15')
    cy.screenshot()
    cy.wait(200)
  })

   it('open in Mac 13', () => {
    // https://on.cypress.io/window
    cy.viewport('macbook-13')
    cy.screenshot()
    cy.wait(200)
  })

    it('open in ipad-2', () => {
    // https://on.cypress.io/window
    cy.viewport('ipad-2')
    cy.screenshot()
    cy.wait(200)
  })
    
it('open in samsung-s10', () => {
    // https://on.cypress.io/window
    cy.viewport('samsung-s10')
    cy.screenshot()
    cy.wait(200)
  })
    
  
})

Now when you run this In cypress, after successfull run a Screenshot folder would be created and will have all screenshots











4 comments:

  1. i am glad to discover this page : i have to thank you for the time i spent on this especially great reading !! i really liked each part and also bookmarked you for new information on your site.
    Top QA Companies
    Top Automation Testing Companies
    Top Mobile App Testing Companies
    Top Performance Testing Companies
    Top Security Testing Companies

    ReplyDelete
  2. If you need an all-in-one HR solution, Clove HRMS provides a dependable Human Resource Management System with robust Payroll Management Software. It supports accurate payroll cycles, easy tax updates, and transparent payroll reporting. The user-friendly dashboard makes it simple for admins and employees to access important HR information, boosting engagement and reducing administrative overhead.

    ReplyDelete
  3. DevstringX Technologies stands out for its comprehensive software testing services in india, helping businesses release stable, defect-free software. Their capability spans functional and non-functional testing, automation frameworks, and CI/CD integration. With strong domain expertise and proactive defect prevention, they enhance product quality while shortening release cycles and boosting user satisfaction.

    ReplyDelete