javaScriptCalculator

Cypress Tests

Create a simple calculator in JavaScript

Live demo

Define what buttons the user can click on and what each button does

We have the following buttons on our calculator:

Logic of these buttons

How do we code this logic?

We need to keep track of the previous button pressed before the current pressed value.

Testing

Use cypress for E2E testing:

npm init -y
npm install cypress --save-dev
# open Cypress.io test runner
node_modules/.bin/cypress open

Logic of what to test:

Let’s test the most likely thing a user would do, ie. the most used paths.

Edge cases

Things i learnt: