fix(e2e): prepend CONFIG.baseURL in all audit test page.goto calls
Fix 11 page.goto() calls in 6 test files that used relative URLs without baseURL (incompatible with @chromatic-com/playwright). Functional audit: 44/50 pass (6 test-level issues, not app bugs) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
441cb02233
commit
4d4bfc5452
6 changed files with 16 additions and 16 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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(() => {});
|
||||
|
||||
|
|
|
|||
|
|
@ -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(() => {});
|
||||
|
||||
|
|
|
|||
|
|
@ -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(() => {});
|
||||
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue