Skip to content

[WIP] OCPBUGS-82510: Fix web-terminal-adminuser e2e tests broken by createRoot#16284

Open
stefanonardo wants to merge 1 commit intoopenshift:mainfrom
stefanonardo:OCPBUGS-82510-clean
Open

[WIP] OCPBUGS-82510: Fix web-terminal-adminuser e2e tests broken by createRoot#16284
stefanonardo wants to merge 1 commit intoopenshift:mainfrom
stefanonardo:OCPBUGS-82510-clean

Conversation

@stefanonardo
Copy link
Copy Markdown
Contributor

@stefanonardo stefanonardo commented Apr 15, 2026

Summary

The web-terminal-adminuser.feature e2e tests were disabled after the createRoot migration (CONSOLE-4512) because they started failing consistently. Root cause analysis (via CI Cypress Cloud replays and local reproduction) revealed:

  • clickStartButton in initTerminal-page.ts used a synchronous $body.find() jQuery check to detect a loading indicator. Under legacy ReactDOM.render, React committed updates synchronously after a click, so the indicator was in the DOM when the check ran. Under createRoot, renders are deferred — the check always fails and triggers an OCPBUGS-44891 recovery path that leaves the app in a broken state (drawer open, sidebar scrolled, workspace already created), causing cascading failures on retry.
  • cos-status-box cos-status-box--loading selectors matched nonexistent HTML elements (should be CSS class selectors), passing immediately as no-ops.
  • Workspace cleanup ran at the end of each test — if a test failed before reaching cleanup, subsequent tests found leftover workspaces and never saw the setup form.

Changes

  • initTerminal-page.ts: Replace synchronous $body.find() + recovery path with a Cypress retry-based cy.get().should('exist') that waits for the loading indicator
  • web-terminal-adminuser.ts, webTerminal.ts: Replace broken cos-status-box selectors with [data-test="loading-box"]
  • web-terminal-adminuser.feature: Move workspace cleanup to Background (runs before each test), remove disabling comment
  • nav.ts: Add scrollIntoView() to perspective switcher toggle — on CI, sidebar favorites from earlier specs can push it out of view

Test plan

  • Verify web-terminal-adminuser.feature tests pass on CI (e2e-gcp-console job)
  • Manual verification: on a cluster with Web Terminal Operator, open terminal drawer as admin → setup form renders, Start creates a workspace successfully

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved test stability for perspective switcher navigation with enhanced element visibility checks.
    • Simplified web terminal initialization flow by removing redundant closure steps.
    • Updated DOM element detection selectors for more reliable test assertions.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 15, 2026

@stefanonardo: This pull request references Jira Issue OCPBUGS-82510, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.23.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

The web-terminal-adminuser.feature e2e tests were disabled after the createRoot migration (CONSOLE-4512) because they started failing consistently. Root cause analysis (via CI Cypress Cloud replays and local reproduction) revealed:

  • clickStartButton in initTerminal-page.ts used a synchronous $body.find() jQuery check to detect a loading indicator. Under legacy ReactDOM.render, React committed updates synchronously after a click, so the indicator was in the DOM when the check ran. Under createRoot, renders are deferred — the check always fails and triggers an OCPBUGS-44891 recovery path that leaves the app in a broken state (drawer open, sidebar scrolled, workspace already created), causing cascading failures on retry.
  • cos-status-box cos-status-box--loading selectors matched nonexistent HTML elements (should be CSS class selectors), passing immediately as no-ops.
  • Workspace cleanup ran at the end of each test — if a test failed before reaching cleanup, subsequent tests found leftover workspaces and never saw the setup form.

Changes

  • initTerminal-page.ts: Replace synchronous $body.find() + recovery path with a Cypress retry-based cy.get().should('exist') that waits for the loading indicator
  • web-terminal-adminuser.ts, webTerminal.ts: Replace broken cos-status-box selectors with [data-test="loading-box"]
  • web-terminal-adminuser.feature: Move workspace cleanup to Background (runs before each test), remove disabling comment
  • nav.ts: Add scrollIntoView() to perspective switcher toggle — on CI, sidebar favorites from earlier specs can push it out of view

Test plan

  • Verify web-terminal-adminuser.feature tests pass on CI (e2e-gcp-console job)
  • Manual verification: on a cluster with Web Terminal Operator, open terminal drawer as admin → setup form renders, Start creates a workspace successfully

🤖 Generated with Claude Code

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the kind/cypress Related to Cypress e2e integration testing label Apr 15, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: stefanonardo
Once this PR has been reviewed and has the lgtm label, please assign logonoff for approval. 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

This pull request refactors integration tests across the Web Terminal plugin and navigation components. Changes include: (1) adding scroll-into-view logic before perspective-switcher visibility assertions to improve test reliability, (2) standardizing DOM element selectors from CSS class-based selectors to data-test attributes for loading state checks, (3) simplifying terminal initialization logic by removing conditional re-initialization paths and their associated imports and control flow, and (4) consolidating terminal workspace cleanup steps within the Gherkin feature background rather than repeating them across individual scenarios. The modifications maintain existing test coverage while reducing brittle conditional branching in test step definitions.

🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed This check is not applicable to the modified code in this PR. The PR contains only Gherkin/Cucumber feature files and Cypress TypeScript integration tests, not Ginkgo Go tests. The Ginkgo check applies to Go testing frameworks which are not used in these modifications. The Gherkin scenario names present are descriptive and static with no dynamic content that changes between test runs.
Test Structure And Quality ✅ Passed This PR contains only Cypress/Cucumber integration tests in TypeScript and Gherkin. The custom check assesses Ginkgo test code quality, which is inapplicable to this PR's scope.
Microshift Test Compatibility ✅ Passed PR modifies Cypress integration tests (TypeScript/JavaScript), not Ginkgo e2e tests (Go framework). Custom check targets Ginkgo tests and is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed SNO Test Compatibility check is for Ginkgo e2e tests; this PR only modifies Cypress integration tests in TypeScript and Gherkin, not Go-based tests.
Topology-Aware Scheduling Compatibility ✅ Passed All five modified files are test-only infrastructure in integration-tests/ subdirectories: Cypress feature files, step definitions, and view helpers with no production code, deployment manifests, operators, or controllers.
Ote Binary Stdout Contract ✅ Passed PR modifies only Cypress integration test files (TypeScript and Gherkin) in web terminal and navigation modules; no Go code, test binaries, or Ginkgo configuration affected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This custom check targets Ginkgo Go-based e2e tests, but the PR contains only Cypress/TypeScript frontend tests and Gherkin feature files—no Go code subject to the IPv6/network constraints.
Title check ✅ Passed The title clearly identifies the bug being fixed (OCPBUGS-82510) and summarizes the main change: repairing broken web-terminal e2e tests caused by React's createRoot migration.

✏️ 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.

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)
frontend/packages/integration-tests/views/nav.ts (1)

13-15: Optional: centralize repeated toggle visibility prep into one helper.

The same byLegacyTestID(...).scrollIntoView().should('be.visible') chain is repeated three times; extracting it would make future selector/wait tuning easier.

♻️ Suggested refactor
+const ensurePerspectiveSwitcherToggleVisible = () =>
+  cy.byLegacyTestID('perspective-switcher-toggle').scrollIntoView().should('be.visible');

...
-            cy.byLegacyTestID('perspective-switcher-toggle')
-              .scrollIntoView()
-              .should('be.visible')
+            ensurePerspectiveSwitcherToggleVisible()
               .then(($toggle) => {

...
-            cy.byLegacyTestID('perspective-switcher-toggle')
-              .scrollIntoView()
-              .should('be.visible')
+            ensurePerspectiveSwitcherToggleVisible()
               .then(($toggle) => {

...
-            cy.byLegacyTestID('perspective-switcher-toggle')
-              .scrollIntoView()
-              .should('be.visible')
+            ensurePerspectiveSwitcherToggleVisible()
               .find('.pf-v6-c-menu-toggle__text')

Also applies to: 35-37, 80-82

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

In `@frontend/packages/integration-tests/views/nav.ts` around lines 13 - 15,
Extract the repeated chain
cy.byLegacyTestID(...).scrollIntoView().should('be.visible') into a small helper
(e.g., ensureVisibleToggle or ensureTestIdVisible) and call that helper wherever
the pattern appears (references: cy.byLegacyTestID and the
'perspective-switcher-toggle' selector and the other similar selectors currently
using the same chain); update the three occurrences that use that chain to call
the new helper with the appropriate test id so future tuning of scroll/wait
behavior is centralized and easy to change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/packages/integration-tests/views/nav.ts`:
- Around line 13-15: Extract the repeated chain
cy.byLegacyTestID(...).scrollIntoView().should('be.visible') into a small helper
(e.g., ensureVisibleToggle or ensureTestIdVisible) and call that helper wherever
the pattern appears (references: cy.byLegacyTestID and the
'perspective-switcher-toggle' selector and the other similar selectors currently
using the same chain); update the three occurrences that use that chain to call
the new helper with the appropriate test id so future tuning of scroll/wait
behavior is centralized and easy to change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 8410ebc6-f6c9-434c-822c-39d6d7637a26

📥 Commits

Reviewing files that changed from the base of the PR and between 6a8db8b and 338adc7.

📒 Files selected for processing (5)
  • frontend/packages/integration-tests/views/nav.ts
  • frontend/packages/webterminal-plugin/integration-tests/features/web-terminal/web-terminal-adminuser.feature
  • frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/common/webTerminal.ts
  • frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/pages/web-terminal/initTerminal-page.ts
  • frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/web-terminal/web-terminal-adminuser.ts
📜 Review details
🔇 Additional comments (6)
frontend/packages/integration-tests/views/nav.ts (1)

13-15: Good reliability improvement for perspective-switcher interactions.

Adding scrollIntoView() before the visibility check is a solid way to reduce CI flakiness when sidebar/favorites layout shifts push the toggle out of viewport.

Also applies to: 35-37, 80-82

frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/web-terminal/web-terminal-adminuser.ts (1)

45-45: Good selector fix and synchronization point.

Using [data-test="loading-box"] aligns this step with the actual loading component and avoids the previous no-op selector behavior.

frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/common/webTerminal.ts (1)

51-51: Consistent loading selector update here as well.

This keeps the common step aligned with the same loading-state strategy used across the web terminal e2e flow.

frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/pages/web-terminal/initTerminal-page.ts (2)

3-3: Import cleanup looks correct.

app remains actively used, and the simplified import surface matches the refactored flow.


21-21: CreateRoot-safe wait in start flow.

Waiting on [data-test="loading-box-body"] after Start is a cleaner, retry-friendly replacement for the prior synchronous branch logic.

frontend/packages/webterminal-plugin/integration-tests/features/web-terminal/web-terminal-adminuser.feature (1)

9-9: Strong test-isolation improvement in Background.

Running workspace cleanup before each scenario is the right move to prevent cross-test contamination and flaky retries.

@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

@stefanonardo stefanonardo force-pushed the OCPBUGS-82510-clean branch 2 times, most recently from 5d94cbb to f699061 Compare April 16, 2026 11:36
@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci openshift-ci bot added the component/dev-console Related to dev-console label Apr 16, 2026
@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

Replace clickStartButton's synchronous $body.find() check with a Cypress
retry-based assertion. createRoot defers renders, so the old check always
failed and triggered a recovery path that broke the test state.

Also fix broken cos-status-box selectors, move workspace cleanup to
Background, and add scrollIntoView() to the perspective switcher toggle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@stefanonardo stefanonardo changed the title OCPBUGS-82510: Fix web-terminal-adminuser e2e tests broken by createRoot [WIP] OCPBUGS-82510: Fix web-terminal-adminuser e2e tests broken by createRoot Apr 17, 2026
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 17, 2026
@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 17, 2026

@stefanonardo: all tests passed!

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

component/dev-console Related to dev-console do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants