test: aggiungi suite completa unit, integration ed e2e
- Unit (12+9): conversion.js (rawToCooked/cookedToRaw, edge case, inversa) e storage.js (save/load, round-trip, default fallback) - Integration (17+12+14): Converter (ricerca, selezione, calcolo, swap, reset), MealPlanner (rendering, add/remove, generateShopping, deduplicazione), ShoppingList (add, toggle, remove, clearAll, contatore) - E2E Playwright (6+6+7+10): navigation, meal-planner, converter, shopping-list - Configurazione: vitest.config.js + playwright.config.js + tests/setup.js - Script: test, test:coverage, test:e2e, test:e2e:ui Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
42
tests/e2e/navigation.spec.js
Normal file
42
tests/e2e/navigation.spec.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test.describe('Navigazione tra tab', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/')
|
||||
})
|
||||
|
||||
test('la tab Pasti è attiva al caricamento', async ({ page }) => {
|
||||
await expect(page.locator('.nav-btn.active')).toContainText('Pasti')
|
||||
await expect(page.locator('.page-title')).toContainText('Piano Pasti')
|
||||
})
|
||||
|
||||
test('la tab Converti mostra il convertitore', async ({ page }) => {
|
||||
await page.locator('.nav-btn', { hasText: 'Converti' }).click()
|
||||
await expect(page.locator('.page-title')).toContainText('Convertitore')
|
||||
await expect(page.locator('.nav-btn.active')).toContainText('Converti')
|
||||
})
|
||||
|
||||
test('la tab Spesa mostra la lista della spesa', async ({ page }) => {
|
||||
await page.locator('.nav-btn', { hasText: 'Spesa' }).click()
|
||||
await expect(page.locator('.page-title')).toContainText('Lista della spesa')
|
||||
await expect(page.locator('.nav-btn.active')).toContainText('Spesa')
|
||||
})
|
||||
|
||||
test('si può tornare a Pasti da un\'altra tab', async ({ page }) => {
|
||||
await page.locator('.nav-btn', { hasText: 'Converti' }).click()
|
||||
await page.locator('.nav-btn', { hasText: 'Pasti' }).click()
|
||||
await expect(page.locator('.page-title')).toContainText('Piano Pasti')
|
||||
})
|
||||
|
||||
test('il pulsante info apre il pannello informazioni', async ({ page }) => {
|
||||
await page.locator('.btn-info').click()
|
||||
await expect(page.locator('.sheet')).toBeVisible()
|
||||
await expect(page.locator('.app-name')).toContainText('BitePlan')
|
||||
})
|
||||
|
||||
test('il pannello info si chiude con la X', async ({ page }) => {
|
||||
await page.locator('.btn-info').click()
|
||||
await page.locator('.btn-x').click()
|
||||
await expect(page.locator('.sheet')).not.toBeVisible()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user