Skip to content

Commit 2eb23a9

Browse files
committed
Refactored the code and algined the reusables
Signed-off-by: mrrajan <[email protected].>
1 parent f0f1552 commit 2eb23a9

File tree

7 files changed

+98
-374
lines changed

7 files changed

+98
-374
lines changed

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"!**/node_modules",
4242
"!client/coverage",
4343
"!client/src/app/client",
44-
"!**/examples_sbom.json"
44+
"!**/common/assets/**"
4545
]
4646
}
4747
}

e2e/tests/ui/features/@sbom-explorer/sbom-explorer.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ Feature: SBOM Explorer - View SBOM details
119119
When User visits SBOM details Page of "<sbomName>"
120120
When User selects the Tab "Vulnerabilities"
121121
Then Table column "Description" is not sortable
122-
Then Sorting of "<sortableColumns>" Columns Works
122+
Then Sorting of "Id, Affected dependencies, Published, Updated" Columns Works
123123
#Then Sorting of "CVSS" Columns works
124124
# Bug: https://issues.redhat.com/browse/TC-2598
125125
Examples:
126-
| sbomName | sortableColumns |
127-
| quarkus-bom | Id, Affected dependencies, Published, Updated |
126+
| sbomName |
127+
| quarkus-bom |
128128

129129
Scenario Outline: Add Labels to SBOM from SBOM Explorer Page
130130
Given An ingested SBOM "<sbomName>" is available

e2e/tests/ui/features/@sbom-scan/scan-sbom.step.ts

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { expect } from "playwright/test";
44
import { test } from "../../fixtures";
55
import { SbomListPage } from "../../pages/sbom-list/SbomListPage";
66
import { SbomScanPage } from "../../pages/sbom-scan/SbomScanPage";
7+
import { Table } from "../../pages/Table";
78
import { ToolbarTable } from "../../helpers/ToolbarTable";
89
import {
910
clickAndVerifyDownload,
10-
verifyCommaDelimitedValues,
11+
verifyChildElementsText,
1112
} from "../../pages/Helpers";
1213

1314
export const { Given, When, Then } = createBdd(test);
@@ -82,7 +83,7 @@ Then(
8283
"On the successful report generation the Application should render Vulnerability Report for the SBOM",
8384
async ({ page }) => {
8485
const scanPage = await SbomScanPage.build(page);
85-
await scanPage.verifyReportHeaderAndText();
86+
await expect(scanPage.heading).toHaveText("Generate vulnerability report");
8687
},
8788
);
8889

@@ -100,7 +101,12 @@ Then(
100101
"Filtering drop down should be visible with drop down values {string}",
101102
async ({ page }, filterOptions: string) => {
102103
const scanPage = await SbomScanPage.build(page);
103-
await scanPage.verifyDefaultFilterAndControls(filterOptions);
104+
const filters = filterOptions.split(",").map((filter) => filter.trim());
105+
await expect(scanPage.filterDropdown).toBeVisible();
106+
await scanPage.filterDropdown.click();
107+
for (const filter of filters) {
108+
await expect(page.getByRole("menuitem", { name: filter })).toBeVisible();
109+
}
104110
},
105111
);
106112

@@ -111,8 +117,10 @@ Then("Clear filters option should be visible and enabled", async ({ page }) => {
111117
Then(
112118
"Tooltip on the {string} column should display {string}",
113119
async ({ page }, column: string, tooltipMessage: string) => {
114-
const scanPage = await SbomScanPage.build(page);
115-
await scanPage.verifyTooltips(column, tooltipMessage);
120+
const table = await Table.build(page, "Vulnerability table");
121+
const tooltipButton = table.getColumnTooltipButton(column, tooltipMessage);
122+
await tooltipButton.hover();
123+
await page.waitForTimeout(500);
116124
},
117125
);
118126

@@ -121,15 +129,20 @@ Then(
121129
async ({ page }, actionsOptions: string) => {
122130
const scanPage = await SbomScanPage.build(page);
123131
await expect(scanPage.actionsButton).toBeVisible();
124-
await scanPage.verifyActionsDropdown(actionsOptions);
132+
const actions = actionsOptions.split(",").map((action) => action.trim());
133+
await scanPage.actionsButton.click();
134+
for (const action of actions) {
135+
await expect(page.getByRole("menuitem", { name: action })).toBeVisible();
136+
}
125137
},
126138
);
127139

128140
Then(
129141
'The title should be Vulnerability report with text "This is a temporary vulnerability report"',
130142
async ({ page }) => {
131143
const scanPage = await SbomScanPage.build(page);
132-
await scanPage.verifyReportHeaderAndText();
144+
await expect(scanPage.heading).toHaveText("Vulnerability report");
145+
await expect(scanPage.headerDescription).toBeVisible();
133146
},
134147
);
135148

@@ -280,13 +293,11 @@ Then(
280293
const scanPage = await SbomScanPage.build(page);
281294
const row = scanPage.getVulnerabilityRow(vulnerability);
282295
const cell = row.locator('td[data-label="Severity"]');
283-
284-
// Use the reusable helper for comma-delimited severity values
285-
await verifyCommaDelimitedValues(
286-
cell,
287-
expected,
296+
const severityElements = cell.locator(
288297
'xpath=//ul[@aria-label="Label group category"]//li',
289298
);
299+
300+
await verifyChildElementsText(severityElements, expected);
290301
},
291302
);
292303

@@ -359,7 +370,8 @@ Then(
359370
`xpath=//tbody/tr[${i}]//td[${columnIndex + 1}]`,
360371
);
361372
if (column === "Qualifiers") {
362-
await verifyCommaDelimitedValues(cell, expected, "xpath=//span");
373+
const qualifierElements = cell.locator("xpath=//span");
374+
await verifyChildElementsText(qualifierElements, expected);
363375
} else {
364376
if (expected === "") {
365377
const cellText = await cell.textContent();
@@ -451,7 +463,7 @@ Then(
451463
await expect(page).toHaveURL(/\/sboms\/scan$/);
452464
// After canceling the modal, we're still viewing the vulnerability report (not the generate screen)
453465
const scanPage = await SbomScanPage.build(page);
454-
await expect(scanPage.headingReport).toBeVisible();
466+
await expect(scanPage.heading).toHaveText("Vulnerability report");
455467
},
456468
);
457469

@@ -498,12 +510,10 @@ Then(
498510

499511
// Special handling for Severity column which has multiple severity values
500512
if (columnName === "Severity") {
501-
// Use the reusable helper for comma-delimited severity values
502-
await verifyCommaDelimitedValues(
503-
cell,
504-
expected,
513+
const severityElements = cell.locator(
505514
'xpath=//ul[@aria-label="Label group category"]//li',
506515
);
516+
await verifyChildElementsText(severityElements, expected);
507517
} else {
508518
await expect(cell).toContainText(expected);
509519
}

0 commit comments

Comments
 (0)