Bug OCPBUGS-105794: Fix P-01-TC04 step definition wiring and add defensive teardown - #17084
Conversation
…nsive teardown The enable-dev-perspective-ci.feature Background step disables the Developer perspective via oc patch, but the "user has logged in as admin user" step definition was only available in configure-perspectives.ts (under customization/) — not in common.ts where Background steps shared across features should live. When P-01-TC04 crashes or fails, the Developer perspective stays disabled, cascading to break ~65 subsequent Cypress tests (add-flow-ci.feature etc.) that depend on it being available. This commit: 1. Adds the "user has logged in as admin user" step definition to dev-console common.ts (removes it from configure-perspectives.ts to avoid duplicate registration) 2. Adds a devPerspectiveDisabled flag set by "user has only admin perspective enabled" and an After hook that re-enables the Developer perspective on cleanup (with failOnNonZeroExit: false and rollout wait for stability) 3. Creates step-definitions/e2e/enable-dev-perspective.ts with all scenario body step definitions for P-01-TC04 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-105794, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: redhat-chai-bot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/pipeline required |
|
Scheduling tests matching the |
|
/retest-required The previous e2e-gcp-console run failed due to Boskos lease proxy 503 errors on build08 (infrastructure issue, not code-related). Retesting. AI-generated. Review for accuracy. |
|
@redhat-chai-bot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
There was a problem hiding this comment.
Make sure no other tests or steps enable/disable the dev perspective, otherwise your variable will be out of sync. Alternatively instead of keeping an internal variable, have a single source of truth--fetch data from the oc cli.
There was a problem hiding this comment.
Good point — the module-level devPerspectiveDisabled flag could get out of sync if other steps also modify perspective visibility.
The simplest fix that addresses your concern: make the After hook unconditionally re-enable the Developer perspective without checking the flag. The oc patch to enable it is idempotent — if the perspective is already enabled, the patch is a no-op ("no change"). This eliminates the state-tracking concern entirely:
After(() => {
cy.exec(
`oc patch console.operator.openshift.io/cluster --type='merge' -p '{"spec":{"customization":{"perspectives":[{"id":"dev","visibility":{"state":"Enabled"}}]}}}'`,
{ failOnNonZeroExit: false },
);
});Would you prefer this unconditional approach, or the oc CLI check for the current state? I can push the update either way.
Also, the E2E job has failed twice due to build08 Boskos lease proxy 503 errors (infrastructure issue — the Cypress tests never actually ran). Would you mind retesting with /test e2e-gcp-console when the infrastructure recovers?
AI-generated. Review for accuracy.
Summary
Fix the
Enable dev perspective P-01-TC04Cucumber test cascade failure that has been breaking ~65 console E2E tests (perspective switcher + Add page tests) on everyconsole-awsrun for 30+ consecutive days. Release 4.22 is the last Cypress-only version.Root Cause
The step definition
"user has logged in as admin user"was defined inconfigure-perspectives.tsbut was not resolvable by thecypress-cucumber-preprocessorforenable-dev-perspective-ci.featuredue to per-package step definition resolution. The Background step that disables the Developer perspective succeeds, then the step definition crash prevents the test body from re-enabling it, and noAfterhook exists to revert the cluster mutation.The cascade chain:
"user has only admin perspective enabled"— patchesconsole.operator.openshift.io/clusterto disable Developer perspective (succeeds)"user has logged in as admin user"— crashes with "Step implementation missing"add-flow-ci.featureruns next —perspective-switcher-togglenot found (40s timeout)Changes
common.ts— Step definition wiring + defensive teardown"user has logged in as admin user"step definition tocommon.tswhere Background steps are resolved (callscy.login()+ switches to Administrator perspective)devPerspectiveDisabledmodule-level flag to track when Developer perspective is disabledAfterhook that unconditionally re-enables Developer perspective viaoc patchwhen the flag is set, usingfailOnNonZeroExit: falseandoc rollout statuswait for stabilityconfigure-perspectives.ts— Removed duplicate"user has logged in as admin user"step definition (now incommon.ts)nav,switchPerspective,perspective)enable-dev-perspective.ts— Missing scenario body steps (new file)user is at admin perspectiveuser is at Search page in Home sectionuser searches {string}user clicks on clusteruser clicks the {string} button in the page headinguser selects {string} in the Developer under perspective sectionuser will see Saved alertuser refreshes the page to see developer optionuser will see developer perspective in the perspective switcherImpact
This fix should resolve ~65 of ~125 console-aws test failures on Cypress-only branches. The
Afterhook ensures that even if the test crashes in the future, subsequent tests won't be affected by cluster state mutation.Related
AI-generated. Review for accuracy.
@spadgett requested in Slack thread