From 7e0ee015b67cc2e97f97fc5172294da3e95f44ce Mon Sep 17 00:00:00 2001 From: Michal Polovka Date: Mon, 11 Mar 2024 13:45:34 +0100 Subject: [PATCH 1/4] Update README to include integration testing Signed-off-by: Michal Polovka --- README.md | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fd327327..a4a5f000 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ $ sudo dnf install vagrant vagrant-libvirt vagrant-sshfs 3. Start and provision the guest virtual machine: `vagrant up` -4. Add guest machine's IP address to your `/etc/hosts` pointing to its hostname, e.g: +4. Add guest machine's IP address to your `/etc/hosts` pointing to its hostname,~~~~ e.g: ``` 192.168.122.5 server.ipa.demo @@ -54,32 +54,32 @@ between your host or guest machine. > If you decide to use your guest machine, just ssh into it, go to the synced folder: > -> ``` +> ```bash > $ vagrant ssh > $ cd /usr/src/freeipa-webui/ > ``` Now you can install the project's dependencies: -``` +```bash $ npm install ``` To build (and watch the project for changes), run: -``` +```bash $ npm run start ``` You can serve the project using the following command: -``` +```bash $ npm run serve ``` You can also build and serve the project for production using the following command: -``` +```bash $ npm run build ``` @@ -94,9 +94,29 @@ The default credentials are **admin** and **Secret123**. ## Testing -TBD +### Integration tests + +Integration testing uses Cypress library, which runs Gherkin-defined steps. + +#### Launching the existing tests + +> [!WARNING] +> Never run integration tests on production server. Clean-up step would delete all existing entries, e.g. users. + +1. Prepare a vagrant server as in `Development Environment` +2. if you want to launch all the tests in headless mode, execute + +```bash +$ npm run cypress +``` + +if you want to open graphical debugger, execute + +```bash +$ npm run cypress:open +``` -- [audit-ci](https://github.com/IBM/audit-ci) +and select desired feature file you want to execute. ## License From e92304697bc648066ac7de3f88f81b8e715fa58c Mon Sep 17 00:00:00 2001 From: David Hanina Date: Mon, 24 Feb 2025 17:46:01 +0100 Subject: [PATCH 2/4] Add unit tests Also added description for the unit tests and a note explaining, which to use. Fixes: #210 Signed-off-by: David Hanina --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4a5f000..2307303c 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ The default credentials are **admin** and **Secret123**. ### Integration tests -Integration testing uses Cypress library, which runs Gherkin-defined steps. +Integration testing uses [Cypress](https://www.cypress.io) library, which runs [Gherkin-defined](https://cucumber.io/docs/gherkin) steps. #### Launching the existing tests @@ -118,6 +118,28 @@ $ npm run cypress:open and select desired feature file you want to execute. +#### Adding new tests + +The integration tests use the **.feature** suffix and can be found in the *tests* subfolder, together with the steps describing each feature. + +### Unit tests + +Unit tests use [jest](https://jestjs.io). + +#### Launching the existing tests + +The existing tests can be launched by executing + +```bash +$ npm run test +``` + +#### Adding new tests + +The unit tests live, where the component that is being tested lives, the name should be the same, only with the **.test.tsx** suffix instead. + +If you require FreeIPA to be running, please use integration tests instead. + ## License FreeIPA Web UI is licensed under the [GPLv3+](./COPYING) as From 1ef71857abdcecc09522cd04e5156b373937fa88 Mon Sep 17 00:00:00 2001 From: David Hanina Date: Mon, 24 Feb 2025 17:47:18 +0100 Subject: [PATCH 3/4] Clear typo Signed-off-by: David Hanina --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2307303c..2ad473db 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ $ sudo dnf install vagrant vagrant-libvirt vagrant-sshfs 3. Start and provision the guest virtual machine: `vagrant up` -4. Add guest machine's IP address to your `/etc/hosts` pointing to its hostname,~~~~ e.g: +4. Add guest machine's IP address to your `/etc/hosts` pointing to its hostname, e.g: ``` 192.168.122.5 server.ipa.demo From ac0c8e1aa60cb371cbb7330e8f04ea2bf0d82a22 Mon Sep 17 00:00:00 2001 From: David Hanina Date: Tue, 25 Feb 2025 10:13:45 +0100 Subject: [PATCH 4/4] Fix italic in markdown Signed-off-by: David Hanina --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ad473db..acf76b25 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ and select desired feature file you want to execute. #### Adding new tests -The integration tests use the **.feature** suffix and can be found in the *tests* subfolder, together with the steps describing each feature. +The integration tests use the **.feature** suffix and can be found in the _tests_ subfolder, together with the steps describing each feature. ### Unit tests