Skip to content

CONSOLE-5196: Fix Playwright e2e flakes across multiple test suites - #16881

Open
rhamilto wants to merge 4 commits into
openshift:mainfrom
rhamilto:CONSOLE-5196-e2e-flake-fixes
Open

CONSOLE-5196: Fix Playwright e2e flakes across multiple test suites#16881
rhamilto wants to merge 4 commits into
openshift:mainfrom
rhamilto:CONSOLE-5196-e2e-flake-fixes

Conversation

@rhamilto

@rhamilto rhamilto commented Jul 29, 2026

Copy link
Copy Markdown
Member

Analysis / Root cause:

Multiple pre-existing flaky Playwright e2e tests are causing CI failures across PRs (e.g. #16658). Follow-on to #16863 which addressed some of these. Root causes:

  1. Alertmanager testsalertmanager.spec.ts and receivers/receivers.spec.ts both mutate the shared alertmanager-main secret via resetAlertmanagerConfig() in beforeEach/afterEach. With WORKERS=2, these files land on different workers and clobber each other's config.
  2. warmupSPA — Single-attempt page.goto('/') + heading visibility check with no retry. On slow CI clusters, this regularly exceeds the combined 90s timeout.
  3. a11y teststestA11y runs axe-core immediately after assertLoaded, but some assertLoaded callbacks only check toBeAttached() (in DOM, not necessarily rendered). Axe finds false-positive violations in partially rendered DOM.
  4. Topology tests — Tests that create workloads via git URL (validation + deployment) use the global 120s timeout, which is insufficient.
  5. Topology application namefillApplicationName assumes the text input is always visible, but it's conditionally rendered only when no applications exist or "Create application" is selected. When prior tests leave application groups in the namespace, the dropdown shows instead.
  6. Perspective-switcher — The "Developer query parameter" test patches the Console operator to enable Developer perspective but never restores it on failure.

Solution description:

  1. Merge receivers/receivers.spec.ts into alertmanager.spec.ts so all alertmanager tests share a single worker via the file-level test.describe.configure({ mode: 'serial' }).
  2. Wrap warmupSPA in expect().toPass() with escalating retry intervals (1s, 2s, 5s) and 90s overall timeout.
  3. Add loading indicator wait inside testA11y before running axe-core. Upgrade toBeAttached() to toBeVisible() in assertLoaded callbacks for routes /, /k8s/cluster/clusterroles/view, /api-resource/.../schema, and /settings/cluster.
  4. Add test.setTimeout(300_000) to the 4 topology tests that create and delete workloads.
  5. Update fillApplicationName to detect when the application dropdown is visible and select "Create application" before filling the text input.
  6. Add afterAll cleanup to remove the Console operator perspectives patch when it was applied.

Screenshots / screen recording:
N/A — test infrastructure only, no UI changes.

Test setup:
None required.

Test cases:
All affected test suites pass locally against a live cluster:

  • alertmanager.spec.ts — 14/14 passed (merged file)
  • search.spec.ts — 7/7 passed (warmupSPA retry)
  • other-routes.spec.ts — 28/28 passed (a11y + perspective cleanup)
  • topology-ci.spec.ts — 9/9 passed (timeout + application name fix)

Browser conformance:

  • Chrome

Additional info:
Continues the flake-fixing work from #16863. Should unblock PRs like #16658 that are stuck on pre-existing CI flakes.

Reviewers and assignees:

Summary by CodeRabbit

  • Tests

    • Consolidated Alertmanager receiver E2E coverage into a unified suite for Webhook, Email, Slack, and PagerDuty, including advanced options and YAML/global-default validation.
    • Removed the standalone receivers test suite that previously held this coverage.
  • Bug Fixes / Reliability

    • Improved console test stability by retrying initial navigation/visibility checks and switching key assertions to visibility-based waits.
    • Added explicit network-response waits for update-related toast checks.
    • Increased timeouts for selected topology CI scenarios.
  • Accessibility

    • Refined loading-indicator detection and updated the a11y reporting output formatting.

Address several sources of flaky Playwright e2e test failures:

1. Alertmanager parallel worker interference: Merge receivers.spec.ts
   into alertmanager.spec.ts so all tests that mutate the shared
   alertmanager-main secret run on a single worker.

2. warmupSPA resilience: Wrap the goto + heading check in toPass()
   with retry intervals so a single slow cluster response doesn't
   cause immediate failure.

3. a11y test stabilization: Wait for loading indicators to clear
   before running axe-core analysis. Upgrade toBeAttached() checks
   to toBeVisible() in assertLoaded callbacks so pages are fully
   rendered before a11y checks run.

4. Topology test timeouts: Add test.setTimeout(300_000) to tests
   that create workloads via git URL, since validation + deployment
   regularly exceeds the 120s default.

5. Topology application name field: Handle the conditional rendering
   of the application name input by selecting "Create application"
   from the dropdown when existing applications are present.

6. Perspective-switcher cleanup: Add afterAll to remove the Console
   operator perspectives patch, preventing cluster-wide side effects
   from leaking into other tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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 the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 29, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@rhamilto: This pull request references CONSOLE-5196 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Analysis / Root cause:

Multiple pre-existing flaky Playwright e2e tests are causing CI failures across PRs (e.g. #16658). Follow-on to #16863 which addressed some of these. Root causes:

  1. Alertmanager testsalertmanager.spec.ts and receivers/receivers.spec.ts both mutate the shared alertmanager-main secret via resetAlertmanagerConfig() in beforeEach/afterEach. With WORKERS=2, these files land on different workers and clobber each other's config.
  2. warmupSPA — Single-attempt page.goto('/') + heading visibility check with no retry. On slow CI clusters, this regularly exceeds the combined 90s timeout.
  3. a11y teststestA11y runs axe-core immediately after assertLoaded, but some assertLoaded callbacks only check toBeAttached() (in DOM, not necessarily rendered). Axe finds false-positive violations in partially rendered DOM.
  4. Topology tests — Tests that create workloads via git URL (validation + deployment) use the global 120s timeout, which is insufficient.
  5. Topology application namefillApplicationName assumes the text input is always visible, but it's conditionally rendered only when no applications exist or "Create application" is selected. When prior tests leave application groups in the namespace, the dropdown shows instead.
  6. Perspective-switcher — The "Developer query parameter" test patches the Console operator to enable Developer perspective but never restores it on failure.

Solution description:

  1. Merge receivers/receivers.spec.ts into alertmanager.spec.ts so all alertmanager tests share a single worker via the file-level test.describe.configure({ mode: 'serial' }).
  2. Wrap warmupSPA in expect().toPass() with escalating retry intervals (1s, 2s, 5s) and 90s overall timeout.
  3. Add loading indicator wait inside testA11y before running axe-core. Upgrade toBeAttached() to toBeVisible() in assertLoaded callbacks for routes /, /k8s/cluster/clusterroles/view, /api-resource/.../schema, and /settings/cluster.
  4. Add test.setTimeout(300_000) to the 4 topology tests that create and delete workloads.
  5. Update fillApplicationName to detect when the application dropdown is visible and select "Create application" before filling the text input.
  6. Add afterAll cleanup to remove the Console operator perspectives patch when it was applied.

Screenshots / screen recording:
N/A — test infrastructure only, no UI changes.

Test setup:
None required.

Test cases:
All affected test suites pass locally against a live cluster:

  • alertmanager.spec.ts — 14/14 passed (merged file)
  • search.spec.ts — 7/7 passed (warmupSPA retry)
  • other-routes.spec.ts — 28/28 passed (a11y + perspective cleanup)
  • topology-ci.spec.ts — 9/9 passed (timeout + application name fix)

Browser conformance:

  • Chrome

Additional info:
Continues the flake-fixing work from #16863. Should unblock PRs like #16658 that are stuck on pre-existing CI flakes.

Reviewers and assignees:

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 requested a review from cajieh July 29, 2026 18:07
@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 requested a review from TheRealJon July 29, 2026 18:07
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0e8ce424-1970-4db7-a5da-4e97b2c9c9e8

📥 Commits

Reviewing files that changed from the base of the PR and between dee182d and cde5724.

📒 Files selected for processing (1)
  • frontend/e2e/utils/a11y.ts

Walkthrough

Changes

The E2E suite adds Alertmanager receiver coverage and updates navigation, visibility, network synchronization, cleanup, timeout, and accessibility handling.

E2E validation

Layer / File(s) Summary
Alertmanager receiver form validation
frontend/e2e/tests/console/cluster-settings/alertmanager/alertmanager.spec.ts
Adds Webhook, Email, Slack, and PagerDuty creation and editing flows with YAML assertions for receiver and global configuration.
UI readiness and page helper handling
frontend/e2e/pages/base-page.ts, frontend/e2e/pages/topology-page.ts, frontend/e2e/tests/console/crud/other-routes.spec.ts, frontend/e2e/utils/a11y.ts
SPA warmup retries navigation, topology application selection handles an optional dropdown, route checks require visible elements, and accessibility loading selectors are adjusted.
Network, cleanup, and timeout synchronization
frontend/e2e/tests/console/app/poll-console-updates.spec.ts, frontend/e2e/tests/console/crud/other-routes.spec.ts, frontend/e2e/tests/topology/topology-ci.spec.ts
Console update tests wait for /api/check-updates, perspective patches are cleaned up, and four topology tests use 300-second timeouts.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReceiverForm
  participant AlertmanagerAPI
  participant YAMLConfig
  ReceiverForm->>AlertmanagerAPI: save receiver configuration
  AlertmanagerAPI->>YAMLConfig: persist globals and receivers
  ReceiverForm->>YAMLConfig: read saved configuration
  YAMLConfig-->>ReceiverForm: return global and receiver values
Loading

Suggested labels: component/core

Suggested reviewers: cajieh, therealjon

🚥 Pre-merge checks | ✅ 4 | ❌ 11

❌ Failed checks (1 warning, 10 inconclusive)

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.
Stable And Deterministic Test Names ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Test Structure And Quality ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Microshift Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Single Node Openshift (Sno) Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Topology-Aware Scheduling Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ote Binary Stdout Contract ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ipv6 And Disconnected Network Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Weak-Crypto ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Container-Privileges ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Sensitive-Data-In-Logs ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing Playwright E2E flakiness across multiple suites.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@rhamilto

Copy link
Copy Markdown
Member Author

/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

🧹 Nitpick comments (2)
frontend/e2e/tests/console/crud/other-routes.spec.ts (1)

155-169: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider logging cleanup patch failures instead of silently swallowing.

If the remove patch for /spec/customization/perspectives fails, the error is discarded via .catch(() => {}), leaving the customization on the cluster with no trace in CI logs — this can silently pollute state for later test runs.

♻️ Log cleanup failures for visibility
       await k8sClient.customObjectsApi
         .patchClusterCustomObject({
           group: 'operator.openshift.io',
           version: 'v1',
           plural: 'consoles',
           name: 'cluster',
           body: [{ op: 'remove', path: '/spec/customization/perspectives' }],
         })
-        .catch(() => {});
+        .catch((error) => {
+          console.error('[Cleanup] Failed to remove perspectives customization:', error);
+        });
🤖 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/tests/console/crud/other-routes.spec.ts` around lines 155 - 169,
Update the cleanup logic in the test.afterAll handler for patchedPerspectives so
failures from patchClusterCustomObject are logged instead of being silently
discarded by catch. Preserve the existing cleanup attempt and patch payload, and
include the caught error in the CI-visible log output.
frontend/e2e/utils/a11y.ts (1)

9-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate loading-indicator selector list across two files. The same CSS selector list is maintained independently in a11y.ts and base-page.ts, risking drift as new loading/skeleton patterns are added.

  • frontend/e2e/utils/a11y.ts#L9-L19: extract LOADING_SELECTORS to a shared module (e.g., re-export from or import BasePage's selector list) instead of redeclaring it.
  • frontend/e2e/pages/base-page.ts#L35-L45: source the shared selector list from the same module so both files stay in sync.
🤖 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/utils/a11y.ts` around lines 9 - 19, Eliminate the duplicated
loading selector list by defining one shared LOADING_SELECTORS source and
importing or re-exporting it wherever needed. Update frontend/e2e/utils/a11y.ts
lines 9-19 to consume the shared list, and update
frontend/e2e/pages/base-page.ts lines 35-45 to consume that same source instead
of redeclaring it; preserve the existing selector values and behavior.
🤖 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/topology-page.ts`:
- Around line 197-201: Update the applicationDropdown handling in the topology
page flow to wait for visibility with a real 2-second wait, replacing the
timeout-bearing isVisible check. Preserve the fallback behavior when the
dropdown does not appear, then click the dropdown and the “Create application”
option only after the visibility wait succeeds.

---

Nitpick comments:
In `@frontend/e2e/tests/console/crud/other-routes.spec.ts`:
- Around line 155-169: Update the cleanup logic in the test.afterAll handler for
patchedPerspectives so failures from patchClusterCustomObject are logged instead
of being silently discarded by catch. Preserve the existing cleanup attempt and
patch payload, and include the caught error in the CI-visible log output.

In `@frontend/e2e/utils/a11y.ts`:
- Around line 9-19: Eliminate the duplicated loading selector list by defining
one shared LOADING_SELECTORS source and importing or re-exporting it wherever
needed. Update frontend/e2e/utils/a11y.ts lines 9-19 to consume the shared list,
and update frontend/e2e/pages/base-page.ts lines 35-45 to consume that same
source instead of redeclaring it; preserve the existing selector values and
behavior.
🪄 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: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a4a114a1-842b-4cb0-98ff-858775c7d03d

📥 Commits

Reviewing files that changed from the base of the PR and between e6cdc2c and c5f7c9e.

📒 Files selected for processing (7)
  • frontend/e2e/pages/base-page.ts
  • frontend/e2e/pages/topology-page.ts
  • frontend/e2e/tests/console/cluster-settings/alertmanager/alertmanager.spec.ts
  • frontend/e2e/tests/console/cluster-settings/alertmanager/receivers/receivers.spec.ts
  • frontend/e2e/tests/console/crud/other-routes.spec.ts
  • frontend/e2e/tests/topology/topology-ci.spec.ts
  • frontend/e2e/utils/a11y.ts
💤 Files with no reviewable changes (1)
  • frontend/e2e/tests/console/cluster-settings/alertmanager/receivers/receivers.spec.ts

Comment thread frontend/e2e/pages/topology-page.ts Outdated
rhamilto and others added 2 commits July 29, 2026 14:17
After swapping the route handler, explicitly wait for the next
check-updates response before asserting the toast. This eliminates
the race where the 15s polling interval drifts under CI load and
the toast assertion times out before the component receives the
new data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
locator.isVisible() returns immediately and ignores the timeout
parameter. Use waitFor({ state: 'visible' }) to actually wait up
to 2s for the application dropdown to render.

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

Copy link
Copy Markdown
Member Author

/test e2e-playwright

@rhamilto

Copy link
Copy Markdown
Member Author

/test e2e-playwright

@rhamilto

Copy link
Copy Markdown
Member Author

/test e2e-playwright
/test e2e-gcp-console-techpreview

Comment thread frontend/e2e/utils/a11y.ts Outdated
Comment thread frontend/e2e/utils/a11y.ts Outdated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rhamilto

Copy link
Copy Markdown
Member Author

Fixed. Thanks, @logonoff.

@rhamilto

Copy link
Copy Markdown
Member Author

/test e2e-playwright

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants