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
This commit is contained in:
28
tests/e2e/basic-flow.spec.js
Normal file
28
tests/e2e/basic-flow.spec.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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');
|
||||
});
|
||||
Reference in New Issue
Block a user