Skip to content

Commit 0ccecab

Browse files
Merge branch 'main' into dependabot/npm_and_yarn/react-hook-form-7.63.0
2 parents 57f3326 + 596e5fe commit 0ccecab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1501
-166
lines changed

.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ PLAYWRIGHT_VERSION=v1.55.0
88
UBUNTU_VERSION_ALIAS=-jammy
99
PLAYWRIGHT_PORT=5000
1010
PLAYWRIGHT_HOME=/home/pwuser
11+
12+
# For Playwright MCP server
13+
# SKIP_INGESTION=true
14+
# TRUSTIFY_UI_URL=http://localhost:8080
15+
# AUTH_REQUIRED=false
16+
# TRUSTIFY_API_URL=http://localhost:8080
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Playwright Test Generator
2+
3+
```yaml
4+
description: Generate a Playwright test based on given scenario using playwright-bdd library
5+
tools: ['playwright']
6+
mode: 'agent'
7+
```
8+
- You are a Playwright test generator specialized in playwright-bdd library.
9+
- Use Playwright MCP server only for browser interactions
10+
- Never skip steps under `Setup` section for any iteration.
11+
12+
## Setup
13+
1. Check the current directory: `pwd`,
14+
2. If the current directory ends with `trustify-ui`,
15+
a. Export the `pwd` value in a variable: `export PROJECT_ROOT=$(pwd)`. This value will be used later on "Execution" step.
16+
b. Change to e2e directory if not with: `cd e2e`
17+
c. List the files: `ls -la`, the `playwright.config.ts` file should be present
18+
d. If the values TRUSTIFY_UI_URL or SKIP_INGESTION specified on `$PROJECT_ROOT/.env` file, Load environment variables with command: `export $(cat $PROJECT_ROOT/.env | grep -v '^#' | xargs)`.
19+
3. If the current directory ends with `e2e`, change to parent directory: `cd ..`, then repeat step 2.
20+
4. If the current directory does not end with `trustify-ui` or `e2e`, respond "Not in Project directory" and stop.
21+
22+
## Process
23+
1. **Input**: Scenario name in format "Scenario Outline: scenario name here"
24+
2. **Search**: Find scenario in `tests/**/features/**/*.feature`
25+
3. **Not Found**: Respond "Scenario not found" + suggest similar scenarios
26+
4. **Found**: Read scenario steps
27+
5. **Analyze**:
28+
- Check existing step definitions in `tests/**/features/**/*.step.ts`
29+
- Identify missing step definitions
30+
6. **Missing Steps**: Add to `auto-generated.step.ts` in appropriate `tests/**/features/` directory
31+
- Remove existing `auto-generated.step.ts` with user confirmation first
32+
- Never use direct imports from playwright-bdd; always use the local createBdd(test) pattern
33+
- If a step definition is already present in any .step.ts file, do not add or redefine it in auto-generated.step.ts
34+
- Make steps generic, reusable, parameterized
35+
- Use Page Object Model where possible
36+
7. **Execute**:
37+
- Automatically run test with:
38+
```bash
39+
cd $PROJECT_ROOT/e2e
40+
npx playwright test --project='bdd' --trace on -g "scenario name here" --headed
41+
```
42+
- In case of test failures, the above command launched HTML server to host the test output Press `Ctrl+C` to stop the server
43+
44+
8. **If Failed**: Fix syntax errors, selectors, timing, page objects
45+
9. **Report**:
46+
- Steps added/modified
47+
- Test results
48+
- Stability recommendations
49+
- Remind to move auto-generated steps to appropriate files
50+
10. **Commit**:
51+
- Prompt the user to add commit message `Assisted-by: <name of code assistant>` by the successful addition and execution of the scenario
52+
53+
## Requirements
54+
- TypeScript + Playwright Test framework
55+
- Follow existing code patterns
56+
- Use environment variables from .env
57+
- Execute all commands from e2e/ directory

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,18 @@ npm-debug.log*
3333
# Intellij IDEA
3434
.idea/
3535

36+
# Cursor
37+
.cursor/
38+
3639
# Rust
3740
crate/target
3841
crate/Cargo.lock
3942

4043
# Devcontainers
4144
.devcontainer/devcontainer.json
45+
46+
# Auto-generated steps
47+
e2e/tests/ui/features/**/auto-generated.step.ts
48+
49+
# Test results
50+
test-results/

client/openapi/trustd.yaml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,18 +2057,6 @@ paths:
20572057
application/json:
20582058
schema:
20592059
$ref: '#/components/schemas/BasePurlDetails'
2060-
/api/v2/purl/gc:
2061-
get:
2062-
tags:
2063-
- purl
2064-
operationId: garbageCollect
2065-
responses:
2066-
'200':
2067-
description: Performs garbage collection for orphaned packages
2068-
content:
2069-
text/plain:
2070-
schema:
2071-
type: string
20722060
/api/v2/purl/{key}:
20732061
get:
20742062
tags:
@@ -3290,9 +3278,7 @@ components:
32903278
AdvisoryDetails:
32913279
allOf:
32923280
- $ref: '#/components/schemas/AdvisoryHead'
3293-
- oneOf:
3294-
- type: 'null'
3295-
- $ref: '#/components/schemas/SourceDocument'
3281+
- $ref: '#/components/schemas/SourceDocument'
32963282
- type: object
32973283
required:
32983284
- vulnerabilities
@@ -3373,10 +3359,8 @@ components:
33733359
AdvisorySummary:
33743360
allOf:
33753361
- $ref: '#/components/schemas/AdvisoryHead'
3376-
- oneOf:
3377-
- type: 'null'
3378-
- $ref: '#/components/schemas/SourceDocument'
3379-
description: Information pertaning to the underlying source document, if any.
3362+
- $ref: '#/components/schemas/SourceDocument'
3363+
description: Information pertaning to the underlying source document, if any.
33803364
- type: object
33813365
required:
33823366
- average_severity
@@ -4202,10 +4186,8 @@ components:
42024186
items:
42034187
allOf:
42044188
- $ref: '#/components/schemas/AdvisoryHead'
4205-
- oneOf:
4206-
- type: 'null'
4207-
- $ref: '#/components/schemas/SourceDocument'
4208-
description: Information pertaning to the underlying source document, if any.
4189+
- $ref: '#/components/schemas/SourceDocument'
4190+
description: Information pertaning to the underlying source document, if any.
42094191
- type: object
42104192
required:
42114193
- average_severity
@@ -4531,9 +4513,7 @@ components:
45314513
items:
45324514
allOf:
45334515
- $ref: '#/components/schemas/SbomHead'
4534-
- oneOf:
4535-
- type: 'null'
4536-
- $ref: '#/components/schemas/SourceDocument'
4516+
- $ref: '#/components/schemas/SourceDocument'
45374517
- type: object
45384518
required:
45394519
- described_by
@@ -4767,6 +4747,7 @@ components:
47674747
type: array
47684748
items:
47694749
$ref: '#/components/schemas/LicenseRefMapping'
4750+
deprecated: true
47704751
version:
47714752
$ref: '#/components/schemas/VersionedPurlHead'
47724753
PurlHead:
@@ -5087,10 +5068,12 @@ components:
50875068
- average_score
50885069
- status
50895070
- packages
5071+
- scores
50905072
properties:
50915073
average_score:
50925074
type: number
50935075
format: double
5076+
deprecated: true
50945077
average_severity:
50955078
$ref: '#/components/schemas/Severity'
50965079
context:
@@ -5101,14 +5084,16 @@ components:
51015084
type: array
51025085
items:
51035086
$ref: '#/components/schemas/SbomPackage'
5087+
scores:
5088+
type: array
5089+
items:
5090+
$ref: '#/components/schemas/Score'
51045091
status:
51055092
type: string
51065093
SbomSummary:
51075094
allOf:
51085095
- $ref: '#/components/schemas/SbomHead'
5109-
- oneOf:
5110-
- type: 'null'
5111-
- $ref: '#/components/schemas/SourceDocument'
5096+
- $ref: '#/components/schemas/SourceDocument'
51125097
- type: object
51135098
required:
51145099
- described_by

client/src/app/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const TablePersistenceKeyPrefixes = {
1717
sboms: "sb",
1818
sboms_by_package: "sbk",
1919
packages: "pk",
20+
licenses: "li",
2021
};
2122

2223
// URL param prefixes: should be short, must be unique for each table that uses one

client/src/app/Routes.tsx

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ const SBOMDetails = lazy(() => import("./pages/sbom-details"));
3131
// Others
3232
const Search = lazy(() => import("./pages/search"));
3333
const ImporterList = lazy(() => import("./pages/importer-list"));
34+
const LicenseList = lazy(() => import("./pages/license-list"));
3435

3536
export enum PathParam {
3637
ADVISORY_ID = "advisoryId",
3738
VULNERABILITY_ID = "vulnerabilityId",
3839
SBOM_ID = "sbomId",
3940
PACKAGE_ID = "packageId",
41+
LICENSE_NAME = "licenseName",
4042
}
4143

4244
export const Paths = {
@@ -53,6 +55,7 @@ export const Paths = {
5355
packageDetails: `/packages/:${PathParam.PACKAGE_ID}`,
5456
search: "/search",
5557
importers: "/importers",
58+
licenses: "/licenses",
5659
} as const;
5760

5861
export const AppRoutes = createBrowserRouter([
@@ -74,38 +77,38 @@ export const AppRoutes = createBrowserRouter([
7477
),
7578
},
7679
{
77-
path: Paths.advisoryUpload,
80+
path: Paths.advisoryDetails,
7881
element: (
7982
<LazyRouteElement
80-
identifier="advisory-upload"
81-
component={<AdvisoryUpload />}
83+
identifier="advisory-details"
84+
component={<AdvisoryDetails />}
8285
/>
8386
),
8487
},
8588
{
86-
path: Paths.advisoryDetails,
89+
path: Paths.advisoryUpload,
8790
element: (
8891
<LazyRouteElement
89-
identifier="advisory-details"
90-
component={<AdvisoryDetails />}
92+
identifier="advisory-upload"
93+
component={<AdvisoryUpload />}
9194
/>
9295
),
9396
},
9497
{
95-
path: Paths.vulnerabilities,
98+
path: Paths.importers,
9699
element: (
97100
<LazyRouteElement
98-
identifier="vulnerability-list"
99-
component={<VulnerabilityList />}
101+
identifier="importer-list"
102+
component={<ImporterList />}
100103
/>
101104
),
102105
},
103106
{
104-
path: Paths.vulnerabilityDetails,
107+
path: Paths.licenses,
105108
element: (
106109
<LazyRouteElement
107-
identifier="vulnerability-details"
108-
component={<VulnerabilityDetails />}
110+
identifier="license-list"
111+
component={<LicenseList />}
109112
/>
110113
),
111114
},
@@ -134,11 +137,11 @@ export const AppRoutes = createBrowserRouter([
134137
),
135138
},
136139
{
137-
path: Paths.sbomUpload,
140+
path: Paths.sbomDetails,
138141
element: (
139142
<LazyRouteElement
140-
identifier="sbom-upload"
141-
component={<SBOMUpload />}
143+
identifier="sbom-details"
144+
component={<SBOMDetails />}
142145
/>
143146
),
144147
},
@@ -149,27 +152,36 @@ export const AppRoutes = createBrowserRouter([
149152
),
150153
},
151154
{
152-
path: Paths.sbomDetails,
155+
path: Paths.sbomUpload,
153156
element: (
154157
<LazyRouteElement
155-
identifier="sbom-details"
156-
component={<SBOMDetails />}
158+
identifier="sbom-upload"
159+
component={<SBOMUpload />}
157160
/>
158161
),
159162
},
160163
{
161-
path: Paths.importers,
164+
path: Paths.search,
165+
element: (
166+
<LazyRouteElement identifier="search" component={<Search />} />
167+
),
168+
},
169+
{
170+
path: Paths.vulnerabilities,
162171
element: (
163172
<LazyRouteElement
164-
identifier="importer-list"
165-
component={<ImporterList />}
173+
identifier="vulnerability-list"
174+
component={<VulnerabilityList />}
166175
/>
167176
),
168177
},
169178
{
170-
path: Paths.search,
179+
path: Paths.vulnerabilityDetails,
171180
element: (
172-
<LazyRouteElement identifier="search" component={<Search />} />
181+
<LazyRouteElement
182+
identifier="vulnerability-details"
183+
component={<VulnerabilityDetails />}
184+
/>
173185
),
174186
},
175187
],

0 commit comments

Comments
 (0)