Run a browser test with the chat API on a different origin than the page
Los mantenedores suelen responder en 1 día
@piyusshhjangid ya está trabajando en esto.
Desde el 20/10/2026.
- #294 de @piyusshhjangid — fusionado
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 7
- Merge medio
- 3 h 33 min
- PR fusionados (30 d)
- 176
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsPosiblemente ocupada @varun-pahuja la tomó hace 2 días. Abiertoenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Type-check the TypeScript samples in the docsPosiblemente ocupada @An16og la tomó hace 2 días. Abiertodocumentation hacktoberfest help wanted testing
Dificultad 4/5 3-5 días Aptitud para principiantes 70/100
codercops/chatcops#201 · 7 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Hacktoberfest 2026: start hereAbiertohacktoberfest
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Add built-in translations to the widgetPosiblemente ocupada @piyusshhjangid la tomó hace 1 día. Abiertohelp wanted widget
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
codercops/chatcops#55 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/chatcops
Issues similares
-
area:agent-view area:tui bug platform:macos
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
anthropics/claude-code#104558 ·
Los mantenedores suelen responder en 1 día
-
[CURRICULUM] computation fakdAbiertoupdater
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
UniversityOfHelsinkiCS/oodikone#5141 ·
-
maintanance
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
inmanta/web-console#7606 ·
Los mantenedores suelen responder en 1 día
-
bug skills
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
equinor/fusion-framework#5846 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100