Skip to content

OCPBUGS-105609: Fix flaky web terminal e2e tests - #16953

Open
rhamilto wants to merge 1 commit into
openshift:mainfrom
rhamilto:OCPBUGS-105609
Open

OCPBUGS-105609: Fix flaky web terminal e2e tests#16953
rhamilto wants to merge 1 commit into
openshift:mainfrom
rhamilto:OCPBUGS-105609

Conversation

@rhamilto

@rhamilto rhamilto commented Aug 11, 2026

Copy link
Copy Markdown
Member

Analysis / Root cause:
Web terminal Playwright e2e tests are flaky in CI due to multiple independent issues:

  1. waitForTerminalIconVisible manual retry loop (10×15s) exceeds the 120s test timeout after warmupSPA already consumed 90s, causing "Target page closed" errors
  2. waitForTerminalWindow 60s timeout is insufficient for slow DevWorkspace provisioning
  3. Console operator detail page and dynamically-loaded Web Terminal tab time out in the config tests
  4. Default 120s test timeout is too short for operator-dependent tests that must wait for DevWorkspace provisioning

Solution description:

  • waitForTerminalIconVisible replaced manual retry loop with Playwright's toPass() pattern (120s budget, escalating intervals) which respects the test timeout and won't attempt a reload after teardown
  • waitForTerminalWindow default timeout increased from 60s to 120s
  • navigateToWebTerminalConfig uses longer timeouts (30s for loading, 60s for actions menu) and clickWebTerminalTab uses retries: 1 so the full 60s timeout goes to waiting rather than splitting across attempts
  • All web terminal tests marked test.slow() (triples timeout from 120s to 360s)
  • Extracted getBaseURL(), getAdminCredentials(), getDeveloperCredentials() into login-helper.ts to eliminate credential/URL duplication across auth setup files

Screenshots / screen recording:
N/A — no visual changes

Test setup:
Cluster with Web Terminal operator installed

Test cases:

  • All 3 admin tests pass (web-terminal-admin.spec.ts)
  • All 5 config tests pass (web-terminal-config.spec.ts)
  • ESLint passes on all modified files

Browser conformance:

  • Chrome

Additional info:
https://redhat.atlassian.net/browse/OCPBUGS-105609

🤖 Generated with Claude Code

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Aug 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-105609, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

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

Details

In response to this:

Analysis / Root cause:
Web terminal Playwright e2e tests are flaky in CI due to multiple independent issues:

  1. Expired auth sessions cause warmupSPA to retry for 90s waiting for #page-sidebar on the login page
  2. waitForTerminalIconVisible manual retry loop (10×15s) exceeds the 120s test timeout after warmupSPA already consumed 90s, causing "Target page closed" errors
  3. waitForTerminalWindow 60s timeout is insufficient for slow DevWorkspace provisioning
  4. Console operator detail page and dynamically-loaded Web Terminal tab time out in the config tests

Solution description:

  • warmupSPA now detects the login page ([data-test-id="login"] or #inputUsername) and re-authenticates using performLogin instead of retrying until timeout
  • waitForTerminalIconVisible replaced manual retry loop with Playwright's toPass() pattern (120s budget, escalating intervals) which respects the test timeout and won't attempt a reload after teardown
  • waitForTerminalWindow default timeout increased from 60s to 120s
  • navigateToWebTerminalConfig uses longer timeouts (30s for loading, 60s for actions menu) and clickWebTerminalTab uses retries: 1 so the full 60s timeout goes to waiting rather than splitting across attempts
  • All web terminal tests marked test.slow() (triples timeout from 120s to 360s)
  • Extracted getBaseURL(), getAdminCredentials(), getDeveloperCredentials() into login-helper.ts to eliminate credential/URL duplication across auth setup files and warmupSPA

Screenshots / screen recording:
N/A — no visual changes

Test setup:
Cluster with Web Terminal operator installed

Test cases:

  • All 3 admin tests pass (web-terminal-admin.spec.ts)
  • All 5 config tests pass (web-terminal-config.spec.ts)
  • ESLint passes on all modified files

Browser conformance:

  • Chrome

Additional info:
https://redhat.atlassian.net/browse/OCPBUGS-105609

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

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The PR centralizes E2E credential handling, adds login during SPA warmup, replaces manual Web Terminal retries with Playwright retries, increases relevant timeouts, and marks Web Terminal tests as slow.

Changes

E2E authentication flow

Layer / File(s) Summary
Centralized credentials and SPA authentication
frontend/e2e/setup/login-helper.ts, frontend/e2e/setup/*-auth.setup.ts, frontend/e2e/pages/base-page.ts
Shared helpers resolve console, administrator, and optional developer credentials. Authentication setups and warmupSPA use these helpers.

Web Terminal wait handling

Layer / File(s) Summary
Retryable waits and extended timeouts
frontend/e2e/pages/web-terminal-page.ts, frontend/e2e/pages/web-terminal-config-page.ts
Terminal icon checks use expect(...).toPass() with reloads. Terminal, loading, menu, and tab waits use longer timeouts.

Web Terminal test execution

Layer / File(s) Summary
Slow test configuration
frontend/e2e/tests/webterminal/**
Web Terminal tests use test.slow(). The unused warmupSPA import is removed from the administrator tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Test
  participant WebTerminalPage
  participant BasePage
  participant LoginHelper
  participant Console
  Test->>WebTerminalPage: waitForTerminalIconVisible()
  WebTerminalPage->>BasePage: warmupSPA()
  BasePage->>Console: detect login page
  BasePage->>LoginHelper: resolve credentials
  LoginHelper-->>BasePage: developer or administrator credentials
  BasePage->>Console: perform login
  WebTerminalPage->>Console: reload and check terminal icon
  Console-->>WebTerminalPage: terminal icon visible
Loading

Possibly related PRs

Suggested labels: verified

Suggested reviewers: fsgreco

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
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.
Stable And Deterministic Test Names ✅ Passed Changed suites use static literal Playwright test titles; the patch only adds test.slow() and removes an import. No Ginkgo It/Describe/Context/When titles or dynamic values were added.
Test Structure And Quality ✅ Passed The PR changes only frontend Playwright TypeScript tests and page/setup helpers; no Ginkgo test code or Ginkgo constructs are present, so this check is not applicable.
Microshift Test Compatibility ✅ Passed The commit changes only Playwright TypeScript pages, setup, and specs; no new Ginkgo It/Describe/Context/When tests were added, so this MicroShift API check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR changes only frontend TypeScript Playwright files; it adds no Go Ginkgo tests and introduces no multi-node or HA assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The patch changes only frontend Playwright pages, auth helpers, and tests; it adds no deployment manifests, operator/controller code, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The PR changes only 10 frontend/e2e TypeScript files; no Go OTE entry points or process-level stdout writes were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR modifies only frontend TypeScript Playwright files; it adds no Ginkgo tests, IPv4 literals, or external/public network calls.
No-Weak-Crypto ✅ Passed The patch adds login credential handling and timeout changes only; scans found no MD5, SHA1, DES, RC4, Blowfish, ECB, crypto APIs, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR changes 10 TypeScript files only; the diff contains 0 manifest-like files and 0 added privileged, host*, SYS_ADMIN, or privilege-escalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The commit adds no console/logger output, test attachments, or diagnostic interpolation of credentials; passwords are only read and passed to Playwright fill().
Title check ✅ Passed The title names the tracked bug and clearly states that it fixes flaky Web Terminal end-to-end tests.
Description check ✅ Passed The description covers root cause, solution, setup, test cases, browser coverage, and additional tracking information.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-105609, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Analysis / Root cause:
Web terminal Playwright e2e tests are flaky in CI due to multiple independent issues:

  1. Expired auth sessions cause warmupSPA to retry for 90s waiting for #page-sidebar on the login page
  2. waitForTerminalIconVisible manual retry loop (10×15s) exceeds the 120s test timeout after warmupSPA already consumed 90s, causing "Target page closed" errors
  3. waitForTerminalWindow 60s timeout is insufficient for slow DevWorkspace provisioning
  4. Console operator detail page and dynamically-loaded Web Terminal tab time out in the config tests

Solution description:

  • warmupSPA now detects the login page ([data-test-id="login"] or #inputUsername) and re-authenticates using performLogin instead of retrying until timeout
  • waitForTerminalIconVisible replaced manual retry loop with Playwright's toPass() pattern (120s budget, escalating intervals) which respects the test timeout and won't attempt a reload after teardown
  • waitForTerminalWindow default timeout increased from 60s to 120s
  • navigateToWebTerminalConfig uses longer timeouts (30s for loading, 60s for actions menu) and clickWebTerminalTab uses retries: 1 so the full 60s timeout goes to waiting rather than splitting across attempts
  • All web terminal tests marked test.slow() (triples timeout from 120s to 360s)
  • Extracted getBaseURL(), getAdminCredentials(), getDeveloperCredentials() into login-helper.ts to eliminate credential/URL duplication across auth setup files and warmupSPA

Screenshots / screen recording:
N/A — no visual changes

Test setup:
Cluster with Web Terminal operator installed

Test cases:

  • All 3 admin tests pass (web-terminal-admin.spec.ts)
  • All 5 config tests pass (web-terminal-config.spec.ts)
  • ESLint passes on all modified files

Browser conformance:

  • Chrome

Additional info:
https://redhat.atlassian.net/browse/OCPBUGS-105609

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

  • Improved Web Terminal reliability by allowing more time for pages, menus, tabs, and terminal windows to load.

  • Added automatic retry and reload handling when the terminal icon is not immediately visible.

  • Test Improvements

  • Enhanced end-to-end authentication for administrator and developer access.

  • Updated Web Terminal tests to accommodate longer-running operations and reduce intermittent failures.

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.

@rhamilto

Copy link
Copy Markdown
Member Author

/pipeline required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@frontend/e2e/pages/web-terminal-config-page.ts`:
- Around line 36-38: Update clickWebTerminalTab to pass retries: 2 to
BasePage.robustClick, ensuring the Web Terminal tab click gets one retry after
the initial attempt.
🪄 Autofix

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: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 31e7e82a-4828-4cfb-b273-270252ab6ad8

📥 Commits

Reviewing files that changed from the base of the PR and between b143108 and 6694a93.

📒 Files selected for processing (10)
  • frontend/e2e/pages/base-page.ts
  • frontend/e2e/pages/web-terminal-config-page.ts
  • frontend/e2e/pages/web-terminal-page.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/tests/webterminal/developer/web-terminal-basic.spec.ts
  • frontend/e2e/tests/webterminal/developer/web-terminal-devuser.spec.ts
  • frontend/e2e/tests/webterminal/web-terminal-admin.spec.ts
  • frontend/e2e/tests/webterminal/web-terminal-config.spec.ts

Comment on lines 36 to +38
async clickWebTerminalTab(): Promise<void> {
const tab = this.page.getByRole('tab', { name: 'Web Terminal' });
await this.robustClick(tab, { timeout: 60_000 });
await this.robustClick(tab, { timeout: 60_000, retries: 1 });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Set the attempt count for one retry.

Line 38 passes retries: 1. BasePage.robustClick uses this value as the total attempt count. The call therefore has no retry.

Pass retries: 2 to allow the initial click and one retry.

Proposed fix
-    await this.robustClick(tab, { timeout: 60_000, retries: 1 });
+    await this.robustClick(tab, { timeout: 60_000, retries: 2 });
📝 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
async clickWebTerminalTab(): Promise<void> {
const tab = this.page.getByRole('tab', { name: 'Web Terminal' });
await this.robustClick(tab, { timeout: 60_000 });
await this.robustClick(tab, { timeout: 60_000, retries: 1 });
async clickWebTerminalTab(): Promise<void> {
const tab = this.page.getByRole('tab', { name: 'Web Terminal' });
await this.robustClick(tab, { timeout: 60_000, retries: 2 });
🤖 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 `@frontend/e2e/pages/web-terminal-config-page.ts` around lines 36 - 38, Update
clickWebTerminalTab to pass retries: 2 to BasePage.robustClick, ensuring the Web
Terminal tab click gets one retry after the initial attempt.

@rhamilto

Copy link
Copy Markdown
Member Author

/test backend

Addresses multiple sources of flakiness in the web terminal Playwright
e2e tests:

- warmupSPA now detects the login page and re-authenticates instead of
  retrying until timeout when the auth session has expired
- waitForTerminalIconVisible replaced manual retry loop with toPass()
  to prevent "page closed" errors when the test timeout fires mid-reload
- waitForTerminalWindow default timeout increased from 60s to 120s for
  slow DevWorkspace provisioning
- navigateToWebTerminalConfig uses longer timeouts for the actions menu
  and Web Terminal tab which load dynamically
- All web terminal tests marked test.slow() to triple the default timeout
- Extracted getBaseURL, getAdminCredentials, getDeveloperCredentials into
  login-helper.ts to eliminate duplication across auth setup files and
  warmupSPA

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rhamilto

Copy link
Copy Markdown
Member Author

/test e2e-playwright
/test backend

@logonoff logonoff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 11, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage.

@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff, rhamilto

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

@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@rhamilto: 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/e2e-playwright f77f09d link false /test e2e-playwright

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.

@rhamilto

Copy link
Copy Markdown
Member Author

/hold

I suspect the auth issue to be fixed by #16911 is the real culprit.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 11, 2026
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants