|
1 |
| -# Guardian test automation |
| 1 | +# Guardian Test Automation |
2 | 2 |
|
3 | 3 | ## Description
|
4 |
| -The /e2e-tests folder comprises guardian Cypress test automation framework and automated UI and API tests |
5 |
| -- [Software requirements](#software-requirements) |
6 |
| -- [Installation](#installation) |
7 |
| -- [Configuration](#configuration) |
8 |
| -- [Usage](#usage) |
9 |
| - |
10 |
| -## Software requirements |
11 |
| -- Node.js 12 or 14 and above |
12 |
| -- Follow steps from the [README](https://github.com/hashgraph/guardian/blob/main/README.md) to install and deploy Guardian application |
| 4 | +The `/e2e-tests` folder comprises the Guardian Cypress test automation framework and automated UI and API tests. |
13 | 5 |
|
| 6 | +When running API tests, remember that they depend on each other. It is recommended to run them sequentially, following the order specified in the `/e2e-tests` folder. |
14 | 7 |
|
15 |
| -## Configuration |
16 |
| -In cypress.env.json file update `authorization` key with `access_key` value which will be assigned to the RootAuthority after registartation (bearerAuth) |
17 |
| -If you manually built every component in guardian, set the propper url to `api-server` key. |
| 8 | +- [Software Requirements](#software-requirements) |
| 9 | +- [Installation](#installation) |
| 10 | +- [Configuration](#installation) |
| 11 | +- [Usage](#usage) |
| 12 | +- [Report](#report) |
18 | 13 |
|
| 14 | +## Software Requirements |
| 15 | +- Node.js 20 and above |
| 16 | +- Follow steps from the [README](https://github.com/hashgraph/guardian/blob/main/README.md) to install and deploy the Guardian application. |
19 | 17 |
|
20 | 18 | ## Installation
|
21 | 19 |
|
22 |
| -### Automatic with Docker |
23 |
| - |
24 |
| -From /e2e-tests folder: |
25 |
| - |
26 |
| - ```shell |
27 |
| - docker-compose build |
28 |
| - ``` |
29 |
| - |
30 |
| -To run all tests sequentially in Docker use: |
31 |
| - |
32 |
| - ```shell |
33 |
| - docker-compose run cypress-tests |
34 |
| - ``` |
35 |
| - |
36 |
| -With specific port: |
37 |
| - ```shell |
38 |
| - docker-compose run cypress-tests -e PORT=3000 |
39 |
| - ``` |
40 |
| - |
41 | 20 | ### Manual
|
42 |
| -From /e2e-tests folder run the following command to install Cypress: |
| 21 | +From the `/e2e-tests` folder, run the following command to install Cypress: |
43 | 22 |
|
44 | 23 | `npm install cypress --save-dev`
|
45 | 24 |
|
| 25 | +## Configuration |
| 26 | + |
| 27 | +If you built the Guardian in Docker, set the `portApi` variable in `cypress.env.json` file. |
46 | 28 |
|
47 | 29 | ## Usage
|
48 | 30 |
|
49 |
| -To run a specific test from UI you can open Cypress dashboard by running the following command from /e2e-tests folder: |
| 31 | +To run a specific test from the UI, you can open the Cypress dashboard by running the following command from the `/e2e-tests` folder: |
50 | 32 |
|
51 | 33 | `npx cypress open`
|
52 | 34 |
|
53 |
| -To run all tests sequentially use: |
| 35 | +To run all tests sequentially, use: |
54 | 36 |
|
55 | 37 | `npx cypress run`
|
56 | 38 |
|
57 |
| -For a single test use: |
| 39 | +For a single test, use: |
58 | 40 |
|
59 |
| -`npx cypress run --spec path/to/file.cy.js` |
| 41 | +`npx cypress run --spec "path/to/file.cy.js"` |
60 | 42 |
|
61 |
| -## Run by tag |
62 |
| -To run only the specs that have any tests tagged "@tag": |
| 43 | +### Run By Tag |
| 44 | +To run only the specs that have any tests tagged "tag": |
63 | 45 |
|
64 |
| -`npx cypress run --env grepTags=@tag,grepFilterSpecs=true` |
| 46 | +`npx cypress run --env "grepTags=tag,grepFilterSpecs=true"` |
65 | 47 |
|
66 |
| -where @tag can be: |
| 48 | +where `tag` can be: |
67 | 49 | - accounts - all tests for accounts operations
|
| 50 | +- analytics - all tests for analytics operations |
| 51 | +- artifacts - - all tests for artifacts operations |
| 52 | +- contracs - all tests for contracs operations |
68 | 53 | - demo - all tests for demo operations
|
69 | 54 | - external - all tests for external operations
|
70 |
| -- ipfs - all tests for ipfs operations |
71 |
| -- logs - - all tests for logs operations |
| 55 | +- ipfs - all tests for IPFS operations |
| 56 | +- logs - - all tests for log operations |
| 57 | +- modules - - all tests for modules operations |
72 | 58 | - policies - all tests for policies operations
|
73 |
| -- dry-run - all tests for dry-run operations |
74 | 59 | - profilies - all tests for profilies operations
|
75 | 60 | - schemas - all tests for schemas operations
|
76 |
| -- settings - all tests for settings operations |
| 61 | +- settings - - all tests for settings operations |
| 62 | +- tags - all tests for tags operations |
77 | 63 | - tokens - all tests for tokens operations
|
78 | 64 | - trustchains - all tests for trustchains operations
|
79 | 65 |
|
80 |
| - |
81 |
| -To run in Docker |
82 |
| - ```shell |
83 |
| - TAG=<TEST-TAG> docker-compose run --entrypoint="npm run test-tag" cypress-tests |
84 |
| - ``` |
85 |
| - |
86 |
| -## UI tests (Policies) |
| 66 | +### UI Tests (Policies) |
87 | 67 |
|
88 | 68 | Only iREC5, iREC7 and Verra3 policies are covered.
|
89 | 69 |
|
90 |
| -A command |
| 70 | +The following command runs all UI tests in an interactive dashboard that allows you to see the status of the tests while they are running and simultaneously view the application under test. |
91 | 71 |
|
92 | 72 | ```shell
|
93 | 73 | npm run ui-only
|
94 | 74 | ```
|
95 | 75 |
|
96 |
| -runs all ui tests in a interactive dashboard that allows you to see the status of the tests while they are running and at the same time view the application under test. |
97 |
| - |
98 |
| - |
99 |
| -To run a UI test for specific policy you can open Cypress dashboard by running the following command from /e2e-tests folder: |
| 76 | +To run a UI test for a specific policy, you can open the Cypress dashboard by running the following command from the `/e2e-tests` folder: |
100 | 77 |
|
101 | 78 | `npx cypress open`
|
102 | 79 |
|
103 |
| -and then select test under ui-tests/specs/policies |
104 |
| - |
105 |
| -## Smoke pull of API-tests |
| 80 | +and then select a test under `ui-tests/specs/policies`. |
106 | 81 |
|
107 |
| -The pull runs after any commit in guardian repository automatically. |
| 82 | +### API Tests |
108 | 83 |
|
109 |
| -This command from /e2e-tests directory |
| 84 | +The following command runs all API tests. |
110 | 85 |
|
111 | 86 | ```shell
|
112 |
| - npm run smoke-pull |
| 87 | + npm run api-tests |
113 | 88 | ```
|
114 | 89 |
|
115 |
| -runs smoke pull locally. |
| 90 | +To run a API test for a specific functionality, you can open the Cypress dashboard by running the following command from the `/e2e-tests` folder: |
| 91 | + |
| 92 | +`npx cypress open` |
| 93 | + |
| 94 | +and then select a test under `/api-tests`. |
116 | 95 |
|
117 |
| -Functionality testing by this pull: |
| 96 | +### Smoke Pull of API Tests |
118 | 97 |
|
119 |
| -- login by Standard Registry user |
120 |
| -- register and login as new user |
121 |
| -- sends data from an external source(IPFS external node) |
122 |
| -- get current settings |
123 |
| -- set settings |
124 |
| -- get, import(file and IPFS) and delete modules |
125 |
| -- get, upload and delete artifacts |
126 |
| -- get, import, delete, dry-run and publish policies(i-Rec2, i-Rec4, Remote GHG Policy) |
127 |
| -- get, create, publish, freeze\unfreeze, associate\disassociate and grant\revoke KYC tokens |
128 |
| -- get, import(file and IPFS), publish, delete schemas |
129 |
| -- compare modules, policies, schemas and tools |
130 |
| -- create contracts, create retire pools, approve wipe contrat requests, create retire requests |
131 |
| -- create contract, module, policy and schema tags |
| 98 | +The pull runs automatically after any commit in the Guardian repository. |
132 | 99 |
|
133 |
| -## Report |
| 100 | +The following command from the `/e2e-tests` directory runs smoke pull locally. |
| 101 | + |
| 102 | + ```shell |
| 103 | + npm run smoke-pull |
| 104 | + ``` |
134 | 105 |
|
135 |
| -After launching the tests a folder `cypress/reports` will be generated in which you can find the `index.html` file, after opening it in the browser, you can see the details of the launch of the tests. |
| 106 | +Functionality covered by this pull includes: |
| 107 | + |
| 108 | +- Login by Standard Registry user |
| 109 | +- Register and login as a new user |
| 110 | +- Send data from an external source (IPFS external node) |
| 111 | +- Get current settings |
| 112 | +- Set settings |
| 113 | +- Get, import (file and IPFS), and delete modules |
| 114 | +- Get, upload, and delete artifacts |
| 115 | +- Get, import, delete, dry-run, and publish policies (iREC2, iREC4, Remote GHG Policy) |
| 116 | +- Get, create, publish, freeze/unfreeze, associate/disassociate, and grant/revoke KYC tokens |
| 117 | +- Get, import (file and IPFS), publish, and delete schemas |
| 118 | +- Compare modules, policies, schemas, and tools |
| 119 | +- Create contracts, create retire pools, approve wipe contract requests, and create retire requests |
| 120 | +- Create contract, module, policy, and schema tags |
| 121 | + |
| 122 | +## Report |
| 123 | + |
| 124 | +After launching the tests, a folder `cypress/reports` will be generated. Inside you can find the `index.html` file. Opening this file in a browser allows you to see the details of the test run. |
0 commit comments