Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit 85c1653

Browse files
Merge branch 'main' into ci/code-coverage
2 parents 6953b28 + 029cbb2 commit 85c1653

File tree

3 files changed

+173
-3
lines changed

3 files changed

+173
-3
lines changed

DEVELOPING.md

Lines changed: 144 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,149 @@
11
# Developing `trustify-tests`
22

3-
This document describes how to setup your environment to run the `trustify-tests`
4-
on your local environment.
3+
This document describes:
4+
5+
- the layout of the `trustify-tests` repository
6+
7+
- how to contribute a test
8+
9+
- how to setup your environment to run the `trustify-tests` on your local
10+
environment
11+
12+
## Repository Layout
13+
14+
The layout of the `trustify-tests` repository looks like follows:
15+
16+
```
17+
.
18+
├── package.json
19+
├── playwright.config.ts
20+
├── config
21+
├── etc
22+
└── tests
23+
├── api
24+
│   ├── fixtures.ts
25+
│   ├── client
26+
│   ├── dependencies
27+
│   ├── features
28+
│   └── helpers
29+
├── common
30+
│   ├── constants.ts
31+
│   └── assets
32+
│   ├── csaf
33+
│   └── sbom
34+
└── ui
35+
├── dependencies
36+
├── features
37+
│   ├── *.feature
38+
│   ├── @sbom-explorer
39+
│   └── @vulnerability-explorer
40+
├── helpers
41+
└── steps
42+
```
43+
44+
- `package.json` - project configuration the `npm` ([Node.js Package Manager](https://docs.npmjs.com/))
45+
understands; you can define your scripts (commands) here that you can then
46+
execute by `npm run <your command>`
47+
48+
- `playwright.config.ts` - a configuration for [Playwright](https://playwright.dev/docs/intro)
49+
and [Playwright-BDD](https://vitalets.github.io/playwright-bdd/#/)
50+
51+
- `config` contains configuration files that are common for the repository;
52+
currently it contains
53+
54+
- `openapi.yaml` - a file with the [Trustify](https://github.com/trustification/trustify)
55+
API definition; every time the file changes on the [Trustify](https://github.com/trustification/trustify)
56+
side it should be also updated here
57+
58+
- `openapi-ts.config.ts` - a configuration for `@hey-api/openapi-ts` telling
59+
it how to generate the content of `tests/api/client`; whenever this or
60+
`openapi.yaml` file changes `npm run openapi` should be executed to update
61+
the content of `tests/api/client`
62+
63+
- `etc` contains auxiliary files such as Podman/Docker compose files to start
64+
a Playwright container
65+
66+
- `tests/api` contains API tests organized as follows
67+
68+
- `fixtures.ts` - API tests fixtures written in TypeScript
69+
70+
- `client` contains a TypeScript interface to [Trustify](https://github.com/trustification/trustify)
71+
API generated from `config/openapi.yaml` by `npm run openapi`
72+
73+
- `dependencies` contains setup and tear down routines which are run before
74+
the start and after the end of the API test suite, respectively
75+
76+
- `features` contains API tests itself; `_openapi_client_examples.ts` shows
77+
how to use generated TypeScript interface to [Trustify](https://github.com/trustification/trustify)
78+
in API tests
79+
80+
- `helpers` contains auxiliary utilities used by API tests
81+
82+
- `tests/common` contains data and definitions shared by both API and UI tests
83+
84+
- `constants.ts` - constant definitions used by both API and UI tests
85+
86+
- `assets/csaf` contains compressed (`bz2`) samples of CSAF files
87+
88+
- `assets/sboms` contains compressed (`bz2`) samples of SBOM files
89+
90+
- `tests/ui` contains UI tests; UI tests are developed following BDD (Behavior
91+
Driven Development) methodology; the directory is organized as follows
92+
93+
- `dependencies` contains setup and tear down routines which are run before
94+
the start and after the end of the UI test suite, respectively
95+
96+
- `features` contains the UI tests itself; the content of the directory is
97+
further organized as follows
98+
99+
- `*.feature` files are test scenarios described in [Gherkin](https://cucumber.io/docs/gherkin/);
100+
`*.feature` files on the top level of the `tests/ui/features` directory
101+
describe scenarios that need to be implemented first in the [front end](https://github.com/trustification/trustify-ui);
102+
that is, they describe the expected front end behavior
103+
104+
- `@*` directories contain `*.feature` files and `*.step.ts` files used to
105+
test the so far implemented [front end](https://github.com/trustification/trustify-ui)
106+
features; see also [Tags from path](https://vitalets.github.io/playwright-bdd/#/writing-steps/scoped?id=tags-from-path)
107+
documentation
108+
109+
- `helpers` contains auxiliary utilities used by UI tests
110+
111+
- `steps` contains implementation of common BDD steps used in `tests/ui/features`
112+
113+
## Contributing a Test
114+
115+
To contribute an API test, put your code under the `tests/api/features` directory.
116+
If the test also contains a generic code that could be shared by more API tests,
117+
put that code under the `tests/api/helpers` directory. In a case that code is
118+
also intended to be shared by UI tests, put it under the `tests/common` directory
119+
instead. If you have also some assets that need to be contributed together with
120+
the test, put them under the `tests/common/assets` directory.
121+
122+
To contribute a UI (front end) test, put your code under the `tests/ui/features`
123+
directory. Depending on the status of a feature your test is trying to cover,
124+
there are two ways of how to proceed:
125+
126+
1. **A test is covering an implemented UI feature.** Put your test under
127+
a `tests/ui/features/@*` directory. You can choose from the existing or create
128+
your own depending on your use case.
129+
130+
1. **A test is covering a use case (scenario) not yet implemented.** Describe
131+
your use case in [Gherkin](https://cucumber.io/docs/gherkin/) and put it
132+
inside a `tests/ui/features/*.feature` file. The use case should be
133+
communicated with the [upstream](https://github.com/trustification/trustify-ui)
134+
before. Once the upstream implements the requested features covering your use
135+
case, the next step is to put your `*.feature` file(s) under a `tests/ui/features/@*`
136+
directory and implement missing steps to make it work under the Playwright
137+
BDD framework.
138+
139+
Other directories you should be interested in when contributing a UI test:
140+
141+
- `tests/common` (described earlier)
142+
143+
- `tests/ui/helpers` follows the same rules as `tests/api/helpers`
144+
145+
- `tests/ui/steps` is intended to be a right place for steps that are common
146+
across many use cases (scenarios)
5147

6148
## System Requirements
7149

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Feature: SBOM Explorer – View and Filter Package Licenses
2+
As a platform Eng
3+
I want to be able to view the licenses in specific SBOM when viewing the SBOM details in the UI.
4+
5+
Background: Authentication
6+
Given User is authenticated
7+
8+
Scenario: View per-package licence details for "<packageName>" in <sbomType> SBOM "<sbomName>"
9+
Given An ingested "<sbomType>" SBOM "<sbomName>" is available
10+
When User visits SBOM details Page of "<sbomName>"
11+
And User selects the Tab "Packages"
12+
Then The Package table contains the column "License"
13+
14+
When The "Name" column of the Package table contains "<packageName>"
15+
And User expands the package row "<packageName>"
16+
Then The expanded panel shows a section "Licenses"
17+
And The expanded panel lists at least one entry with "License Name" and "License Type"
18+
19+
Scenario: Search packages by licence "<licenseName>" in <sbomType> SBOM "<sbomName>"
20+
Given An ingested "<sbomType>" SBOM "<sbomName>" is available
21+
When User visits SBOM details Page of "<sbomName>"
22+
And User selects the Tab "Packages"
23+
When Search by FilterText "<licenseName>"
24+
Then The Package table total results is greater than 0
25+
And Every visible row in the Package table shows "<licenseName>" in the "License" column
26+
27+
When User clear all filters
28+
Then The Package table total results is greater than 1

tests/ui/features/vulnerability-explorer.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ Scenario: Display advisories tied to a single vulnerability
6868
Given User is on the Home page
6969
When User navigates to the Vulnerabilities Explorer page
7070
And User clicks on the Related Advisories tab
71-
Then The ID, Title, Aggregated severity, Revision and Vulnerabilities data should display for each advisory tied to the vulnerability
71+
Then The ID, Title, Revision and Vulnerabilities data should display for each advisory tied to the vulnerability
7272
And The ID should be a link to a corresponding Advisory Overview page

0 commit comments

Comments
 (0)