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.
40 lines
1.9 KiB
JavaScript
40 lines
1.9 KiB
JavaScript
import { test, expect } from '@playwright/test';
|
|
import { signUp, waitForMap } from '../support/app.js';
|
|
|
|
// e2e/seed.js puts this one in activefires. Visiting an active fire archives it
|
|
// and canonicalizes the URL to /fire/archive/<other id>, which is itself worth
|
|
// pinning: it is the link every notification and every tweet points at.
|
|
const SEEDED_FIRE = '/fire/active/e2e0000000000000000000a1';
|
|
|
|
test.describe('detalle de un fuego y comentarios', () => {
|
|
test('a seeded fire opens, keeps its map and canonicalizes its URL', async ({ page }) => {
|
|
await page.goto(SEEDED_FIRE);
|
|
await expect(page.getByText(/Información adicional sobre fuego detectado/)).toBeVisible();
|
|
await expect(page).toHaveURL(/\/fire\/archive\/[0-9a-f]{24}$/);
|
|
await waitForMap(page);
|
|
await expect(page.getByText('Coordenadas: 40.41, -3.7')).toBeVisible();
|
|
});
|
|
|
|
test('a signed-in user can comment on a fire and sees it appear', async ({ page }) => {
|
|
await signUp(page);
|
|
await page.goto(SEEDED_FIRE);
|
|
await expect(page.getByText('Comentarios')).toBeVisible();
|
|
|
|
const comment = `Ardió el pinar de la ladera norte ${Date.now()}`;
|
|
await page.locator('textarea.create-comment').fill(comment);
|
|
await page.getByRole('button', { name: 'Añadir comentario' }).click();
|
|
|
|
await expect(page.getByText(comment)).toBeVisible({ timeout: 30000 });
|
|
|
|
// And it is really stored, not just echoed into the DOM.
|
|
await page.reload();
|
|
await expect(page.getByText(comment)).toBeVisible({ timeout: 30000 });
|
|
});
|
|
|
|
test('an anonymous visitor is asked to sign in instead of getting a comment box', async ({ page }) => {
|
|
await page.goto(SEEDED_FIRE);
|
|
await expect(page.getByRole('heading', { name: 'Comentarios' })).toBeVisible();
|
|
await expect(page.getByText('Necesitas iniciar sesión para añadir comentarios')).toBeVisible();
|
|
await expect(page.locator('textarea.create-comment')).toHaveCount(0);
|
|
});
|
|
});
|