Skip to content

Conversation

@HusneShabbir
Copy link
Contributor

Adds search filter before selecting catalog items to reduce test flakiness.

Changes

  • Add search input to filter results before selection

Why

Reduces flaky failures by ensuring the correct item is targeted when multiple results exist.

@rhdh-qodo-merge
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Wait

After filling the search input, the code immediately clicks the link. If results are filtered asynchronously (debounce, network request, client-side rendering), the click may race with the UI update. Consider waiting for the filtered item to be visible/enabled (or for the list to settle) before clicking.

async goToByName(name: string) {
  await this.uiHelper.openCatalogSidebar("Component");
  await this.page.getByRole("textbox", { name: "Search" }).fill(name);
  await this.uiHelper.clickLink(name);
📚 Focus areas based on broader codebase context

i18n Selector

The new search step uses a hardcoded accessible name (getByRole("textbox", { name: "Search" })), which can break under localization or minor UI copy changes. Prefer the existing semantic search selector/helper used elsewhere (label/placeholder derived from translations) to keep the selector stable and consistent across tests. (Ref 4, Ref 1)

async goToByName(name: string) {
  await this.uiHelper.openCatalogSidebar("Component");
  await this.page.getByRole("textbox", { name: "Search" }).fill(name);
  await this.uiHelper.clickLink(name);
}

Reference reasoning: The codebase already centralizes search input selection via a semantic helper that resolves the search title from translations and falls back between label and placeholder, and other catalog tests use dedicated UI helper search methods. Reusing those patterns avoids hardcoded English strings and reduces selector brittleness.

📄 References
  1. redhat-developer/rhdh/e2e-tests/playwright/e2e/catalog-timestamp.spec.ts [1-86]
  2. redhat-developer/rhdh/e2e-tests/playwright/e2e/github-discovery.spec.ts [24-55]
  3. redhat-developer/rhdh/e2e-tests/playwright/support/pages/bulk-import.ts [5-61]
  4. redhat-developer/rhdh/e2e-tests/playwright/support/page-objects/page-obj.ts [46-84]
  5. redhat-developer/rhdh/e2e-tests/playwright/support/pages/catalog-import.ts [17-107]
  6. redhat-developer/rhdh/e2e-tests/playwright/support/pages/catalog-item.ts [1-20]
  7. redhat-developer/rhdh/e2e-tests/playwright/e2e/extensions.spec.ts [14-851]
  8. redhat-developer/rhdh/e2e-tests/playwright/e2e/default-global-header.spec.ts [12-206]

@rhdh-qodo-merge
Copy link

PR Type

Bug fix, Tests


Description

  • Add search filter to catalog selection in e2e tests

  • Reduces test flakiness by targeting correct items when multiple results exist


File Walkthrough

Relevant files
Tests
catalog.ts
Add search filter before catalog item selection                   

e2e-tests/playwright/support/pages/catalog.ts

  • Added search input fill before clicking catalog item link
  • Filters catalog results by name to ensure correct item selection
  • Improves test reliability when multiple matching items exist
+1/-0     

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@rhdh-qodo-merge
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Wait for filtered result to appear

Add a page.waitForSelector after filling the search input to ensure the filtered
result is visible before attempting to click it, preventing test flakiness.

e2e-tests/playwright/support/pages/catalog.ts [23]

 await this.page.getByRole("textbox", { name: "Search" }).fill(name);
+await this.page.waitForSelector(`text="${name}"`, { state: "visible" });
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: This suggestion correctly identifies a potential race condition and proposes a robust solution by waiting for the element to be visible, which improves test stability.

Medium
General
Scope search locator to sidebar

Scope the search input locator to the catalog sidebar panel to make it more
specific and prevent potential conflicts if other search inputs exist on the
page.

e2e-tests/playwright/support/pages/catalog.ts [23]

-await this.page.getByRole("textbox", { name: "Search" }).fill(name);
+const catalogPanel = this.page.locator('aside[aria-label="Component catalog"]');
+const searchInput = catalogPanel.getByRole("textbox", { name: "Search" });
+await searchInput.fill(name);
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion improves the locator's specificity, making the test more robust against future UI changes by preventing potential conflicts with other search inputs.

Low
  • More

Copy link
Member

@teknaS47 teknaS47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

@HusneShabbir
Copy link
Contributor Author

/cc @christoph-jerolimov @jrichter1

@jrichter1
Copy link
Contributor

/approve

Copy link
Member

@christoph-jerolimov christoph-jerolimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@openshift-ci
Copy link

openshift-ci bot commented Feb 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christoph-jerolimov, jrichter1, teknaS47

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Feb 3, 2026
@christoph-jerolimov
Copy link
Member

/cherry-pick release-1.9

@openshift-cherrypick-robot
Copy link
Contributor

@christoph-jerolimov: once the present PR merges, I will cherry-pick it on top of release-1.9 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-1.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 78e9e69 into redhat-developer:main Feb 3, 2026
28 checks passed
@openshift-cherrypick-robot
Copy link
Contributor

@christoph-jerolimov: new pull request created: #4167

Details

In response to this:

/cherry-pick release-1.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants