Skip to content

4.19: Tests: Fix goToPodDetails helper flakiness#2081

Open
kyoto wants to merge 1 commit into
openshift:release-4.19from
kyoto:4.19-fix-goToPodDetails
Open

4.19: Tests: Fix goToPodDetails helper flakiness#2081
kyoto wants to merge 1 commit into
openshift:release-4.19from
kyoto:4.19-fix-goToPodDetails

Conversation

@kyoto

@kyoto kyoto commented Jun 16, 2026

Copy link
Copy Markdown
Member

Manual backport of #2076

Summary by CodeRabbit

  • Tests
    • Improved test helper to better target specific pod entries by filtering and waiting for visibility, enhancing test reliability and reducing flakiness.

@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 test file is updated to locate the pod link by filtering resource rows to those containing the target podName, waiting up to 30 seconds for the first match to become visible, then clicking it. The previous approach clicked the first generic resource name link after asserting overall row count.

Changes

Pod Details Navigation Fix

Layer / File(s) Summary
goToPodDetails pod-specific link selection
tests/tests/lightspeed.spec.ts
Replaces generic first-link click (with row-count assertion) with a podName-filtered resource row lookup, a 30s visibility wait, and a targeted click on the matched link.

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 to filter pods by podName and wait for the specific link, the same pattern introduced here.

Suggested reviewers

  • joshuawilson
  • JoaoFula

Poem

🐇 No more grabbing the first link in sight,
The rabbit now filters by name — just right!
podName is matched, the row is found,
A 30-second wait, then click! Safe and sound.
Precision over guessing, every test night. ✨

🚥 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.
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:55
@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@tests/tests/lightspeed.spec.ts`:
- Around line 37-39: The test is currently clicking on the resource row
container itself (the result of page.locator(resourceRows).filter({ hasText:
podName })), which can lead to flaky behavior. Instead of clicking link.first()
directly, locate the resource-name anchor element within the filtered row and
click that specific anchor element to ensure reliable navigation. This targets
the actual clickable link rather than the container row.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5d0fdbc2-849e-4feb-ac5d-4fc7e0d5845e

📥 Commits

Reviewing files that changed from the base of the PR and between 946c356 and edf87fa.

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

Comment on lines +37 to +39
const link = page.locator(resourceRows).filter({ hasText: podName });
await expect(link.first()).toBeVisible({ timeout: 30_000 });
await link.first().click();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Click the pod link element, not the row container.

On Line 37-39, link resolves to matching resource rows and the test clicks the row itself. That can still be flaky/non-navigational. Target the resource-name anchor within the filtered row and click that element explicitly.

Proposed fix
-  const link = page.locator(resourceRows).filter({ hasText: podName });
-  await expect(link.first()).toBeVisible({ timeout: 30_000 });
-  await link.first().click();
+  const row = page.locator(resourceRows).filter({ hasText: podName }).first();
+  const link = row.locator('a.co-resource-item__resource-name').first();
+  await expect(link).toBeVisible({ timeout: 30_000 });
+  await link.click();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const link = page.locator(resourceRows).filter({ hasText: podName });
await expect(link.first()).toBeVisible({ timeout: 30_000 });
await link.first().click();
const row = page.locator(resourceRows).filter({ hasText: podName }).first();
const link = row.locator('a.co-resource-item__resource-name').first();
await expect(link).toBeVisible({ timeout: 30_000 });
await link.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 test is currently
clicking on the resource row container itself (the result of
page.locator(resourceRows).filter({ hasText: podName })), which can lead to
flaky behavior. Instead of clicking link.first() directly, locate the
resource-name anchor element within the filtered row and click that specific
anchor element to ensure reliable navigation. This targets the actual clickable
link rather than the container row.

@kyoto

kyoto commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

/retest

@kyoto kyoto force-pushed the 4.19-fix-goToPodDetails branch from edf87fa to f3a1f61 Compare June 17, 2026 07:27
@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