Skip to content

Improve Cypress tests PF4 branch#1532

Open
Amoghrd wants to merge 1 commit into
netobserv:main-pf4from
Amoghrd:improvements-pf4
Open

Improve Cypress tests PF4 branch#1532
Amoghrd wants to merge 1 commit into
netobserv:main-pf4from
Amoghrd:improvements-pf4

Conversation

@Amoghrd
Copy link
Copy Markdown
Member

@Amoghrd Amoghrd commented May 15, 2026

Description

Improve Cypress tests similar to #1514
PR does not include TLS automation since its not going to be cherry-picked to main-pf4 branch

Dependencies

n/a

Checklist

  • Does the changes in PR need specific configuration or environment set up for testing?
    • if so please describe it in PR description.
  • I have added thorough unit tests for the change.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Summary by CodeRabbit

Release Notes

  • Tests

    • Improved test reliability with enhanced column verification helpers and explicit pod readiness waiting
    • Strengthened UI navigation testing with more robust tab selection methods
    • Updated test infrastructure for better maintainability
  • Chores

    • Streamlined test server provisioning setup
    • Optimized operator installation verification process

Review Change Stack

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found 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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55a03396-5651-43ec-945f-20fcd58aa4ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning PR description provided but missing required template sections and details for proper evaluation. Add specific configuration/environment setup details if needed, confirm QE requirements selection, and provide thorough explanation of test improvements made.
Title check ❓ Inconclusive The title 'Improve Cypress tests PF4 branch' is vague and generic; it uses non-descriptive terms that don't convey meaningful information about the specific changes made. Provide a more specific title describing the main improvement (e.g., 'Add selectAndVerifyColumns helper for Cypress tests' or 'Refactor column selection in Cypress tests').
✅ Passed checks (3 passed)
Check name Status Explanation
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Amoghrd Amoghrd changed the title Improve Cypress tests Improve Cypress tests PF4 branch May 15, 2026
@Amoghrd Amoghrd requested a review from memodi May 15, 2026 19:48
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
web/cypress/views/netflow-page.ts (1)

410-410: 💤 Low value

Consider removing { force: true } option.

Using { force: true } can mask real UI issues like elements being covered or disabled. Lines 421 and 427 don't require it. If the Overview tab needs forcing due to being pre-selected, consider adding a comment explaining why.

🤖 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 `@web/cypress/views/netflow-page.ts` at line 410, The test is using
cy.get('#tabs-container').contains('Overview').click({ force: true }) which can
hide real UI issues; remove the { force: true } option so the click fails if the
tab is covered/disabled, and only reintroduce force with a short inline comment
explaining why (e.g., pre-selected state) if you have a justified reason; update
the call in netflow-page.ts to plain .click() and ensure the test asserts the
tab is visible/enabled before clicking (or add the explanatory comment next to
the forced click if you must keep it).
web/cypress/integration-tests/quickFilters.cy.ts (1)

35-39: ⚡ Quick win

Replace fixed sleep with condition-based waits.

Line 35 introduces a hard-coded delay, which can still flake under slow/fast cluster conditions. Use oc wait --for=create + oc wait --for=condition=Ready instead of sleeping.

Suggested diff
-        // Wait for pods to be created
-        cy.wait(10000)
-
-        // Wait for pods to be ready
+        // Wait for pods to exist, then be ready
+        cy.adminCLI('oc wait --for=create pod -l app=nginx -n test-server-56222 --timeout=120s')
+        cy.adminCLI('oc wait --for=create pod/client -n test-client-56222 --timeout=120s')
         cy.adminCLI('oc wait --for=condition=Ready pod -l app=nginx -n test-server-56222 --timeout=120s')
-        cy.adminCLI('oc wait --for=condition=Ready pod -n test-client-56222 client --timeout=120s')
+        cy.adminCLI('oc wait --for=condition=Ready pod/client -n test-client-56222 --timeout=120s')
🤖 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 `@web/cypress/integration-tests/quickFilters.cy.ts` around lines 35 - 39,
Replace the hard-coded cy.wait(10000) in quickFilters.cy.ts with condition-based
waits: remove the sleep and use cy.adminCLI to run oc wait --for=created pod -l
app=nginx -n test-server-56222 --timeout=120s (and similarly for the client pod)
followed by oc wait --for=condition=Ready pod -l app=nginx -n test-server-56222
--timeout=120s and oc wait --for=condition=Ready pod -n test-client-56222 client
--timeout=120s so the test waits for pod creation and readiness instead of a
fixed delay.
🤖 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 `@web/cypress/views/netobserv.ts`:
- Around line 88-97: The oc get csv call in install() and visitFlowcollector()
can pick non-Succeeded CSVs; change the cy.adminCLI query to filter for
status.phase==Succeeded (e.g., oc get csv -n openshift-netobserv-operator -o
custom-columns=":metadata.name" --field-selector status.phase=Succeeded or use
--selector/jsonpath to only return Succeeded CSV names) so you only pick CSVs in
Succeeded state, factor the query+parsing into a shared helper (e.g.,
getSucceededNetObservCsvName()) used by both install() and visitFlowcollector(),
and replace the result typing from any to a proper CLI response interface
(typing the result as { stdout?: string; stderr?: string }) so there are no any
annotations.
- Around line 89-90: Replace the use of the any type for the CLI result in the
Promise .then callbacks by typing the parameter as { stdout?: string } instead
of any; update both occurrences where .then((result: any) => { ... }) (the first
callback around the stdout trim and the second one near lines 116–117) to
.then((result: { stdout?: string }) => { ... }) so the code continues to extract
const stdout = result.stdout ? result.stdout.trim() : '' with a proper
TypeScript type.

---

Nitpick comments:
In `@web/cypress/integration-tests/quickFilters.cy.ts`:
- Around line 35-39: Replace the hard-coded cy.wait(10000) in quickFilters.cy.ts
with condition-based waits: remove the sleep and use cy.adminCLI to run oc wait
--for=created pod -l app=nginx -n test-server-56222 --timeout=120s (and
similarly for the client pod) followed by oc wait --for=condition=Ready pod -l
app=nginx -n test-server-56222 --timeout=120s and oc wait --for=condition=Ready
pod -n test-client-56222 client --timeout=120s so the test waits for pod
creation and readiness instead of a fixed delay.

In `@web/cypress/views/netflow-page.ts`:
- Line 410: The test is using
cy.get('#tabs-container').contains('Overview').click({ force: true }) which can
hide real UI issues; remove the { force: true } option so the click fails if the
tab is covered/disabled, and only reintroduce force with a short inline comment
explaining why (e.g., pre-selected state) if you have a justified reason; update
the call in netflow-page.ts to plain .click() and ensure the test asserts the
tab is visible/enabled before clicking (or add the explanatory comment next to
the forced click if you must keep it).
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: decc3c9b-50d7-42e7-a758-7098bc480adf

📥 Commits

Reviewing files that changed from the base of the PR and between d8e7c98 and d2aa8ed.

📒 Files selected for processing (10)
  • web/cypress/fixtures/test-server-client.yaml
  • web/cypress/integration-tests/dns_tracking.cy.ts
  • web/cypress/integration-tests/netflow_cluster_admin_group.cy.ts
  • web/cypress/integration-tests/netflow_external_subnet.cy.ts
  • web/cypress/integration-tests/netflow_table.cy.ts
  • web/cypress/integration-tests/netflow_zone_multiCluster.cy.ts
  • web/cypress/integration-tests/quickFilters.cy.ts
  • web/cypress/integration-tests/table_queryopts.cy.ts
  • web/cypress/views/netflow-page.ts
  • web/cypress/views/netobserv.ts

Comment thread web/cypress/views/netobserv.ts
Comment thread web/cypress/views/netobserv.ts
@Amoghrd Amoghrd force-pushed the improvements-pf4 branch 2 times, most recently from dd76014 to 6830f8d Compare May 18, 2026 18:04
@memodi
Copy link
Copy Markdown
Member

memodi commented May 18, 2026

@Amoghrd - I am assuming you ran the tests on 4.14 cluster to verify the tests are working well.

/lgtm

@Amoghrd
Copy link
Copy Markdown
Member Author

Amoghrd commented May 18, 2026

In the process of doing that

@Amoghrd Amoghrd force-pushed the improvements-pf4 branch from 6830f8d to bccac12 Compare May 18, 2026 20:23
@openshift-ci openshift-ci Bot removed the lgtm label May 18, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 18, 2026

New changes are detected. LGTM label has been removed.

@Amoghrd
Copy link
Copy Markdown
Member Author

Amoghrd commented May 18, 2026

Jenkins run: noo-frontend-tests#80
Failing tests passed on rerun

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 18, 2026

@Amoghrd: 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/plugin-cypress bccac12 link true /test plugin-cypress

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants