diff --git a/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.feature b/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.feature index 7601c09..e4c02e5 100644 --- a/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.feature +++ b/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.feature @@ -49,8 +49,18 @@ Feature: Vulnerability Explorer - View Vulnerability details # Related advisories Scenario Outline: View related Advisories Given User visits Vulnerability details Page of "" + Then Tab "Advisories" is visible Then The page title is "" + Then User navigates to the Related Advisories tab on the Vulnerability Overview page + Then Pagination of Advisories list works + Then A list of all active Advisories tied to the Vulnerability should display + And The ID, Title, Type, Revision and Vulnerabilities information should be visible for each advisory + And The advisories should be sorted by "" + Then User searches for "" + Then User visits Advisory details Page of "" + Then The page title is "" + Examples: - | vulnerabilityID | - | CVE-2023-1664 | + | vulnerabilityID | advisoryID | columnName | + | CVE-2023-1664| CVE-2023-1664 | ID | diff --git a/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.step.ts b/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.step.ts index 1997d35..3b6ee3f 100644 --- a/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.step.ts +++ b/tests/ui/features/@vulnerability-explorer/vulnerability-explorer.step.ts @@ -7,6 +7,7 @@ export const { Given, When, Then } = createBdd(); const SBOM_TABLE_NAME = "Sbom table"; const ADVISORY_TABLE_NAME = "Advisory table"; +const COLUMN_LABELS = ["ID", "Title", "Type", "Revision", "Vulnerabilities"]; Given( "User visits Vulnerability details Page of {string}", @@ -126,41 +127,58 @@ Then( ); // Advisories +Then( + "User navigates to the Related Advisories tab on the Vulnerability Overview page", + async ({ page }) => { + await page.getByRole("tab", { name: "Advisories" }).click(); + } +); -Then("User selects the Tabs {string}", async ({ page }, tabName) => { - await page.getByText(tabName).click(); +Then("Pagination of Advisories list works", async ({ page }) => { + const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME); + const advisoryTableTopPagination = `xpath=//div[@id="advisory-table-pagination-top"]`; + await toolbarTable.verifyPagination(advisoryTableTopPagination); }); Then( - "The Advisory table is sorted by {string}", - async ({ page }, columnName) => { + "A list of all active Advisories tied to the Vulnerability should display", + async ({ page }) => { const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME); - await toolbarTable.verifyTableIsSortedBy(columnName); + await toolbarTable.verifyPaginationHasTotalResultsGreatherThan(0); } ); Then( - "The Advisory table total results is {int}", - async ({ page }, totalResults) => { - const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME); - await toolbarTable.verifyPaginationHasTotalResults(totalResults); + "The ID, Title, Type, Revision and Vulnerabilities information should be visible for each advisory", + async ({ page }) => { + for (const label of COLUMN_LABELS) { + const header = page.getByRole("columnheader", { name: label }); + if (await header.count()) { + await expect(header).toBeVisible(); + } else { + await expect(page.getByRole("button", { name: label })).toBeVisible(); + } + } } ); Then( - "The Advisory table total results is greather than {int}", - async ({ page }, totalResults) => { + "The advisories should be sorted by {string}", + async ({ page }, columnName) => { const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME); - await toolbarTable.verifyPaginationHasTotalResultsGreatherThan( - totalResults - ); + await toolbarTable.verifyTableIsSortedBy(columnName); } ); +Then("User searches for {string}", async ({ page }, advisoryID) => { + const searchPage = new ToolbarTable(page, ADVISORY_TABLE_NAME); + await searchPage.filterByText(advisoryID); +}); + Then( - "The {string} column of the Advisory table contains {string}", - async ({ page }, columnName, expectedValue) => { - const toolbarTable = new ToolbarTable(page, ADVISORY_TABLE_NAME); - await toolbarTable.verifyColumnContainsText(columnName, expectedValue); + "User visits Advisory details Page of {string}", + async ({ page }, advisoryID) => { + const link = page.getByRole("link", { name: advisoryID }); + await link.click(); } );