From 997e0bcaae2c57c1f0b5927f6f726ec0ee83a5b2 Mon Sep 17 00:00:00 2001 From: Jose Emilio Labra Gayo Date: Tue, 19 Mar 2024 06:40:36 +0100 Subject: [PATCH] Small local changes --- README.md | 3 ++- webapp/README.md | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 806935e5..e78fdd6c 100644 --- a/README.md +++ b/README.md @@ -117,4 +117,5 @@ This action uses three secrets that must be configured in the repository: - DEPLOY_USER: user with permission to execute the commands in the remote machine. - DEPLOY_KEY: key to authenticate the user in the remote machine. -Note that this action logs in the remote machine and downloads the docker-compose file from the repository and launches it. Obviously, previous actions have been executed which have uploaded the docker images to the GitHub Packages repository. +Note that this action logs in the remote machine and downloads the docker-compose file from the repository and launches it. +Obviously, previous actions have been executed which have uploaded the docker images to the GitHub Packages repository. diff --git a/webapp/README.md b/webapp/README.md index 9568101e..33dd89a5 100644 --- a/webapp/README.md +++ b/webapp/README.md @@ -108,14 +108,21 @@ E2E tests are maybe the most difficult part to integrate in our system. We have In this project, the E2E testing user stories are defined using Cucumber. Cucumber uses a language called Gherkin to define the user stories. You can find the example in the `features` directory. Then, the actual tests are in the folder `steps`. We are going to configure jest to execute only the tests of this directory (check the `jest.config.ts` file in the `e2e` directory). -The E2E tests have two extra difficulties. The first one, we need a browser to perform the tests as if the user was using the application. For this matter, we use `jest-puppeteer` that will launch a Chromium instance for running the tests. The browser is started in the `beforeAll` function. Note that the browser is launched in a headless mode. This is necessary for the tests to run in the CI environment. If you want to debug the tests you can always turn this feature off. The second problem is that we need all our services at the same time to be able to run the tests. For achieving this, we are going to use the package `start-server-and-test`. This package, allows us to launch multiple servers and then run the tests. No need for any configuration. We can configure it straight in the `package.json` file: +The E2E tests have two extra difficulties. The first one, we need a browser to perform the tests as if the user was using the application. +For this matter, we use `jest-puppeteer` that will launch a Chromium instance for running the tests. +The browser is started in the `beforeAll` function. Note that the browser is launched in a headless mode. +This is necessary for the tests to run in the CI environment. If you want to debug the tests you can always turn this feature off. +The second problem is that we need all our services at the same time to be able to run the tests. +For achieving this, we are going to use the package `start-server-and-test`. +This package, allows us to launch multiple servers and then run the tests. +No need for any configuration. We can configure it straight in the `package.json` file: ```json "test:e2e": "start-server-and-test 'node e2e/test-environment-setup.js' http://localhost:8000/health prod 3000 \"cd e2e && jest\"", ``` -The package accepts pairs of parameters (launch a server and an URL to check if it is running. It also accepts npm commands (for instance prod, for the webapp, that will run `npm run prod`). The last parameter of the task will be launching Jest to run the E2E tests. +The package accepts pairs of parameters (launch a server and an URL to check if it is running. It also accepts npm commands (for instance prod, for the webapp, that will run `npm run prod`). The last parameter of the task will be launching Jest to run the e2e tests. Note that we are handling all the setup for the auth and user microservices using the file `test-environment-setup.js`. This file has the code needed to run everything, including an in-memory Mongo database to be able to execute the tests.