End-to-End Testing
The CI/CD job called E2E Testing is run on the latest version of the Ubuntu operating system and depends on the previously executed Linting job. It is intended to run end-to-end (E2E) tests, generate e2e testing reports and upload these reports as artefacts for later use.
Pipeline job snippet
Description
Checkout repository: uses the actions/checkout@v4 action to download the content of the repository to the working environment. This step ensures that the repository will be available for further steps in the workflow.
Setup node.js: uses the actions/setup-node@v4 action to set up the Node.js environment. The version of Node.js (node-version: 18.x) to be used in this work is specified.
Use cached node_modules: executes the command "npm ci --cache ~/.npm" to use cached npm modules. This step ensures faster dependency installation as it uses caching.
Build application: executes the "npm run build" command to build the application. This step prepares the application for launching and testing.
Start server: executes the "npm run start &" command to start the server in the background. This step allows the application to run while the tests are running.
Wait for server to start: executes the "npx wait-on http://localhost:3000" command to wait for the server to become available at the specified URL. This step ensures that the server is fully booted before testing starts.
Run e2e tests: executes the command "npx cypress run --reporter junit --reporter-options mochaFile=reports/TEST-[hash].xml" to run end-to-end tests using the Cypress tool. This step generates a test report in JUnit format.
Upload e2e testing report: uses the actions/upload-artifact@v4 action to upload the E2E testing report as an artifact. The report is uploaded with a retention time of 5 days (retention-days: 5), allowing later review and analysis of the testing results.
python setup: uses the actions/setup-python@v3 action to set up the Python environment. The Python version (python-version: '3.x') to be used in the next step is specified.
Upload e2e testing results to TestRail: this step, which is executed regardless of the success of the previous steps (command "if: always()"), involves uploading the testing results to the TestRail portal. Using environment variables and commands, the results are aggregated and uploaded to the TestRail portal, allowing further analysis and tracking of the test results.