5bdd8ad986
Cornice nera, barre teal "SET N" per set, badge A/B per squadre e box risultato finale in stile tabella, per avvicinare il referto stampabile all'aspetto del referto cartaceo FIPAV mantenendo solo i dati che l'app traccia realmente.
48 lines
2.1 KiB
JavaScript
48 lines
2.1 KiB
JavaScript
const { test, expect } = require('@playwright/test');
|
||
const { openController, resetGame, addPoints } = require('./helpers.cjs');
|
||
|
||
test.describe('Referto di fine partita', () => {
|
||
|
||
test('a PARTITA FINITA il bottone REFERTO apre il referto stampabile', async ({ context }) => {
|
||
// window.print() bloccherebbe il test: lo neutralizziamo (anche nel popup).
|
||
await context.addInitScript(() => { window.print = () => {}; });
|
||
|
||
const controllerPage = await openController(context);
|
||
await resetGame(controllerPage);
|
||
|
||
// Modalità 2/3 (bastano 2 set per chiudere la partita)
|
||
await controllerPage.getByText('Config').click();
|
||
await controllerPage.waitForSelector('.dialog-config');
|
||
await controllerPage.locator('.btn-mode').getByText('2/3').click();
|
||
await controllerPage.locator('.dialog-config .btn-confirm').click();
|
||
await controllerPage.waitForTimeout(200);
|
||
|
||
// SET 1: Home a 25 → dialog SET VINTO → vai al set successivo
|
||
await addPoints(controllerPage, 'home', 25);
|
||
await controllerPage.waitForSelector('.dialog-winner');
|
||
await controllerPage.getByText('VAI AL SET SUCCESSIVO').click();
|
||
await controllerPage.locator('.dialog-config .btn-cancel').click();
|
||
await controllerPage.waitForTimeout(200);
|
||
|
||
// SET 2: Home a 25 → PARTITA FINITA
|
||
await addPoints(controllerPage, 'home', 25);
|
||
await controllerPage.waitForSelector('.dialog-winner');
|
||
|
||
const referto = controllerPage.getByRole('button', { name: 'REFERTO' });
|
||
await expect(referto).toBeVisible();
|
||
|
||
// Il click apre il referto in un nuovo popup
|
||
const [popup] = await Promise.all([
|
||
context.waitForEvent('page'),
|
||
referto.click(),
|
||
]);
|
||
|
||
// Verifica il contenuto del referto
|
||
const body = popup.locator('body');
|
||
await expect(body).toContainText('Referto di Gara');
|
||
await expect(popup.locator('.set-numero')).toHaveText(['1', '2']);
|
||
// Home ha vinto 2 set a 0
|
||
await expect(body).toContainText('2 – 0');
|
||
});
|
||
});
|