Skip to content

fix(e2e): wait for notifications page content before interacting with filters [AI /e2e-fix]#4684

Draft
zdrapela wants to merge 2 commits intoredhat-developer:mainfrom
zdrapela:fix/e2e-notifications-severity-filter
Draft

fix(e2e): wait for notifications page content before interacting with filters [AI /e2e-fix]#4684
zdrapela wants to merge 2 commits intoredhat-developer:mainfrom
zdrapela:fix/e2e-notifications-severity-filter

Conversation

@zdrapela
Copy link
Copy Markdown
Member

Summary

  • Root cause: clickNotificationsNavBarItem() returned before the notifications page fully rendered — the loading-indicator check passed vacuously because the element didn't exist yet, while the page was still loading (visible progressbar "Loading" elements in the DOM)
  • Fix: Added a wait for the notifications table (Rows per page) to be visible before returning, ensuring filter controls are rendered before selectSeverity() tries to click them

Test Results

  • Code quality: tsc, lint, prettier all pass
  • Local test execution: Keycloak auth unavailable (deployment interrupted) — verification deferred to CI

Related

… filters

The clickNotificationsNavBarItem() method was returning before the
notifications page fully rendered. The loading-indicator check passed
vacuously because the element didn't exist yet in the DOM, while the
page was still loading (shown by progressbar elements). This caused
selectSeverity() to timeout trying to click getByLabel('Severity')
since the filter controls weren't rendered yet.

Added a wait for the notifications table to be visible, ensuring the
page content has fully loaded before subsequent filter interactions.

Assisted-by: OpenCode
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@zdrapela
Copy link
Copy Markdown
Member Author

/agentic_review

@zdrapela
Copy link
Copy Markdown
Member Author

/test ?

@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge Bot commented Apr 23, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Brittle table wait selector 🐞 Bug ☼ Reliability
Description
clickNotificationsNavBarItem() now waits for a role=table element containing the text "Rows per
page"; if pagination is rendered outside the table subtree, this expect will never match and will
time out (30s), breaking all notifications tests that call this helper.
Code

e2e-tests/playwright/support/pages/notifications.ts[R18-21]

+    // Wait for the notifications page content to fully render
+    await expect(
+      this.page.getByRole("table").filter({ hasText: "Rows per page" }),
+    ).toBeVisible({ timeout: 30000 });
Relevance

⭐⭐⭐ High

Selector assumes “Rows per page” is within role=table; pagination often separate, risking 30s
timeout/flakes.

PR-#3406
PR-#4437
PR-#4533

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new selector requires "Rows per page" to be contained within the element with ARIA role "table".
However, within this repo the pagination control is interacted with as a separate control (by label
/ as a role=button), indicating it may not be part of the table element’s subtree—making the new
wait condition prone to timing out even when the page is correctly rendered.

e2e-tests/playwright/support/pages/notifications.ts[13-22]
e2e-tests/playwright/support/pages/notifications.ts[24-31]
e2e-tests/playwright/e2e/extensions.spec.ts[485-506]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`clickNotificationsNavBarItem()` waits for `getByRole('table').filter({ hasText: 'Rows per page' })` to become visible. This is brittle because pagination is typically not inside the `<table>` subtree (and in this repo it’s interacted with as a separate labeled/button control), so the wait can time out even when the page is ready.

### Issue Context
This helper is used by multiple notifications specs, so a selector mismatch here will cause broad test failures (30s timeout per call).

### Fix Focus Areas
- e2e-tests/playwright/support/pages/notifications.ts[13-22]

### Suggested fix
Replace the wait with a condition that targets an element that actually represents “page ready”, e.g.:
- Wait for the table itself to be visible (without `hasText`), AND/OR
- Wait for the pagination/page-size control you already click later (`getByLabel(/.*rows/i)` or `getByRole('button', { name: /Rows per page/i })`) to be visible.

Example:
```ts
await expect(this.page.getByRole('table')).toBeVisible({ timeout: 30000 });
await expect(this.page.getByLabel(/.*rows/i)).toBeVisible({ timeout: 30000 });
```

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@zdrapela
Copy link
Copy Markdown
Member Author

/test e2e-ocp-v4-19-helm-nightly

Address Qodo review feedback: the previous selector
getByRole('table').filter({ hasText: 'Rows per page' }) was brittle
since pagination may render outside the table subtree. Waiting for
getByLabel('Severity') directly targets the element needed by the
next interaction (selectSeverity), making the wait both precise and
resilient.

Assisted-by: OpenCode
@github-actions
Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

@zdrapela
Copy link
Copy Markdown
Member Author

/test e2e-ocp-helm-nightly

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

@zdrapela: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-ocp-helm-nightly 0f0f0d4 link false /test e2e-ocp-helm-nightly

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

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.

1 participant