ACM-34734 Add token session injection to playwright template#6377
ACM-34734 Add token session injection to playwright template#6377fxiang1 wants to merge 3 commits into
Conversation
Signed-off-by: fxiang1 <fxiang@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fxiang1 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 |
Signed-off-by: fxiang1 <fxiang@redhat.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a standalone Playwright sanity-check suite ( ChangesPlaywright Sanity Check Suite
OCP Auth Strategy Refactor
Sequence DiagramsequenceDiagram
participant Test as E2E Test
participant loginToOCP
participant OCPAPI as OCP OAuth API
participant Browser
participant FSCache as .auth-state.json
Test->>loginToOCP: call loginToOCP(page)
loginToOCP->>OCPAPI: GET /oauth/authorize (with credentials)
OCPAPI-->>loginToOCP: redirect with access_token in hash
loginToOCP->>Browser: inject openshift-session-token cookie
Browser-->>loginToOCP: sidebar visible → success
alt token injection fails
loginToOCP->>FSCache: read .auth-state.json (age check)
FSCache-->>loginToOCP: restore cookies/localStorage if fresh
alt cache stale or missing
loginToOCP->>Browser: navigate to console URL
Browser-->>loginToOCP: Promise.race(sidebar | IDP entry)
loginToOCP->>Browser: select provider, fill credentials, approve
Browser-->>loginToOCP: sidebar visible
loginToOCP->>FSCache: write storage state
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
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 `@e2e-template/playwright-template.ts`:
- Around line 51-65: The httpGet function has two reliability issues that need
fixing. First, add a socket timeout to the HTTP request options (via the opts
object or directly on the request) to prevent stalled connections from hanging
indefinitely until the Playwright hook timeout fires. Second, when handling 301
or 302 redirect responses, call res.resume() to drain the response stream before
resolving, which ensures the socket is properly released back to the agent pool
instead of leaking it. Both fixes should be applied to the httpGet function to
improve its robustness.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 6e6d691b-8161-401d-bf9e-91f7cadcb1a6
📒 Files selected for processing (6)
.gitignoreREADME.mde2e-template/playwright-sanity.config.tse2e-template/playwright-sanity.spec.tse2e-template/playwright-template.tspackage.json
Signed-off-by: fxiang1 <fxiang@redhat.com>
|



📝 Summary
Ticket Summary (Title):
story-implementation-workflow
Ticket Link:
https://redhat.atlassian.net/browse/ACM-34734
Type of Change:
✅ Checklist
General
ACM-12340 Fix bug with...)If Feature
If Bugfix
🗒️ Notes for Reviewers
Summary by CodeRabbit
Documentation
Tests
Chores
.gitignorefor Playwright e2e-template artifacts.playwright:sanitynpm script to run the sanity checks.