-
Notifications
You must be signed in to change notification settings - Fork 22
tests: sbom-explorer-details reuse SbomDetailsPage utils #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
carlosthe19916
wants to merge
6
commits into
guacsec:main
Choose a base branch
from
carlosthe19916:task/sbom-explorer-details
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
de2fb10
tests: extract sbom-search assertions to its own feature
carlosthe19916 8d81228
task: sbom-explorer-details reuse SbomDetailsPage utils
carlosthe19916 3fdd111
fix: remove dupplicate step
carlosthe19916 5489c2b
move out labels tests for sbom list page
carlosthe19916 be6d2fe
Merge branch 'main' into task/sbom-explorer-details
carlosthe19916 60c2318
fix conflicts with main
carlosthe19916 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| Feature: SBOM Search Page | ||
| Background: Authentication | ||
| Given User is authenticated | ||
|
|
||
| Scenario Outline: Verify Vulnerabilities | ||
| Given An ingested SBOM "<sbomName>" is available | ||
| Given An ingested SBOM "<sbomName>" containing Vulnerabilities | ||
|
|
||
| Examples: | ||
| | sbomName | | ||
| | quarkus-bom | | ||
|
|
||
| Scenario Outline: Add Labels to SBOM from SBOM List Page | ||
| Given An ingested SBOM "<sbomName>" is available | ||
| When User Adds Labels "<Labels>" to "<sbomName>" SBOM from List Page | ||
| Then The Label list "<Labels>" added to the SBOM "<sbomName>" on List Page | ||
| Examples: | ||
| | sbomName | Labels | | ||
| | quarkus-bom | RANDOM_LABELS | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { createBdd } from "playwright-bdd"; | ||
| import { expect } from "playwright/test"; | ||
|
|
||
| import { test } from "../../fixtures"; | ||
| import { DetailsPage } from "../../helpers/DetailsPage"; | ||
| import { ToolbarTable } from "../../helpers/ToolbarTable"; | ||
| import { SbomListPage } from "../../pages/sbom-list/SbomListPage"; | ||
|
|
||
| export const { Given, When, Then } = createBdd(test); | ||
|
|
||
| const SBOM_TABLE_NAME = "sbom-table"; | ||
|
|
||
| Given("An ingested SBOM {string} is available", async ({ page }, sbomName) => { | ||
| const sbomListPage = await SbomListPage.build(page); | ||
|
|
||
| const toolbar = await sbomListPage.getToolbar(); | ||
| const table = await sbomListPage.getTable(); | ||
|
|
||
| await toolbar.applyTextFilter("Filter text", sbomName); | ||
| await table.waitUntilDataIsLoaded(); | ||
| await table.verifyColumnContainsText("Name", sbomName); | ||
| }); | ||
|
|
||
| Given( | ||
| "An ingested SBOM {string} containing Vulnerabilities", | ||
| async ({ page }, sbomName) => { | ||
| const element = page.locator( | ||
| `xpath=(//tr[contains(.,'${sbomName}')]/td[@data-label='Vulnerabilities']/div)[1]`, | ||
| ); | ||
| await expect(element, "SBOM have no vulnerabilities").toHaveText( | ||
| /^(?!0$).+/, | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| When( | ||
| "User Adds Labels {string} to {string} SBOM from List Page", | ||
| async ({ page }, labelList, sbomName) => { | ||
| const toolbarTable = new ToolbarTable(page, SBOM_TABLE_NAME); | ||
| await toolbarTable.editLabelsListPage(sbomName); | ||
| const detailsPage = new DetailsPage(page); | ||
|
|
||
| // Generate random labels if placeholder is used | ||
| const labelsToAdd = | ||
| labelList === "RANDOM_LABELS" ? detailsPage.generateLabels() : labelList; | ||
| await detailsPage.addLabels(labelsToAdd); | ||
|
|
||
| // Store generated labels for verification | ||
| // biome-ignore lint/suspicious/noExplicitAny: allowed | ||
| (page as any).testContext = { | ||
| // biome-ignore lint/suspicious/noExplicitAny: allowed | ||
| ...(page as any).testContext, | ||
| generatedLabels: labelsToAdd, | ||
| }; | ||
| }, | ||
| ); | ||
|
|
||
| Then( | ||
| "The Label list {string} added to the SBOM {string} on List Page", | ||
| async ({ page }, labelList, sbomName) => { | ||
| const detailsPage = new DetailsPage(page); | ||
|
|
||
| // Use stored generated labels if placeholder was used | ||
| const labelsToVerify = | ||
| labelList === "RANDOM_LABELS" | ||
| ? // biome-ignore lint/suspicious/noExplicitAny: allowed | ||
| (page as any).testContext?.generatedLabels || labelList | ||
| : labelList; | ||
| await detailsPage.verifyLabels(labelsToVerify, sbomName); | ||
| }, | ||
| ); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.