Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cypress test case
/// <reference types="Cypress" />
context('Addition', () => {
beforeEach(() => {
cy.visit('http://localhost:3000/')
})
it('adds two numbers', () => {
// click on number 8
cy.get("#root > div > div.component-button-panel > div:nth-child(2) > div:nth-child(2) > button")
.click()
// click on + operation
cy.get("#root > div > div.component-button-panel > div:nth-child(4) > div.component-button.orange > button")
.click()
// click on number 7
cy.get("#root > div > div.component-button-panel > div:nth-child(2) > div:nth-child(1) > button")
.click()
// click on = operation
cy.get("#root > div > div.component-button-panel > div:nth-child(5) > div.component-button.orange > button")
.click()
// validate the result is 15
cy.get("#root > div > div.component-display > div")
.contains('15')
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment