Conversation
Reviewer's GuideThis PR implements end-to-end BDD search tests by extending and refactoring UI helper classes for robust table and page interactions (pagination, filtering, sorting, autocomplete, tabs), adds new step definitions and feature files for search scenarios, and updates global test configuration to capture failure artifacts. Sequence diagram for search autocomplete interactionsequenceDiagram
actor User
participant "SearchPage"
participant "Autocomplete Engine"
User->>SearchPage: Type in search box
SearchPage->>"Autocomplete Engine": Request suggestions
"Autocomplete Engine"-->>SearchPage: Return suggestions
SearchPage-->>User: Display suggestions
User->>SearchPage: Select suggestion
SearchPage->>SearchPage: Validate selection
SearchPage-->>User: Show filtered results
Sequence diagram for table sorting and pagination in search resultssequenceDiagram
actor User
participant "ToolbarTable"
User->>ToolbarTable: Click column to sort
ToolbarTable->>ToolbarTable: Sort rows
ToolbarTable-->>User: Display sorted table
User->>ToolbarTable: Click next page
ToolbarTable->>ToolbarTable: Load next page (maxPages limit)
ToolbarTable-->>User: Display new page
Class diagram for updated UI helpers (ToolbarTable, SearchPage, Tabs, DetailsPage)classDiagram
class ToolbarTable {
+verifyColumnContents()
+verifyDownloadLinks()
+verifyRowLimits()
+verifyVisibility()
+verifyDateFilters()
+navigate()
+verifyLinkPresence()
+getTableRows(maxPages)
+sortColumn()
+waitForTableLoad()
+waitForPaginationControls()
+waitForSorting()
}
class SearchPage {
+openSearchPage()
+typeAutocomplete()
+validateAutocompleteSuggestions()
+countResultsByCategory()
}
class Tabs {
+selectTab()
+verifyTabVisibility()
+verifySelectionState()
+verifyBadgeCounts()
}
class DetailsPage {
+verifyPageHeader()
}
ToolbarTable <|-- SearchPage
SearchPage o-- Tabs
SearchPage o-- ToolbarTable
DetailsPage o-- ToolbarTable
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The ToolbarTable helper methods use a lot of explicit any types—consider replacing those with stronger types (e.g. string) to improve type safety and clarity.
- Selectors like "#autocomplete-search .pf-v6-c-menu" and table locators are repeated—extract them into shared constants or private helper methods to reduce duplication and ease maintenance.
- Several step definitions bundle large conditional branches for different types; refactor these into parameterized or data-driven steps to make the BDD definitions more concise and maintainable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The ToolbarTable helper methods use a lot of explicit any types—consider replacing those with stronger types (e.g. string) to improve type safety and clarity.
- Selectors like "#autocomplete-search .pf-v6-c-menu" and table locators are repeated—extract them into shared constants or private helper methods to reduce duplication and ease maintenance.
- Several step definitions bundle large conditional branches for different types; refactor these into parameterized or data-driven steps to make the BDD definitions more concise and maintainable.
## Individual Comments
### Comment 1
<location> `e2e/tests/ui/features/@search/search.step.ts:117` </location>
<code_context>
+ await detailsPage.verifyPageHeader(arg);
+});
+
+Then('the user should be able to filter {string}', async ({page}, arg: string) => {
+ const table = new ToolbarTable(page,getTableInfo(arg)[0]);
+ if (arg === "SBOMs"){
</code_context>
<issue_to_address>
**suggestion (testing):** Add negative filter tests to verify that filtering for non-existent values yields no results.
Consider adding tests that filter for values not present in the dataset to confirm the UI handles empty results as expected.
Suggested implementation:
```typescript
Then('the user should be able to filter {string}', async ({page}, arg: string) => {
const table = new ToolbarTable(page,getTableInfo(arg)[0]);
if (arg === "SBOMs"){
await table.filterByDate("12/22/2025","12/22/2025");
await table.verifyColumnDoesNotContainText("Name","quarkus-bom");
await table.clearFilter();
await table.verifyColumnContainsText("Name","quarkus-bom");
// Negative filter test: filter for a non-existent SBOM name
await table.filterByText("Name", "non-existent-sbom");
await table.verifyColumnDoesNotContainText("Name", "non-existent-sbom");
await table.verifyTableIsEmpty(); // Optionally verify table is empty
await table.clearFilter();
}else if (arg === "Vulnerabilities"){
await page.getByLabel('Critical').check();
await table.verifyColumnDoesNotContainText("ID","CVE-2022-45787");
await table.clearFilter();
await table.verifyColumnContainsText("ID","CVE-2022-45787");
// Negative filter test: filter for a non-existent Vulnerability ID
await table.filterByText("ID", "NON-EXISTENT-CVE");
await table.verifyColumnDoesNotContainText("ID", "NON-EXISTENT-CVE");
await table.verifyTableIsEmpty(); // Optionally verify table is empty
await table.clearFilter();
}else if (arg == "Packages"){
```
- Ensure that the `ToolbarTable` class has a `filterByText` and `verifyTableIsEmpty` method. If not, you will need to implement these helper methods.
- Add similar negative filter tests for "Packages" if applicable, using a column and value that do not exist.
</issue_to_address>
### Comment 2
<location> `e2e/tests/ui/features/@search/search.step.ts:161-166` </location>
<code_context>
+});
+
+
+Then('the {string} list should be sortable', async ({page}, arg: string) => {
+ var columns:string[] = getColumns(arg);
+ var id:string = getPaginationId(arg);
+
+ const table = new ToolbarTable(page,getTableInfo(arg)[0]);
+ await table.verifySorting(`xpath=//div[@id="${id}"]`,columns);
+});
+
</code_context>
<issue_to_address>
**suggestion (testing):** Add tests for sorting columns with mixed data types and blank cells.
Please add tests that verify sorting behavior for columns containing both valid values and blank cells, to confirm correct handling after the recent logic update.
Suggested implementation:
```typescript
Then('the {string} list should be sortable', async ({page}, arg: string) => {
var columns:string[] = getColumns(arg);
var id:string = getPaginationId(arg);
const table = new ToolbarTable(page,getTableInfo(arg)[0]);
await table.verifySorting(`xpath=//div[@id="${id}"]`,columns);
});
// Test sorting for columns with mixed data types and blank cells
Then('the {string} list should sort columns with mixed data types and blank cells correctly', async ({page}, arg: string) => {
// Example: Assume getMixedTypeColumns returns columns with mixed types and blank cells for the given list
var mixedColumns: string[] = getMixedTypeColumns(arg);
var id: string = getPaginationId(arg);
const table = new ToolbarTable(page, getTableInfo(arg)[0]);
for (const column of mixedColumns) {
// Optionally, you can pass a custom comparator or check for blank cell handling if verifySorting supports it
await table.verifySorting(`xpath=//div[@id="${id}"]`, [column]);
}
});
```
- You will need to implement or update the `getMixedTypeColumns(arg: string): string[]` function to return the relevant columns for each list that contain mixed data types and blank cells.
- Ensure your test data in the UI contains columns with both valid values and blank cells for the lists being tested.
- If `verifySorting` does not already check for blank cell handling, you may need to enhance it to do so.
</issue_to_address>
### Comment 3
<location> `e2e/tests/ui/features/@search/search.step.ts:209-212` </location>
<code_context>
+ await tabs.verifyTabHasAtLeastResults(arg,count);
+});
+
+Then('the autofill dropdown should display items matching the {string}', async ({page}, arg: string) => {
+ const searchPage = new SearchPage(page);
+ await searchPage.autoFillHasRelevantResults(arg);
+});
+
</code_context>
<issue_to_address>
**suggestion (testing):** Consider testing autocomplete with special characters and very long input strings.
Testing with these inputs will help catch potential UI issues and ensure the autocomplete remains reliable.
```suggestion
Then('the autofill dropdown should display items matching the {string}', async ({page}, arg: string) => {
const searchPage = new SearchPage(page);
await searchPage.autoFillHasRelevantResults(arg);
});
Then('the autofill dropdown should handle special characters input', async ({page}) => {
const searchPage = new SearchPage(page);
const specialCharsInput = '!@#$%^&*()_+-=[]{}|;:\'",.<>/?`~';
await searchPage.autoFillHasRelevantResults(specialCharsInput);
});
Then('the autofill dropdown should handle very long input strings', async ({page}) => {
const searchPage = new SearchPage(page);
const longInput = 'a'.repeat(256); // 256 characters long
await searchPage.autoFillHasRelevantResults(longInput);
});
```
</issue_to_address>
### Comment 4
<location> `e2e/tests/ui/features/@search/search.step.ts:162` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/TypeScript/Default-Rules/avoid-using-var))
<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>
### Comment 5
<location> `e2e/tests/ui/features/@search/search.step.ts:163` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/TypeScript/Default-Rules/avoid-using-var))
<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>
### Comment 6
<location> `e2e/tests/ui/features/@search/search.step.ts:179` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/TypeScript/Default-Rules/avoid-using-var))
<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>
### Comment 7
<location> `e2e/tests/ui/features/@search/search.step.ts:188` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/TypeScript/Default-Rules/avoid-using-var))
<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.
From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| Then('the {string} list should be sortable', async ({page}, arg: string) => { | ||
| var columns:string[] = getColumns(arg); | ||
| var id:string = getPaginationId(arg); | ||
|
|
||
| const table = new ToolbarTable(page,getTableInfo(arg)[0]); | ||
| await table.verifySorting(`xpath=//div[@id="${id}"]`,columns); |
There was a problem hiding this comment.
suggestion (testing): Add tests for sorting columns with mixed data types and blank cells.
Please add tests that verify sorting behavior for columns containing both valid values and blank cells, to confirm correct handling after the recent logic update.
Suggested implementation:
Then('the {string} list should be sortable', async ({page}, arg: string) => {
var columns:string[] = getColumns(arg);
var id:string = getPaginationId(arg);
const table = new ToolbarTable(page,getTableInfo(arg)[0]);
await table.verifySorting(`xpath=//div[@id="${id}"]`,columns);
});
// Test sorting for columns with mixed data types and blank cells
Then('the {string} list should sort columns with mixed data types and blank cells correctly', async ({page}, arg: string) => {
// Example: Assume getMixedTypeColumns returns columns with mixed types and blank cells for the given list
var mixedColumns: string[] = getMixedTypeColumns(arg);
var id: string = getPaginationId(arg);
const table = new ToolbarTable(page, getTableInfo(arg)[0]);
for (const column of mixedColumns) {
// Optionally, you can pass a custom comparator or check for blank cell handling if verifySorting supports it
await table.verifySorting(`xpath=//div[@id="${id}"]`, [column]);
}
});- You will need to implement or update the
getMixedTypeColumns(arg: string): string[]function to return the relevant columns for each list that contain mixed data types and blank cells. - Ensure your test data in the UI contains columns with both valid values and blank cells for the lists being tested.
- If
verifySortingdoes not already check for blank cell handling, you may need to enhance it to do so.
| Then('the autofill dropdown should display items matching the {string}', async ({page}, arg: string) => { | ||
| const searchPage = new SearchPage(page); | ||
| await searchPage.autoFillHasRelevantResults(arg); | ||
| }); |
There was a problem hiding this comment.
suggestion (testing): Consider testing autocomplete with special characters and very long input strings.
Testing with these inputs will help catch potential UI issues and ensure the autocomplete remains reliable.
| Then('the autofill dropdown should display items matching the {string}', async ({page}, arg: string) => { | |
| const searchPage = new SearchPage(page); | |
| await searchPage.autoFillHasRelevantResults(arg); | |
| }); | |
| Then('the autofill dropdown should display items matching the {string}', async ({page}, arg: string) => { | |
| const searchPage = new SearchPage(page); | |
| await searchPage.autoFillHasRelevantResults(arg); | |
| }); | |
| Then('the autofill dropdown should handle special characters input', async ({page}) => { | |
| const searchPage = new SearchPage(page); | |
| const specialCharsInput = '!@#$%^&*()_+-=[]{}|;:\'",.<>/?`~'; | |
| await searchPage.autoFillHasRelevantResults(specialCharsInput); | |
| }); | |
| Then('the autofill dropdown should handle very long input strings', async ({page}) => { | |
| const searchPage = new SearchPage(page); | |
| const longInput = 'a'.repeat(256); // 256 characters long | |
| await searchPage.autoFillHasRelevantResults(longInput); | |
| }); |
vobratil
left a comment
There was a problem hiding this comment.
@matejnesuta There are some useful scenarios being tested in this PR, but unfortunately I think it introduces a lot of redundancy and uses the helper classes that are now deprecated. Could you please move any new page-related functionality to appropriate classes in the pages directory (not the helpers directory) and re-factor the PR, so that it uses what is already defined there?
mrrajan
left a comment
There was a problem hiding this comment.
@matejnesuta I regret for the late review - Please find my review comments. Additionally,
- Capitalize the first word on the feature file
- On the typescript methods and step definitions, use relevant naming instead of
arg
Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #721 +/- ##
==========================================
- Coverage 64.98% 64.89% -0.09%
==========================================
Files 195 195
Lines 3339 3339
Branches 751 751
==========================================
- Hits 2170 2167 -3
- Misses 872 881 +9
+ Partials 297 291 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by Sourcery
Introduce end-to-end BDD tests for the Search page and extend helper classes to support search, filtering, pagination, sorting, and tab interactions across Vulnerabilities, SBOMs, Packages, and Advisories.
New Features:
Enhancements:
CI: