lifen-autotest/README.md

2.2 KiB

Lifen Autotest Hangout with Simon Priet

This is a branch that does pure cypress code, and don't rely on gherkin and cypress-cucumber-preprocessor. It's less stable than the main branch and can be reviewed as extra work. If you did not reviewed the main branch, please inspect it first as it is intented to be the main hang out. I used pure js to code the automation, then refactored it to fit in the gherkin syntax. I found it was simpler for me to code first, then adapt the code to a feature file.

Currently, cypress is still challenged with a SMS code, and I have not implemented a workaround. Cypress wait 20 for the operator to put the code in the GUI, then continue. Please feel free to reconfigure your environment with your own phone number to try out. However, this automate can't be industrialized into a CI/CD pipeline.

I fond 2 tools that can help us more:

  • cypress-recurse 🌐 can retry several time a request until a certain condition is meet. This can help us wait for Irène to process the CommunicationRequest (draftsuspended), before going any further.
  • cypress-mailosaur 🌐 is a mail and text provided that can help us read texts content sent by the server to a predefined phone number, and work around the text code challenge.

Installation

The code has been written with VSC in mind, on a Windows 10 machine, so a launch.json is available to help run and debug the softwares. No helpers are available for other IDE.

  1. Clone the repo to your local computer. You will need the following requierement:
    • Node.js 16
    • Git
  2. Open a terminal in your project folder
  3. Purge the node_module folder ( rm -rf ./node_modules/)
  4. Run npm install to reinstall cypress and it's dependences according to your OS's environment. npm will use the package.json to find what to do.
  5. Type npm run test to launch the script. In VS code, run Test Cypress via NPM from the Run and Debug tab. The Launch.json file will trigger the test script configured in the package.json.
  6. On the cypress GUI, select
    • api to run test steps against the API,
    • inbox for some tests against the Inbox website.