/// <reference types="Cypress" />
context('Addition', () => {
beforeEach(() => {
cy.visit('http://localhost:3000/')
})
it('adds two numbers', () => {
//Start the test
cy.eyesOpen({
appName: 'Calculator',
testName: 'Add two numbers',
browser: { width: 800, height: 600 },
});
// click on number 8
cy.get("#root > div > div.component-button-panel > div:nth-child(2) > div:nth-child(2) > button")
.click()
// Take a snapshot of the calculator showing number 8 clicked
cy.eyesCheckWindow('Number 8 clicked');
// 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()
// Take a snapshot of the calculator showing the number 7 clicked
cy.eyesCheckWindow('Number 7 clicked');
// click on = operation
cy.get("#root > div > div.component-button-panel > div:nth-child(5) > div.component-button.orange > button")
.click()
// Take a snapshot of the calculator showing the result of number 15 displayed
cy.eyesCheckWindow('Display value of 15');
// validate the result is 15
cy.get("#root > div > div.component-display > div")
.contains('15')
//End Test
cy.eyesClose();
});
})