❗️ DO NOT clone the repo until step below named
Clone project
A test project that tests an API which returns exchange rates according to parameters specified in the request.
This project will require installation of Cypress in a project folder of your choice. As a pre-requisite, you will need node.js and npm.
The versions for this project are below:
npm versions 9.x.x
node.js 18.x and aboveVerify the version you have using
node -v
npm -vIf you do not have them installed, you can use the installer located here https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
Proceed to install Cypress by running this directly:
npm install cypressTo verify all has been installed properly, run
npx cypress openYou will also need to install cypress-plugin-api:
npm i cypress-plugin-apithen import the plugin into the cypress/support/e2e.js file
import 'cypress-plugin-api'After you have completed the above steps, ensure that you clone the project into your selected project folder
git clone https://github.com/canadianpython13/boc.gitcd boc
npm i
To run the test, ensure that you are in your project folder, then run:
npm run html-reportThis will run the test in headed mode in Chrome as configured. this can be changed in the package.json to run in headless mode, and change the default browser.
- Calculating the average of decimal numbers required a conversion of rates to whole numbers in order to maintain accuracy of calculation
Some additional steps if time permitted:
- parameterize url: exchange code, observation units (weeks, months, years), unit value
- Create fixtures to be able to reuse same test case with different values for exchange code, description, exchange label (CAD/AUD, CAD/EUR, etc.)
- Assertions for verifying correct format for date and rate
- Negative scenarios such as out of range/invalid month requests, invalid exchange codes in request, invalid observation units (hours, days)