25 lines
2.4 KiB
Markdown
25 lines
2.4 KiB
Markdown
# Lifen Autotest Hangout with Simon Priet
|
|
|
|
Please find in this project my hangout of your technical test. The test is performed with `cypress`, and include `cypress-cucumber-preprocessor`. This module process `.feature` files (they carry the test case in Gherkin syntax) and find matching `.js` files to run them by cypress runner. I initially coded cypress to do the part 2 only, but took time to include the part one as well. Now cypress run the api to generate the communication with the document, then connect the user to send the mail.
|
|
|
|
Currently, cypress is still challenged with a SMS code, and I have not implemented a workaround. Cypress wait 20 for me 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` 🌐](https://github.com/bahmutov/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 (`draft` → `suspended`), before going any further.
|
|
* [`cypress-mailosaur` 🌐](https://mailosaur.com/docs/frameworks-and-tools/cypress/) is a mail and text provider that can help us read texts content sent by the server to a predefined phone number, and work around the text code challenge.
|
|
|
|
Please note the existance of a 'pure cypress' branch on this repo that doesn't rely on BDD.
|
|
|
|
## Installation
|
|
|
|
The code has been written with VSC in mind, on a Windows 10 machine, so a `launch.json` configuration file is available to help run and debug the software. 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
|
|
2. Purge the `node_module` folder ( `rm -rf ./node_modules/`)
|
|
3. 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.
|
|
2. 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 `sendDocument` for the throughout test, and `inbox` for some subtests in the Inbox website. |