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

Commit e19f67f

Browse files
committed
Added a test for Vulnerability Explorer overview.
1 parent 71b62d3 commit e19f67f

File tree

4 files changed

+73
-10
lines changed

4 files changed

+73
-10
lines changed

tests/ui/features/@vulnerability-explorer/vulnerability-explorer.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ Feature: Vulnerability Explorer - View Vulnerability details
22
Background: Authentication
33
Given User is authenticated
44

5+
# Search for vulnerability
6+
7+
# Vulnerability Explorer
8+
Scenario: Display an overview of a vulnerability
9+
Given User visits Vulnerability details Page of "<vulnerabilityID>"
10+
Then The page title is "<vulnerabilityID>"
11+
Then The severity is "<severityDescription>" and the CVSS score is "<severityScore>"
12+
Then The description begins with "<descriptionBeginsWith>"
13+
Then The Reserved date is "<dateReserved>", the Published date is "<datePublished>" and Last modified date is "<dateLastModified>"
14+
15+
Examples:
16+
| vulnerabilityID | severityDescription | severityScore | descriptionBeginsWith | dateReserved | datePublished | dateLastModified |
17+
| CVE-2023-1664 | Medium | 6.5 | A flaw was found in Keycloak. | Mar 27, 2023 | May 26, 2023 | Jan 15, 2025 |
18+
19+
# Related products / SBOMs
520
Scenario Outline: View related SBOMs
621
Given User visits Vulnerability details Page of "<vulnerabilityID>"
722
When Tab "Related SBOMs" is visible
@@ -15,6 +30,7 @@ Feature: Vulnerability Explorer - View Vulnerability details
1530
| vulnerabilityID | sbomName |
1631
| CVE-2023-1664 | quarkus-bom |
1732

33+
# Related advisories
1834
Scenario Outline: View related Advisories
1935
Given User visits Vulnerability details Page of "<vulnerabilityID>"
2036
Then The page title is "<vulnerabilityID>"

tests/ui/features/@vulnerability-explorer/vulnerability-explorer.step.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createBdd } from "playwright-bdd";
22
import { ToolbarTable } from "../../helpers/ToolbarTable";
33
import { SearchPage } from "../../helpers/SearchPage";
4+
import { expect } from "@playwright/test";
45

56
export const { Given, When, Then } = createBdd();
67

@@ -16,6 +17,51 @@ Given(
1617
}
1718
);
1819

20+
// Vulnerability Explorer
21+
Then(
22+
"The severity is {string} and the CVSS score is {string}",
23+
async ({ page }, severityDescription, severityScore) => {
24+
const severity = `${severityDescription}(${severityScore})`;
25+
await expect(page.getByText(severity).first()).toBeVisible();
26+
}
27+
);
28+
29+
Then(
30+
"The description begins with {string}",
31+
async ({ page }, descriptionBeginsWith) => {
32+
await expect(
33+
page.getByRole("paragraph").filter({ hasText: descriptionBeginsWith })
34+
).toBeVisible();
35+
}
36+
);
37+
38+
Then(
39+
"The Reserved date is {string}, the Published date is {string} and Last modified date is {string}",
40+
async ({ page }, dateReserved, datePublished, dateLastModified) => {
41+
await expect(
42+
page
43+
.locator(".pf-v5-c-description-list > div:nth-child(1)")
44+
.filter({ hasText: "Reserved" })
45+
.filter({ hasText: dateReserved })
46+
.first()
47+
).toBeVisible();
48+
await expect(
49+
page
50+
.locator(".pf-v5-c-description-list > div:nth-child(1)")
51+
.filter({ hasText: "Published date" })
52+
.filter({ hasText: datePublished })
53+
.first()
54+
).toBeVisible();
55+
await expect(
56+
page
57+
.locator(".pf-v5-c-description-list > div:nth-child(1)")
58+
.filter({ hasText: "Last modified" })
59+
.filter({ hasText: dateLastModified })
60+
.first()
61+
).toBeVisible();
62+
}
63+
);
64+
1965
// SBOMS
2066

2167
Then("The SBOMs table is sorted by {string}", async ({ page }, columnName) => {

tests/ui/features/vulnerability-explorer.feature

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Background:
88
And User has successfully uploaded a vulnerability dataset
99
And User has successfully uploaded an advisory dataset
1010

11-
# Vulnerabilities Explorer
11+
# Search
1212
Scenario: Navigating to the Vulnerability Explorer page by selecting it from the list of all vulnerabilities
1313
Given User is on the Home page
1414
When User clicks on the Search button in the menu
@@ -32,19 +32,20 @@ Scenario: Navigating to the Vulnerability Explorer page by filtering vulnerabili
3232
And User selects an Vulnerability returned by the filter
3333
Then The Vulnerability Explorer page should display
3434

35+
# Vulnerabilities Explorer
3536
Scenario: Display an overview of a vulnerability
3637
Given User is on the Home page
3738
When User navigates to the Vulnerabilities Explorer page
3839
Then CVE name, CVSS score and CVE description should be visible
39-
And "Show more" button is visible for vulnerabilities with a long descriptions
40+
# And "Show more" button is visible for vulnerabilities with a long descriptions
4041
And Vulnerability metadata Reserved, Last Published Date and Last Modified should be visible
41-
And Download button should be visible
42+
# And Download button should be visible
4243

43-
Scenario: Download a vulnerability CVE from the Vulnerability Explorer page
44-
Given User is on the Home page
45-
When User navigates to the Vulnerabilities Explorer page
46-
And User clicks the Download button
47-
Then The vulnerability CVE should download as a JSON file
44+
# Scenario: Download a vulnerability CVE from the Vulnerability Explorer page
45+
# Given User is on the Home page
46+
# When User navigates to the Vulnerabilities Explorer page
47+
# And User clicks the Download button
48+
# Then The vulnerability CVE should download as a JSON file
4849

4950
# Vulnerability-related Products
5051
Scenario: Display a list of products related to a single vulnerability

tests/ui/steps/details-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { DetailsPage } from "../helpers/DetailsPage";
33

44
export const { Given, When, Then } = createBdd();
55

6-
Then("The page title is {string}", async ({ page }, sbomName) => {
6+
Then("The page title is {string}", async ({ page }, title) => {
77
const pageWithTabs = new DetailsPage(page);
8-
await pageWithTabs.verifyPageHeader(sbomName);
8+
await pageWithTabs.verifyPageHeader(title);
99
});
1010

1111
Then("Tab {string} is selected", async ({ page }, tabName) => {

0 commit comments

Comments
 (0)