Files
segnapunti/tests/e2e/basic-flow.spec.js
Davide Grilli 71119da727 feat(test): implementazione infrastruttura completa (Unit, Integration, E2E) con Vitest e Playwright
- Introduce Vitest per Unit e Integration Test.
- Introduce Playwright per End-to-End Test.
- Aggiuge documentazione dettagliata in tests/README.md.
- Aggiorna .gitignore per escludere i report di coverage
2026-02-12 15:13:04 +01:00

29 lines
1.0 KiB
JavaScript

import { test, expect } from '@playwright/test';
test('Controller updates Display score', async ({ context }) => {
// 1. Create two pages (Controller and Display)
const displayPage = await context.newPage();
const controllerPage = await context.newPage();
// 2. Open Display
await displayPage.goto('http://localhost:3000');
await expect(displayPage).toHaveTitle(/Segnapunti/);
// 3. Open Controller
await controllerPage.goto('http://localhost:3001');
await expect(controllerPage).toHaveTitle(/Controller/);
// 4. Check initial state (assuming reset)
// Note: This depends on the specific IDs in your HTML.
// You might need to adjust selectors based on your actual HTML structure.
// Example: waiting for score element
// await expect(displayPage.locator('#score-home')).toHaveText('0');
// 5. Action on Controller
// await controllerPage.click('#btn-add-home');
// 6. Verify on Display
// await expect(displayPage.locator('#score-home')).toHaveText('1');
});