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

Commit 47b5ca9

Browse files
a-orenAdva Oren
andauthored
Automate Vulnerability page Related Advisories tab (#74)
Co-authored-by: Adva Oren <aoren@aoren-thinkpadp1gen7.raanaii.csb>
1 parent 36e6c0a commit 47b5ca9

File tree

2 files changed

+50
-20
lines changed

2 files changed

+50
-20
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,18 @@ Feature: Vulnerability Explorer - View Vulnerability details
4949
# Related advisories
5050
Scenario Outline: View related Advisories
5151
Given User visits Vulnerability details Page of "<vulnerabilityID>"
52+
Then Tab "Advisories" is visible
5253
Then The page title is "<vulnerabilityID>"
5354

55+
Then User navigates to the Related Advisories tab on the Vulnerability Overview page
56+
Then Pagination of Advisories list works
57+
Then A list of all active Advisories tied to the Vulnerability should display
58+
And The "ID, Title, Type, Revision, Vulnerabilities" information should be visible for each advisory
59+
And The advisories should be sorted by "<columnName>"
60+
Then User searches for "<advisoryID>"
61+
Then User visits Advisory details Page of "<advisoryID>"
62+
Then The page title is "<advisoryID>"
63+
5464
Examples:
55-
| vulnerabilityID |
56-
| CVE-2023-1664 |
65+
| vulnerabilityID | advisoryID | columnName |
66+
| CVE-2023-1664| CVE-2023-1664 | ID |

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

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,41 +127,61 @@ Then(
127127
);
128128

129129
// Advisories
130+
Then(
131+
"User navigates to the Related Advisories tab on the Vulnerability Overview page",
132+
async ({ page }) => {
133+
await page.getByRole("tab", { name: "Advisories" }).click();
134+
}
135+
);
130136

131-
Then("User selects the Tabs {string}", async ({ page }, tabName) => {
132-
await page.getByText(tabName).click();
137+
Then("Pagination of Advisories list works", async ({ page }) => {
138+
const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME);
139+
const advisoryTableTopPagination = `xpath=//div[@id="advisory-table-pagination-top"]`;
140+
await toolbarTable.verifyPagination(advisoryTableTopPagination);
133141
});
134142

135143
Then(
136-
"The Advisory table is sorted by {string}",
137-
async ({ page }, columnName) => {
144+
"A list of all active Advisories tied to the Vulnerability should display",
145+
async ({ page }) => {
138146
const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME);
139-
await toolbarTable.verifyTableIsSortedBy(columnName);
147+
await toolbarTable.verifyPaginationHasTotalResultsGreatherThan(0);
140148
}
141149
);
142150

143151
Then(
144-
"The Advisory table total results is {int}",
145-
async ({ page }, totalResults) => {
146-
const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME);
147-
await toolbarTable.verifyPaginationHasTotalResults(totalResults);
152+
"The {string} information should be visible for each advisory",
153+
async ({ page }, columnHeaders) => {
154+
const headers = columnHeaders.split(`,`).map((column) => column.trim());
155+
156+
for (const header of headers) {
157+
console.log(`Checking visibility of column header: ${header}`);
158+
const headerElement = page.getByRole("columnheader", { name: header });
159+
if (await headerElement.count()) {
160+
await expect(headerElement).toBeVisible();
161+
} else {
162+
await expect(page.getByRole("button", { name: header })).toBeVisible();
163+
}
164+
}
148165
}
149166
);
150167

151168
Then(
152-
"The Advisory table total results is greather than {int}",
153-
async ({ page }, totalResults) => {
169+
"The advisories should be sorted by {string}",
170+
async ({ page }, columnName) => {
154171
const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME);
155-
await toolbarTable.verifyPaginationHasTotalResultsGreatherThan(
156-
totalResults
157-
);
172+
await toolbarTable.verifyTableIsSortedBy(columnName);
158173
}
159174
);
160175

176+
Then("User searches for {string}", async ({ page }, advisoryID) => {
177+
const searchPage = new ToolbarTable(page, ADVISORY_TABLE_NAME);
178+
await searchPage.filterByText(advisoryID);
179+
});
180+
161181
Then(
162-
"The {string} column of the Advisory table contains {string}",
163-
async ({ page }, columnName, expectedValue) => {
164-
const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME);
165-
await toolbarTable.verifyColumnContainsText(columnName, expectedValue);
182+
"User visits Advisory details Page of {string}",
183+
async ({ page }, advisoryID) => {
184+
const link = page.getByRole("link", { name: advisoryID });
185+
await link.click();
166186
}
167187
);

0 commit comments

Comments
 (0)