diff --git a/web/e2e/ouverture.spec.ts b/web/e2e/ouverture.spec.ts index 7831ec5..bea8b5c 100644 --- a/web/e2e/ouverture.spec.ts +++ b/web/e2e/ouverture.spec.ts @@ -313,19 +313,30 @@ test('C44 — les réglages de la formule se lisent en entier : chaque colonne d const p = screen.page; if (screen.size) await p.setViewportSize(screen.size); if (p !== page) await signIn(p, 'Chiara'); - // From the head of the document (the usual turnout), then from a version (« cet article » in its row). - for (const from of ['tete', 'version']) { - await p.goto(from === 'tete' ? `${DOC}?onglet=reglages` : `${DOC}?onglet=reglages&version=${version}`); - const panel = p.locator('aside.panel'); - await expect(panel.getByRole('heading', { name: 'Réglages de la formule' })).toBeVisible(); - await expect(panel.locator('table tbody tr')).toHaveCount(5); - if (from === 'version') await expect(panel.locator('tr.current th')).toContainText('cet article'); - await expect(panel.locator('thead th').last()).toHaveText('Voix pour'); - await panel.locator('table').scrollIntoViewIfNeeded(); - // Soft: every screen is looked at, and the report names each one where the table is cut. - expect.soft(await hiddenInSettings(p), `${screen.name}, ${from === 'tete' ? 'en tête du document' : 'depuis une version'}`).toEqual([]); - await shot(p, `c44-${screen.tag}-${from}`); + // From the head of the document (the usual turnout), then from a version (« cet article » in its + // row); in each language, whose headers are longer in Spanish (« Proporción exigida », « Votos a favor »). + for (const [lang, last, current] of [ + ['fr', 'Voix pour', 'cet article'], + ['en', 'Votes for', 'this article'], + ['es', 'Votos a favor', 'este artículo'], + ]) { + for (const from of ['tete', 'version']) { + await p.goto(from === 'tete' ? `${DOC}?onglet=reglages` : `${DOC}?onglet=reglages&version=${version}`); + if ((await p.evaluate(() => localStorage.getItem('ld:lang'))) !== lang) { + await p.evaluate((l) => localStorage.setItem('ld:lang', l), lang); + await p.reload(); + } + const panel = p.locator('aside.panel'); + await expect(panel.locator('table tbody tr')).toHaveCount(5); + if (from === 'version') await expect(panel.locator('tr.current th')).toContainText(current); + await expect(panel.locator('thead th').last()).toHaveText(last); + await panel.locator('table').scrollIntoViewIfNeeded(); + // Soft: every screen is looked at, and the report names each one where the table is cut. + expect.soft(await hiddenInSettings(p), `${screen.name}, ${lang}, ${from === 'tete' ? 'en tête du document' : 'depuis une version'}`).toEqual([]); + if (lang === 'fr') await shot(p, `c44-${screen.tag}-${from}`); + } } + await p.evaluate(() => localStorage.setItem('ld:lang', 'fr')); } await phone.close(); });