Skip to content

NETOBSERV-2683 fix dropdowns state change#1378

Merged
jpinsonneau merged 4 commits intonetobserv:mainfrom
jpinsonneau:2683
Apr 10, 2026
Merged

NETOBSERV-2683 fix dropdowns state change#1378
jpinsonneau merged 4 commits intonetobserv:mainfrom
jpinsonneau:2683

Conversation

@jpinsonneau
Copy link
Copy Markdown
Member

@jpinsonneau jpinsonneau commented Mar 25, 2026

Description

Replaced the onBlur trick by onOpenChange. That should fix cypress flakiness.

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

  • Refactor

    • Improved dropdown behavior across many UI controls by switching to event-driven open/close handling (removing blur-based delayed closes) for more consistent, predictable menus.
    • Made refresh control interactions more reliably synchronized so selecting "Refresh Off" waits for the menu to be visible before applying.
  • Tests

    • Stabilized end-to-end tests by adjusting table selection indices and refresh interactions for more reliable automated assertions.

@memodi
Copy link
Copy Markdown
Member

memodi commented Mar 27, 2026

/ok-to-test

@openshift-ci openshift-ci Bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 27, 2026
@github-actions
Copy link
Copy Markdown

New image:

quay.io/netobserv/network-observability-console-plugin:cddf49a

It will expire in two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=cddf49a make set-plugin-image

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.34%. Comparing base (4086e4f) to head (ce4552e).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1378      +/-   ##
==========================================
+ Coverage   51.29%   51.34%   +0.04%     
==========================================
  Files         225      225              
  Lines       12117    12107      -10     
  Branches     1516     1516              
==========================================
  Hits         6216     6216              
+ Misses       5319     5309      -10     
  Partials      582      582              
Flag Coverage Δ
uitests 55.21% <ø> (+0.06%) ⬆️
unittests 40.96% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
web/src/components/dropdowns/group-dropdown.tsx 100.00% <ø> (+5.55%) ⬆️
web/src/components/dropdowns/layout-dropdown.tsx 90.62% <ø> (+2.74%) ⬆️
web/src/components/dropdowns/match-dropdown.tsx 25.00% <ø> (+0.86%) ⬆️
.../src/components/dropdowns/metric-type-dropdown.tsx 76.92% <ø> (+2.84%) ⬆️
web/src/components/dropdowns/refresh-dropdown.tsx 87.50% <ø> (+3.50%) ⬆️
web/src/components/dropdowns/scope-dropdown.tsx 29.41% <ø> (+1.63%) ⬆️
...b/src/components/dropdowns/time-range-dropdown.tsx 68.42% <ø> (+1.75%) ⬆️
web/src/components/dropdowns/truncate-dropdown.tsx 100.00% <ø> (+3.12%) ⬆️
.../src/components/toolbar/filters/compare-filter.tsx 93.93% <ø> (+2.76%) ⬆️
web/src/components/toolbar/links-overflow.tsx 82.60% <ø> (+3.44%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

jotak
jotak previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

/lgtm

@memodi
Copy link
Copy Markdown
Member

memodi commented Mar 31, 2026

@jpinsonneau is this PR dependent on #1365 ? or could it be tested standalone?

@memodi
Copy link
Copy Markdown
Member

memodi commented Mar 31, 2026

/ok-to-test

@jpinsonneau
Copy link
Copy Markdown
Member Author

@jpinsonneau is this PR dependent on #1365 ? or could it be tested standalone?

That's fully independant 😉

@memodi
Copy link
Copy Markdown
Member

memodi commented Mar 31, 2026

@jpinsonneau in recent run, the fields.spec.ts is failing for FlowRTT:

  1) netflow-table
       display flowRTT:
     AssertionError: Timed out retrying after 30000ms: expected '<div.pf-v5-l-flex.pf-m-flex-1.record-field-flex-container>' to contain '4.05ms'
      at eval (webpack://netobserv-plugin/./cypress/support/commands.ts:201:7)
  at Array.forEach (<anonymous>)
      at Context.eval (webpack://netobserv-plugin/./cypress/support/commands.ts:198:9)
      at wrapped (http://localhost:9001/__cypress/runner/cypress_runner.js:146042:43)

any ideas how this got flaky?

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 1, 2026

@jpinsonneau I ran bunch of regression tests that uses dropdown, could you include this commit in this PR?

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jotak. For more information see the Code Review Process.

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

@github-actions github-actions Bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Apr 1, 2026
@jpinsonneau
Copy link
Copy Markdown
Member Author

@jpinsonneau I ran bunch of regression tests that uses dropdown, could you include this commit in this PR?

Sure, done in 8abdb71

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 1, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaced blur-based delayed closing on multiple PatternFly dropdowns by wiring onOpenChange={setOpen} to control open state; removed MenuToggle onBlur handlers. Updated Cypress: netflow-page.ts now waits for the dropdown menu to be visible before selecting OFF; table test row selectors were adjusted.

Changes

Cohort / File(s) Summary
Dropdown components
web/src/components/dropdowns/group-dropdown.tsx, web/src/components/dropdowns/layout-dropdown.tsx, web/src/components/dropdowns/match-dropdown.tsx, web/src/components/dropdowns/metric-type-dropdown.tsx, web/src/components/dropdowns/refresh-dropdown.tsx, web/src/components/dropdowns/scope-dropdown.tsx, web/src/components/dropdowns/time-range-dropdown.tsx, web/src/components/dropdowns/truncate-dropdown.tsx
Added onOpenChange={setOpen} to Dropdown and removed MenuToggle onBlur handlers that used a 500ms delayed setOpen(false). Toggle click and item selection semantics remain.
Toolbar / overflow dropdowns
web/src/components/toolbar/filters/compare-filter.tsx, web/src/components/toolbar/links-overflow.tsx
Same change as above: use onOpenChange={setOpen} and remove blur-driven delayed closes.
Cypress: refresh helper
web/cypress/views/netflow-page.ts
When refresh isn’t "Refresh off", click the refresh toggle, wait for .pf-v5-c-menu to become visible, assert [data-test="OFF_KEY"] is visible, then click it (replacing an immediate click).
Cypress: table tests
web/cypress/e2e/table/fields.spec.ts
Adjusted test row selectors (e.g., selecting #netflow-table-row-6/#netflow-table-row-7 in place of previous indices); assertions unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: replacing onBlur with onOpenChange in dropdown components to fix state management issues.
Description check ✅ Passed The description covers the core change (onBlur replaced by onOpenChange) and mentions the intent (fixing cypress flakiness). All required checklist items are addressed with QE requirement selected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

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

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


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.

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/cypress/views/netflow-page.ts`:
- Around line 55-57: The test clicks the refresh toggle twice around selecting
OFF_KEY which can re-open the dropdown (due to setOpen(!isOpen)); remove the
redundant cy.wrap($btn).click({ force: true }) after
cy.get('[data-test="OFF_KEY"]').should('exist').click({ force: true }) so the
sequence is: open toggle, click OFF_KEY, and do not click the toggle
again—update the test in netflow-page.ts to drop the third click referencing
$btn and keep only the initial toggle click and the OFF_KEY click.
🪄 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: d66497cd-460f-46b5-aa4f-2a6ef43c4189

📥 Commits

Reviewing files that changed from the base of the PR and between 4086e4f and 8abdb71.

📒 Files selected for processing (11)
  • web/cypress/views/netflow-page.ts
  • web/src/components/dropdowns/group-dropdown.tsx
  • web/src/components/dropdowns/layout-dropdown.tsx
  • web/src/components/dropdowns/match-dropdown.tsx
  • web/src/components/dropdowns/metric-type-dropdown.tsx
  • web/src/components/dropdowns/refresh-dropdown.tsx
  • web/src/components/dropdowns/scope-dropdown.tsx
  • web/src/components/dropdowns/time-range-dropdown.tsx
  • web/src/components/dropdowns/truncate-dropdown.tsx
  • web/src/components/toolbar/filters/compare-filter.tsx
  • web/src/components/toolbar/links-overflow.tsx

Comment thread web/cypress/views/netflow-page.ts Outdated
@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 1, 2026

/ok-to-test

@openshift-ci openshift-ci Bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Apr 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

New image:

quay.io/netobserv/network-observability-console-plugin:3855820

It will expire in two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=3855820 make set-plugin-image

@github-actions github-actions Bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Apr 1, 2026
Comment thread web/cypress/views/netflow-page.ts Outdated
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.

🧹 Nitpick comments (1)
web/cypress/e2e/table/fields.spec.ts (1)

100-101: Replace repeated magic row indices with named constants.

Line 101, Line 121, Line 137, and Line 148 hardcode row numbers in multiple tests. Centralizing them will make fixture-order updates safer and reduce churn.

♻️ Proposed refactor
 describe('netflow-table', () => {
+  const ROW_WITH_PKT_DROP_FLOWRTT_ZONES = 6;
+  const ROW_WITH_NETWORK_EVENTS = 7;
+
   const updatedData = r;
   updatedData.data.result.forEach(r => {
@@
   it('display pktDrop', () => {
     // select seventh row (has pktDrop data)
-    cy.get('#netflow-table-row-6').click();
+    cy.get(`#netflow-table-row-${ROW_WITH_PKT_DROP_FLOWRTT_ZONES}`).click();
@@
   it('display flowRTT', () => {
     // select seventh row (has flowRTT = 4047000ns = 4.05ms)
-    cy.get('#netflow-table-row-6').click();
+    cy.get(`#netflow-table-row-${ROW_WITH_PKT_DROP_FLOWRTT_ZONES}`).click();
@@
   it('display zones', () => {
     // select seventh row (has zone data: eu-west-1 and us-east-2)
-    cy.get('#netflow-table-row-6').click();
+    cy.get(`#netflow-table-row-${ROW_WITH_PKT_DROP_FLOWRTT_ZONES}`).click();
@@
   it('display networkEvents', () => {
     // select eighth row (has NetworkEvents data)
-    cy.get('#netflow-table-row-7').click();
+    cy.get(`#netflow-table-row-${ROW_WITH_NETWORK_EVENTS}`).click();

Also applies to: 120-121, 136-137, 147-148

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/e2e/table/fields.spec.ts` around lines 100 - 101, Replace
hardcoded numeric row indices used in selectors with named constants: define
constants near the top of the spec (for example const PKT_DROP_ROW = 6) and
replace every occurrence of selectors like '#netflow-table-row-6' (and other
'#netflow-table-row-N' uses found later) with template strings that interpolate
the constant, e.g. cy.get(`#netflow-table-row-${PKT_DROP_ROW}`).click(); do this
for each distinct row index used across the tests so the indices are centralized
and easy to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/cypress/e2e/table/fields.spec.ts`:
- Around line 100-101: Replace hardcoded numeric row indices used in selectors
with named constants: define constants near the top of the spec (for example
const PKT_DROP_ROW = 6) and replace every occurrence of selectors like
'#netflow-table-row-6' (and other '#netflow-table-row-N' uses found later) with
template strings that interpolate the constant, e.g.
cy.get(`#netflow-table-row-${PKT_DROP_ROW}`).click(); do this for each distinct
row index used across the tests so the indices are centralized and easy to
update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fcab0b52-4cd2-4faf-972f-50ca17518474

📥 Commits

Reviewing files that changed from the base of the PR and between 8abdb71 and df32961.

📒 Files selected for processing (1)
  • web/cypress/e2e/table/fields.spec.ts

@jpinsonneau jpinsonneau requested a review from memodi April 1, 2026 15:19
@jpinsonneau
Copy link
Copy Markdown
Member Author

Rebase without changes
That should fix cypress issues 😸

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.

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

42-49: Consider applying the same visibility wait pattern here for consistency.

setAutoRefresh clicks [data-test="15s"] immediately after opening the dropdown without waiting for menu visibility. This could exhibit similar flakiness.

Suggested fix
 setAutoRefresh: () => {
     cy.byTestID(genSelectors.refreshDrop).should('exist').then($btn => {
         // only set refresh if it's OFF
         if ($btn.text() == "Refresh off") {
             cy.wrap($btn).click({ force: true })
+            // Wait for dropdown menu to be rendered and visible
+            cy.get('.pf-v5-c-menu').should('be.visible')
-            cy.get('[data-test="15s"]').should('exist').click()
+            cy.get('[data-test="15s"]')
+                .should('be.visible')
+                .click()
         }
     })
 },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/netflow-page.ts` around lines 42 - 49, setAutoRefresh
currently opens the refresh dropdown and immediately clicks the
'[data-test="15s"]' item which can be flaky; update the function (identifier:
setAutoRefresh) to wait for the dropdown menu to be visible before clicking the
15s option by asserting visibility on the menu or the '[data-test="15s"]'
element (use the same visibility wait pattern used elsewhere with
genSelectors.refreshDrop and then call click on '[data-test="15s"]' only after a
should('be.visible')/should('exist') confirmation).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/cypress/views/netflow-page.ts`:
- Around line 42-49: setAutoRefresh currently opens the refresh dropdown and
immediately clicks the '[data-test="15s"]' item which can be flaky; update the
function (identifier: setAutoRefresh) to wait for the dropdown menu to be
visible before clicking the 15s option by asserting visibility on the menu or
the '[data-test="15s"]' element (use the same visibility wait pattern used
elsewhere with genSelectors.refreshDrop and then call click on
'[data-test="15s"]' only after a should('be.visible')/should('exist')
confirmation).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dbf6c412-f85d-464d-89a2-6a2209214c6d

📥 Commits

Reviewing files that changed from the base of the PR and between 5ec8572 and 5c43db1.

📒 Files selected for processing (12)
  • web/cypress/e2e/table/fields.spec.ts
  • web/cypress/views/netflow-page.ts
  • web/src/components/dropdowns/group-dropdown.tsx
  • web/src/components/dropdowns/layout-dropdown.tsx
  • web/src/components/dropdowns/match-dropdown.tsx
  • web/src/components/dropdowns/metric-type-dropdown.tsx
  • web/src/components/dropdowns/refresh-dropdown.tsx
  • web/src/components/dropdowns/scope-dropdown.tsx
  • web/src/components/dropdowns/time-range-dropdown.tsx
  • web/src/components/dropdowns/truncate-dropdown.tsx
  • web/src/components/toolbar/filters/compare-filter.tsx
  • web/src/components/toolbar/links-overflow.tsx
✅ Files skipped from review due to trivial changes (3)
  • web/src/components/dropdowns/layout-dropdown.tsx
  • web/src/components/dropdowns/refresh-dropdown.tsx
  • web/src/components/toolbar/links-overflow.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
  • web/src/components/toolbar/filters/compare-filter.tsx
  • web/src/components/dropdowns/truncate-dropdown.tsx
  • web/src/components/dropdowns/metric-type-dropdown.tsx
  • web/src/components/dropdowns/match-dropdown.tsx
  • web/src/components/dropdowns/time-range-dropdown.tsx
  • web/src/components/dropdowns/scope-dropdown.tsx
  • web/cypress/e2e/table/fields.spec.ts

@jpinsonneau
Copy link
Copy Markdown
Member Author

/retest

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 3, 2026

looks like the the plugin-cypress-tests image is taking too much memory to build and facing a SIGKILL, should we increase it's limit to 8Gi as well:
https://github.com/openshift/release/blob/main/ci-operator/config/netobserv/netobserv-web-console/netobserv-netobserv-web-console-main.yaml#L52

@jpinsonneau
Copy link
Copy Markdown
Member Author

looks like the the plugin-cypress-tests image is taking too much memory to build and facing a SIGKILL, should we increase it's limit to 8Gi as well: https://github.com/openshift/release/blob/main/ci-operator/config/netobserv/netobserv-web-console/netobserv-netobserv-web-console-main.yaml#L52

We can try if you think it's related but that's not supposed to take that much !

Do we have access to the log mentionned /home/node/.npm/_logs/2026-04-03T08_52_48_411Z-debug-0.log ?

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 7, 2026

Do we have access to the log mentionned /home/node/.npm/_logs/2026-04-03T08_52_48_411Z-debug-0.log ?

unfortunately no, other than what we see:

  * could not run steps: step plugin-cypress-tests failed: error occurred handling build plugin-cypress-tests-amd64: the build plugin-cypress-tests-amd64 failed after 4m2s with reason DockerBuildFailed: Dockerfile build strategy has failed.

npm error command failed
npm error signal SIGKILL
npm error command sh -c npm run clean:static && FLAVOR=sta..._ENV=production npm run ts-node ./node_modules/.bin/webpack
npm error A complete log of this run can be found in: /home/node/.npm/_logs/2026-04-03T08_52_48_411Z-debug-0.log
error: build error: building at STEP "RUN TRANSPILE_ONLY=t...npm run build:static": while running runtime: exit status 1 
�[36mINFO�[0m[2026-04-03T09:26:25Z] Reporting job state 'failed' with reason 'executing_graph:step_failed:building_project_image' 

testing it here openshift/release#77487

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 7, 2026

/retest

@jpinsonneau
Copy link
Copy Markdown
Member Author

Rebased without changes

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 8, 2026

@jpinsonneau images building fine now, but overview/fields/table tests are still failing here.

@jpinsonneau
Copy link
Copy Markdown
Member Author

Rebased and fixed cypress tests

@memodi it seems some issues are coming from others PRs. Let's fix everything here and merge 👍

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 9, 2026

thanks @jpinsonneau , I see it's passing now, re-running one more time to ensure it's stable.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 9, 2026

@jpinsonneau: 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/qe-e2e-console-tests d1da5c9 link false /test qe-e2e-console-tests

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.

@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 10, 2026

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Apr 10, 2026
@memodi
Copy link
Copy Markdown
Member

memodi commented Apr 10, 2026

/label qe-approved

@openshift-ci openshift-ci Bot added the qe-approved QE has approved this pull request label Apr 10, 2026
@jpinsonneau jpinsonneau merged commit c83176f into netobserv:main Apr 10, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm qe-approved QE has approved this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants