Repository navigation
OCPBUGS-71237: fix session-persistence tests failing due to pre-loaded storageState - #17121
Conversation
…tate The session-persistence tests call performLogin() to log in from scratch, but the Playwright project config injects storageState (admin cookies) into every browser context. This causes page.goto(baseURL) to land on the dashboard instead of the OAuth login page, so the login element assertion always times out. Clear the storageState for this describe block so tests start with an unauthenticated browser context, matching the pattern already used by auth-multiuser-login.spec.ts. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe session persistence test suite now starts each test with empty Playwright cookies and origins. ChangesSession persistence test isolation
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized test-only change ensures session-persistence tests begin unauthenticated so they can exercise their intended login and session-survival flow; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
Full details: Description checkExplanation The description covers the root cause, solution, test setup, test cases, browser coverage, and additional implementation context. It is complete enough for review, although it does not list reviewers or assignees. Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. Full details: Stable And Deterministic Test NamesExplanation PASS: The pull request changes only Playwright setup by adding Full details: Test Structure And QualityExplanation PASS: The custom check targets Ginkgo test code. This pull request changes only one TypeScript Playwright file, Full details: Microshift Test CompatibilityExplanation PASS — The PR changes only Full details: Single Node Openshift (Sno) Test CompatibilityExplanation PASS: The pull request changes only Full details: Topology-Aware Scheduling CompatibilityExplanation PASS — The pull request changes only Full details: Ote Binary Stdout ContractExplanation PASS. The pull request changes only Full details: Ipv6 And Disconnected Network Test CompatibilityExplanation PASS — The pull request adds one line to a TypeScript Playwright test. It does not add a Ginkgo test ( Full details: No-Weak-CryptoExplanation PASS. The pull request adds only Full details: Container-PrivilegesExplanation PASS. The pull request changes only Full details: No-Sensitive-Data-In-LogsExplanation PASS: The only pull-request change adds a Playwright ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/pipeline required |
|
Scheduling tests matching the |
|
/retitle NO-JIRA: fix session-persistence tests failing due to pre-loaded storageState |
|
@jhadvig: This pull request explicitly references no jira issue. 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. |
logonoff
left a comment
There was a problem hiding this comment.
/lgtm
/label px-approved
/label docs-approved
|
/verified by CI |
|
@logonoff: This PR has been marked as verified by 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. |
|
Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, logonoff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
d516ead
into
openshift:main
|
@jhadvig: Jira Issue OCPBUGS-71237 is in an unrecognized state (Verified) and will not be moved to the MODIFIED state. 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. |
Analysis / Root cause:
The
session-persistence.spec.tstests have been failing 100% of the time in CI(
pull-ci-openshift-console-main-e2e-playwright— 86% overall failure rate, with these two tests contributing to every single failing run).The root cause is that the
consolePlaywright project injectsstorageState: adminStorageStateinto every browser context, pre-loading kubeadmin's OAuth cookies. When the session-persistence tests callperformLogin(), the browser is already authenticated —page.goto(baseURL)lands on the dashboard instead of the OAuth login page, so the login element assertion ([data-test-id="login"]/#inputUsername) always times out after 30s with "element(s) not found".Evidence:
auth-multiuser-login.spec.tsusestest.use({ storageState: { cookies: [], origins: [] } })+performLogin()→ 0% failure rate across 139 runssession-persistence.spec.tsinheritsstorageState: adminStorageState+performLogin()→ 100% failure ratestorageStateconfigurationSolution description:
Add
test.use({ storageState: { cookies: [], origins: [] } })to the describe block so each test starts with a clean, unauthenticated browser context. This matches the existing pattern inauth-multiuser-login.spec.ts.The session-persistence tests need to control their own authentication lifecycle from scratch — they log in, delete/restart console pods, then verify the session survives. Pre-loading cookies from
storageStatedefeats this by skipping the login page entirely.Screenshots / screen recording:
N/A — no visual changes.
Test setup:
No additional setup required. The fix is to the test itself.
Test cases:
session survives console pod deletion— should now reach the OAuth login page, authenticate, delete pods, and verify session persistencesession survives console plugin toggle— should now reach the OAuth login page, authenticate, toggle a plugin, and verify session persistenceBrowser conformance:
Additional info:
This is a one-line fix. The
storageStateoverride pattern is already established in the codebase atfrontend/e2e/tests/console/app/auth-multiuser-login.spec.ts:8.Made with Cursor
Summary by CodeRabbit