Playwright under e2e/, its own npm project so Meteor never sees the dependency (.meteorignore keeps the directory out of the bundle — a config file at the app root is otherwise eagerly loaded into the server and crashes it). Covers what the phase asked for: sign up / log in, creating a zone from the map and watching the union get painted on /subscriptions and /zones, removing it again, commenting on a fire, and switching language. The zone spec is the flow that froze staging on 2026-07-30 — it passes only if the server is still answering DDP while the union is recomputed. docker-compose.e2e.yml is a throwaway stack (Mongo on tmpfs, no named volume) so the destructive seeds cannot be pointed at anything real by accident; playwright.config.js refuses to start against the staging or production domains. i18n.spec.js leaves a test.fixme on a real bug found while writing it: the language chosen in the profile does not survive a page reload.
60 lines
2.6 KiB
Markdown
60 lines
2.6 KiB
Markdown
# Suite e2e (Playwright)
|
|
|
|
Cubre en navegador los flujos que la suite de servidor no puede ver: registro y
|
|
acceso, alta y baja de una zona **desde el mapa**, que la unión de zonas se pinte
|
|
en `/subscriptions` y en `/zones`, comentario en el detalle de un fuego, y cambio
|
|
de idioma.
|
|
|
|
El motivo de que exista: el 2026-07-30 suscribirse a una zona congeló staging
|
|
(la unión bloqueaba el event loop y DDP dejaba de responder). Ningún test de
|
|
servidor habría visto eso — el navegador sí.
|
|
|
|
## ⚠️ Contra qué se puede correr
|
|
|
|
Solo contra un stack **desechable**: `docker-compose.e2e.yml` o un servidor de
|
|
desarrollo local. La siembra (`e2e/seed.js`) **borra colecciones**, y los tests
|
|
crean usuarios y zonas. `playwright.config.js` se niega a arrancar si
|
|
`E2E_BASE_URL` apunta a `testfuegos.comunes.org` o a los dominios de producción.
|
|
|
|
## Uso
|
|
|
|
Stack efímero completo (lo mismo que hace el CI):
|
|
|
|
```bash
|
|
docker compose -f docker-compose.e2e.yml up -d --build
|
|
npm --prefix e2e ci
|
|
npx --prefix e2e playwright install --with-deps chromium
|
|
E2E_BASE_URL=http://localhost:3300 npm --prefix e2e test
|
|
docker compose -f docker-compose.e2e.yml down -v
|
|
```
|
|
|
|
Contra un servidor de desarrollo (ciclo rápido mientras se escriben tests):
|
|
|
|
```bash
|
|
docker run -d --name tcef-e2e-mongo -p 27021:27017 --tmpfs /data/db mongo:7 --replSet rs0 --bind_ip_all
|
|
docker exec tcef-e2e-mongo mongosh --quiet --eval 'rs.initiate({_id:"rs0",members:[{_id:0,host:"localhost:27017"}]})'
|
|
docker cp e2e/seed.js tcef-e2e-mongo:/tmp/seed.js && docker exec tcef-e2e-mongo mongosh --quiet fuegos /tmp/seed.js
|
|
|
|
export PATH="$HOME/.meteor:$PATH"
|
|
MONGO_URL='mongodb://localhost:27021/fuegos?replicaSet=rs0&directConnection=true' \
|
|
MONGO_OPLOG_URL='mongodb://localhost:27021/local?replicaSet=rs0&directConnection=true' \
|
|
ROOT_URL=http://localhost:3100 meteor --settings settings-ci.json --port 3100
|
|
|
|
npm --prefix e2e test # E2E_BASE_URL por defecto: http://localhost:3100
|
|
```
|
|
|
|
Ver el informe del último fallo: `npm --prefix e2e run report`.
|
|
|
|
## Dependencias externas
|
|
|
|
El navegador carga las teselas de CartoDB y el script de Google Maps (el
|
|
autocompletado de lugares). El runner necesita salida a internet; sin ella los
|
|
mapas no llegan a pintarse y los tests de zona fallan. La clave de Google puede
|
|
ir vacía: `Gkeys` ya no se queda esperándola.
|
|
|
|
## Lo que la suite documenta como roto
|
|
|
|
`i18n.spec.js` deja un `test.fixme` para un bug real: el idioma elegido en el
|
|
perfil **no sobrevive a una recarga** (se guarda en la cuenta y se aplica al
|
|
iniciar sesión, pero al recargar vuelve al idioma del navegador). Está ahí para
|
|
que aparezca en cada ejecución en vez de perderse en una nota.
|