diff --git a/tests/e2e/audit/functional/01-auth.spec.ts b/tests/e2e/audit/functional/01-auth.spec.ts index 16222f95c..1caa0d043 100644 --- a/tests/e2e/audit/functional/01-auth.spec.ts +++ b/tests/e2e/audit/functional/01-auth.spec.ts @@ -19,7 +19,7 @@ test.describe('FONCTIONNEL — Authentification', () => { }); test('Login avec identifiants invalides — affiche erreur', async ({ page }) => { - await page.goto('/login', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/login', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.locator('main, [role="main"]').first().waitFor({ state: 'visible', timeout: 15_000 }).catch(() => {}); @@ -62,7 +62,7 @@ test.describe('FONCTIONNEL — Authentification', () => { test('Routes protégées redirigent vers /login si non-authentifié', async ({ page }) => { for (const route of ['/dashboard', '/library', '/settings']) { - await page.goto(route, { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + route, { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.waitForTimeout(3_000); expect(page.url(), `${route} devrait rediriger vers /login`).toContain('/login'); diff --git a/tests/e2e/audit/functional/06-data-integrity.spec.ts b/tests/e2e/audit/functional/06-data-integrity.spec.ts index 0d01696ea..28b98c373 100644 --- a/tests/e2e/audit/functional/06-data-integrity.spec.ts +++ b/tests/e2e/audit/functional/06-data-integrity.spec.ts @@ -1,12 +1,12 @@ import { test, expect } from '@chromatic-com/playwright'; -import { loginViaAPI, navigateTo } from '../helpers'; +import { loginViaAPI, navigateTo, CONFIG } from '../helpers'; import { TEST_USERS } from '../design-tokens'; test.describe('FONCTIONNEL — Intégrité des données', () => { test('API /auth/me retourne les données du user connecté', async ({ page }) => { await loginViaAPI(page, TEST_USERS.listener.email, TEST_USERS.listener.password); - const response = await page.request.get('/api/v1/auth/me'); + const response = await page.request.get(CONFIG.baseURL + '/api/v1/auth/me'); expect(response.ok(), `GET /auth/me a retourné ${response.status()}`).toBe(true); const body = await response.json(); @@ -16,19 +16,19 @@ test.describe('FONCTIONNEL — Intégrité des données', () => { }); test('Pages error 404 et 500 se chargent correctement', async ({ page }) => { - await page.goto('/404', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/404', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); const body404 = await page.textContent('body'); expect(body404).toMatch(/404|not found|page introuvable|n'existe pas/i); - await page.goto('/500', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/500', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); const body500 = await page.textContent('body'); expect(body500).toMatch(/500|server error|erreur serveur|problème/i); }); test('Route inexistante redirige vers 404', async ({ page }) => { - await page.goto('/this-page-does-not-exist-at-all', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/this-page-does-not-exist-at-all', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.waitForTimeout(3_000); expect(page.url()).toContain('/404'); diff --git a/tests/e2e/audit/interaction/04-toasts-notifications.spec.ts b/tests/e2e/audit/interaction/04-toasts-notifications.spec.ts index b1988a1a5..6e536ce7a 100644 --- a/tests/e2e/audit/interaction/04-toasts-notifications.spec.ts +++ b/tests/e2e/audit/interaction/04-toasts-notifications.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from '@chromatic-com/playwright'; -import { loginViaAPI, loginViaUI, navigateTo, waitForToast } from '../helpers'; +import { loginViaAPI, loginViaUI, navigateTo, waitForToast, CONFIG } from '../helpers'; import { TEST_USERS } from '../design-tokens'; test.describe('TOASTS & NOTIFICATIONS — Apparaissent, disparaissent, ne cachent rien', () => { @@ -23,7 +23,7 @@ test.describe('TOASTS & NOTIFICATIONS — Apparaissent, disparaissent, ne cachen }); test('Login échoué — un toast d\'erreur ou message d\'erreur apparaît', async ({ page }) => { - await page.goto('/login', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/login', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.locator('main, [role="main"]').first().waitFor({ state: 'visible', timeout: 15_000 }).catch(() => {}); @@ -69,7 +69,7 @@ test.describe('TOASTS & NOTIFICATIONS — Apparaissent, disparaissent, ne cachen test('Toast — disparaît automatiquement après ~4 secondes', async ({ page }) => { // Ce test nécessite qu'un toast soit affiché — on peut le provoquer via login - await page.goto('/login', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/login', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.locator('main, [role="main"]').first().waitFor({ state: 'visible', timeout: 15_000 }).catch(() => {}); diff --git a/tests/e2e/audit/interaction/07-toasts-advanced.spec.ts b/tests/e2e/audit/interaction/07-toasts-advanced.spec.ts index 978541266..ea85e000c 100644 --- a/tests/e2e/audit/interaction/07-toasts-advanced.spec.ts +++ b/tests/e2e/audit/interaction/07-toasts-advanced.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from '@chromatic-com/playwright'; -import { loginViaAPI, navigateTo } from '../helpers'; +import { loginViaAPI, navigateTo, CONFIG } from '../helpers'; import { TEST_USERS } from '../design-tokens'; test.describe('TOASTS AVANCÉS — Positionnement, style et timing', () => { @@ -41,7 +41,7 @@ test.describe('TOASTS AVANCÉS — Positionnement, style et timing', () => { }); test('Toast d\'erreur a le style vermillion (rouge)', async ({ page }) => { - await page.goto('/login', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/login', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.locator('main, [role="main"]').first().waitFor({ state: 'visible', timeout: 15_000 }).catch(() => {}); diff --git a/tests/e2e/audit/pixel-perfect/14-disabled-states.spec.ts b/tests/e2e/audit/pixel-perfect/14-disabled-states.spec.ts index be8ca2789..e01f1f414 100644 --- a/tests/e2e/audit/pixel-perfect/14-disabled-states.spec.ts +++ b/tests/e2e/audit/pixel-perfect/14-disabled-states.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from '@chromatic-com/playwright'; -import { loginViaAPI, navigateTo } from '../helpers'; +import { loginViaAPI, navigateTo, CONFIG } from '../helpers'; import { TEST_USERS, ROUTES } from '../design-tokens'; test.describe('DISABLED — Les éléments désactivés sont visuellement distincts', () => { @@ -58,7 +58,7 @@ test.describe('DISABLED — Les éléments désactivés sont visuellement distin } test('Login — soumettre avec champs vides produit un bouton loading ou disabled', async ({ page }) => { - await page.goto('/login', { waitUntil: 'domcontentloaded' }); + await page.goto(CONFIG.baseURL + '/login', { waitUntil: 'domcontentloaded' }); await page.waitForLoadState('networkidle').catch(() => {}); await page.locator('main, [role="main"]').first().waitFor({ state: 'visible', timeout: 15_000 }).catch(() => {}); diff --git a/tests/e2e/audit/pixel-perfect/16-loading-states.spec.ts b/tests/e2e/audit/pixel-perfect/16-loading-states.spec.ts index 63c178b92..03aaa8a61 100644 --- a/tests/e2e/audit/pixel-perfect/16-loading-states.spec.ts +++ b/tests/e2e/audit/pixel-perfect/16-loading-states.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from '@chromatic-com/playwright'; -import { loginViaAPI } from '../helpers'; +import { loginViaAPI, CONFIG } from '../helpers'; import { TEST_USERS, ROUTES } from '../design-tokens'; test.describe('LOADING — Les états de chargement sont propres', () => { @@ -13,7 +13,7 @@ test.describe('LOADING — Les états de chargement sont propres', () => { await route.continue(); }); - await page.goto(route.path, { waitUntil: 'commit' }); + await page.goto(CONFIG.baseURL + route.path, { waitUntil: 'commit' }); // Pendant le chargement, capturer ce qui est visible const loadingSnapshot = await page.evaluate(() => {