Skip to content

Commit 2bd89d4

Browse files
CeliantPyatakov
andauthored
Automation api tests (#4586)
* fix tests for Installer * fix non-smoke pull test run * update api manual workflow * updated documentation for tests: provide list of tests in smoke pull * add daily tests run * added tests for change password * added tests for policy tests * Update README.md * update docs --------- Co-authored-by: Alexander Pyatakov <[email protected]>
1 parent e8c47aa commit 2bd89d4

File tree

11 files changed

+608
-235
lines changed

11 files changed

+608
-235
lines changed

.github/workflows/api.yml

-152
This file was deleted.

e2e-tests/README.md

+69-80
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,124 @@
1-
# Guardian test automation
1+
# Guardian Test Automation
22

33
## 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.
135

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.
147

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)
1813

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.
1917

2018
## Installation
2119

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-
4120
### 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:
4322

4423
`npm install cypress --save-dev`
4524

25+
## Configuration
26+
27+
If you built the Guardian in Docker, set the `portApi` variable in `cypress.env.json` file.
4628

4729
## Usage
4830

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:
5032

5133
`npx cypress open`
5234

53-
To run all tests sequentially use:
35+
To run all tests sequentially, use:
5436

5537
`npx cypress run`
5638

57-
For a single test use:
39+
For a single test, use:
5840

59-
`npx cypress run --spec path/to/file.cy.js`
41+
`npx cypress run --spec "path/to/file.cy.js"`
6042

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":
6345

64-
`npx cypress run --env grepTags=@tag,grepFilterSpecs=true`
46+
`npx cypress run --env "grepTags=tag,grepFilterSpecs=true"`
6547

66-
where @tag can be:
48+
where `tag` can be:
6749
- 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
6853
- demo - all tests for demo operations
6954
- 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
7258
- policies - all tests for policies operations
73-
- dry-run - all tests for dry-run operations
7459
- profilies - all tests for profilies operations
7560
- 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
7763
- tokens - all tests for tokens operations
7864
- trustchains - all tests for trustchains operations
7965

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)
8767

8868
Only iREC5, iREC7 and Verra3 policies are covered.
8969

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.
9171

9272
```shell
9373
npm run ui-only
9474
```
9575

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:
10077

10178
`npx cypress open`
10279

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`.
10681

107-
The pull runs after any commit in guardian repository automatically.
82+
### API Tests
10883

109-
This command from /e2e-tests directory
84+
The following command runs all API tests.
11085

11186
```shell
112-
npm run smoke-pull
87+
npm run api-tests
11388
```
11489

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`.
11695

117-
Functionality testing by this pull:
96+
### Smoke Pull of API Tests
11897

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.
13299

133-
## Report
100+
The following command from the `/e2e-tests` directory runs smoke pull locally.
101+
102+
```shell
103+
npm run smoke-pull
104+
```
134105

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

Comments
 (0)