Run a browser test with the chat API on a different origin than the page
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
In the browser tests the page and the mock chat API are on the same origin (e2e/fixtures/index.html, line 14, uses data-api-url="/api/chat"), so the browser never sends a CORS preflight. Real sites are almost always cross-origin: the page is on acme.com and the chat server is on api.acme.com or a Vercel URL. If the widget ever adds a request header that older servers don't allow, those sites break and our tests stay green. The next release changes the request format, so I want this test in place first.
What to do
- Make
e2e/server.mjslisten on a second port (E2E_API_PORT, default 4174) that serves onlyPOST /api/chatandOPTIONS /api/chat, using the same mock replies as now. - On that port, answer
OPTIONSexactly like a 0.5 server does:204,Access-Control-Allow-Origin: *,Access-Control-Allow-Methods: POST, OPTIONS,Access-Control-Allow-Headers: Content-Type. PutAccess-Control-Allow-Origin: *on thePOSTreplies too. - Add
e2e/fixtures/cross-origin.html, the same asindex.htmlbut withdata-api-urlpointing athttp://localhost:4174/api/chat. - Add
e2e/tests/cross-origin.spec.ts: open the page, send a message, and check that the streamed reply shows up. Also check that the browser sent a preflight first (a JSONPOSTalways needs one), for example by countingOPTIONSrequests in the mock and reading the count from the test. - Start both ports from the existing
webServerentry ine2e/playwright.config.ts.
Where to look
e2e/server.mjs,e2e/playwright.config.ts,e2e/tests/widget.spec.ts- CONTRIBUTING.md, "Browser tests"
Acceptance criteria
-
pnpm e2epasses, including the new spec - If you change the mock so
Access-Control-Allow-Headersis empty, the new test fails (try it, and say so in the PR) - The existing specs still pass and still use the same-origin page
- No changeset needed (
pnpm changeset --empty)
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- Ngôn ngữ chính
- TypeScript
- Star
- 13
- Fork
- 7
- Merge trung bình
- 3 giờ 33 phút
- Pull request đã merge (30 ngày)
- 176
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsCó thể đã có người làm @varun-pahuja đã nhận 2 ngày trước. Đang mởenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type-check the TypeScript samples in the docsCó thể đã có người làm @An16og đã nhận 1 ngày trước. Đang mởdocumentation hacktoberfest help wanted testing
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 70/100
codercops/chatcops#201 · 7 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hacktoberfest 2026: start hereĐang mởhacktoberfest
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add built-in translations to the widgetCó thể đã có người làm @piyusshhjangid đã nhận hôm nay. Đang mởhelp wanted widget
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
codercops/chatcops#55 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/chatcops
Issue tương tự
-
createAI: the ai peer range allows ai@6, which the provider cannot work withCó thể đã có người làm @akhil9tiet đã nhận hôm nay. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
cloudflare/agents#2690 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[fullsend] E2E: theme — global-header ignores app.branding.fullLogo (RHDHBUGS-3670)Có thể đã có người làm @fullsend-ai-coder đã nhận hôm nay. Đang mởe2e-failure ready-to-code
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
redhat-developer/rhdh-plugin-export-overlays#4503 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs triage 📥
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
ethereum/ethereum-org-website#19601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Circular app layout navigation and help icons are shifted upward in the official demoĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
cloudscape-design/components#5184 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
agilepathway/label-checker#805 ·
Maintainer thường phản hồi trong vòng 1 ngày