Skip to content

PF5: Tests: Fix goToPodDetails helper flakiness#2082

Open
kyoto wants to merge 1 commit into
openshift:pattern-fly-5from
kyoto:pf5-fix-goToPodDetails
Open

PF5: Tests: Fix goToPodDetails helper flakiness#2082
kyoto wants to merge 1 commit into
openshift:pattern-fly-5from
kyoto:pf5-fix-goToPodDetails

Conversation

@kyoto

@kyoto kyoto commented Jun 16, 2026

Copy link
Copy Markdown
Member

Manual backport of #2076

Summary by CodeRabbit

  • Tests
    • Improved pod navigation test helper with enhanced element selection logic and explicit visibility waiting to ensure more reliable test execution.

@kyoto kyoto added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The goToPodDetails helper in the Lightspeed E2E test file is updated to locate a pod row by filtering resourceRows with hasText: podName, explicitly waiting (30s timeout) for the first matching link to be visible before clicking it, replacing the prior row-count assertion and generic first-element click.

Changes

Pod Navigation Fix

Layer / File(s) Summary
goToPodDetails row filtering and visibility wait
tests/tests/lightspeed.spec.ts
Filters resourceRows by podName text, waits up to 30s for the first matching link's visibility, then clicks it. Removes the previous row-count assertion and the generic a.co-resource-item__resource-name first-element click.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • openshift/lightspeed-console#2076: Modifies the same goToPodDetails helper in tests/tests/lightspeed.spec.ts with closely related changes to row filtering and pod name matching logic.

Poem

🐇 Hoppity-hop through the pod rows I go,
No more first-click guesses in the UI flow!
I filter by name and I wait to be sure,
Thirty whole seconds — my patience is pure.
The right pod, the right link, the right test to pass,
✨ This bunny won't click on the wrong pod at last!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing flakiness in the goToPodDetails test helper function for the PF5 branch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from JoaoFula and syedriko June 16, 2026 05:59
@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

1 similar comment
@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/tests/lightspeed.spec.ts (1)

37-39: ⚡ Quick win

Consider storing .first() result and improving variable naming.

The variable link is somewhat misleading as it contains a row locator rather than a link element. Additionally, calling .first() twice (lines 38 and 39) re-evaluates the locator each time. While Playwright's auto-waiting should handle this safely, storing the result would improve clarity and ensure the exact same element is validated and clicked.

♻️ Suggested refactor
- const link = page.locator(resourceRows).filter({ hasText: podName });
- await expect(link.first()).toBeVisible({ timeout: 30_000 });
- await link.first().click();
+ const matchingRows = page.locator(resourceRows).filter({ hasText: podName });
+ const firstRow = matchingRows.first();
+ await expect(firstRow).toBeVisible({ timeout: 30_000 });
+ await firstRow.click();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/tests/lightspeed.spec.ts` around lines 37 - 39, The variable name
`link` is misleading because it holds a row locator, not a link element, and
calling `.first()` twice (in the expect statement and click statement)
re-evaluates the locator unnecessarily. Rename the `link` variable to something
more descriptive like `resourceRow` to better reflect that it contains a row
element, then store the result of `.first()` in a separate variable (e.g.,
`firstRow`) so that the exact same element is validated with expect and clicked
without re-evaluation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/tests/lightspeed.spec.ts`:
- Around line 37-39: The variable name `link` is misleading because it holds a
row locator, not a link element, and calling `.first()` twice (in the expect
statement and click statement) re-evaluates the locator unnecessarily. Rename
the `link` variable to something more descriptive like `resourceRow` to better
reflect that it contains a row element, then store the result of `.first()` in a
separate variable (e.g., `firstRow`) so that the exact same element is validated
with expect and clicked without re-evaluation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 482c5eb8-5956-4dd4-9818-9456b7b0348b

📥 Commits

Reviewing files that changed from the base of the PR and between 65d00db and e0b4d82.

📒 Files selected for processing (1)
  • tests/tests/lightspeed.spec.ts

@kyoto kyoto force-pushed the pf5-fix-goToPodDetails branch from e0b4d82 to 7edd15e Compare June 17, 2026 07:28
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2026
@openshift-ci

openshift-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant