Writing test cases
When writing test cases, you should try to cover different scenarios, boundary cases, and potential errors. For a calculator application, you may want to test addition, subtraction, multiplication, and division operations under normal conditions and in borderline cases (such as division by zero).
Let’s complete our different contexts with our different tests.
Addition context
In this section, we’ll look at the various E2E test cases related to addition.
Adds two positive numbers correctly
In this test case, we will see how to write the E2E test to sum two positive numbers:
it('adds two positive numbers correctly', () => { cy.visit('http: //localhost:4200/'); cy.get('input').first().type('5'); cy.get('select').select('+').should('have.value', '+'); cy.get('input').last().type('3'); cy.get('button').click(); cy.get('p...