fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle
- Fix 98 TypeScript errors across 37 files:
- Service layer double-unwrapping (subscriptionService, distributionService, gearService)
- Self-referencing variables in SearchPageResults
- FeedView/ExploreView .posts→.items alignment
- useQueueSync Zustand subscribe API
- AdminAuditLogsView missing interface fields
- Toast proxy type, interceptor type narrowing
- 22 unused imports/variables removed
- 5 storybook mock data fixes
- Align frontend API calls with backend endpoints:
- Analytics: useAnalyticsView now calls /creator/analytics/dashboard (was /analytics)
- Chat: chatService uses /conversations (was mock data), WS URL from backend token
- Dashboard StatsSection: uses real /dashboard API data (was hardcoded zeros)
- Settings: suppress 2FA toast error when endpoint unavailable
- Fix marketplace products: seed uses 'active' status (was 'published')
- Enrich seed: admin follows all creators (feed has content)
- Optimize bundle: vendor catch-all 793KB→318KB gzip (-60%)
Split into vendor-charts, vendor-emoji, vendor-swagger, vendor-media, etc.
- Clean repo: remove ~100 orphaned screenshots, audit reports, logs from root
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:18:49 +00:00
|
|
|
import { test, expect } from '@chromatic-com/playwright';
|
2026-03-25 13:26:09 +00:00
|
|
|
import { loginViaAPI, navigateTo, CONFIG } from '../helpers';
|
test: update e2e test suite and add audit tests
Refine auth, player, tracks, playlists, search, workflows, edge cases,
forms, responsive, network errors, error boundary, performance, visual
regression, cross-browser, profile, smoke, storybook, chat, and session
tests. Add audit test suite (accessibility, ethical, functional, design
tokens). Update test helpers and visual snapshots.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 15:06:26 +00:00
|
|
|
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);
|
|
|
|
|
|
2026-03-25 13:26:09 +00:00
|
|
|
const response = await page.request.get(CONFIG.baseURL + '/api/v1/auth/me');
|
test: update e2e test suite and add audit tests
Refine auth, player, tracks, playlists, search, workflows, edge cases,
forms, responsive, network errors, error boundary, performance, visual
regression, cross-browser, profile, smoke, storybook, chat, and session
tests. Add audit test suite (accessibility, ethical, functional, design
tokens). Update test helpers and visual snapshots.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 15:06:26 +00:00
|
|
|
expect(response.ok(), `GET /auth/me a retourné ${response.status()}`).toBe(true);
|
|
|
|
|
|
|
|
|
|
const body = await response.json();
|
|
|
|
|
const user = body?.data || body;
|
|
|
|
|
expect(user).toHaveProperty('email');
|
|
|
|
|
expect(user.email).toBe(TEST_USERS.listener.email);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Pages error 404 et 500 se chargent correctement', async ({ page }) => {
|
2026-03-25 13:26:09 +00:00
|
|
|
await page.goto(CONFIG.baseURL + '/404', { waitUntil: 'domcontentloaded' });
|
test: update e2e test suite and add audit tests
Refine auth, player, tracks, playlists, search, workflows, edge cases,
forms, responsive, network errors, error boundary, performance, visual
regression, cross-browser, profile, smoke, storybook, chat, and session
tests. Add audit test suite (accessibility, ethical, functional, design
tokens). Update test helpers and visual snapshots.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 15:06:26 +00:00
|
|
|
await page.waitForLoadState('networkidle').catch(() => {});
|
|
|
|
|
const body404 = await page.textContent('body');
|
|
|
|
|
expect(body404).toMatch(/404|not found|page introuvable|n'existe pas/i);
|
|
|
|
|
|
2026-03-25 13:26:09 +00:00
|
|
|
await page.goto(CONFIG.baseURL + '/500', { waitUntil: 'domcontentloaded' });
|
test: update e2e test suite and add audit tests
Refine auth, player, tracks, playlists, search, workflows, edge cases,
forms, responsive, network errors, error boundary, performance, visual
regression, cross-browser, profile, smoke, storybook, chat, and session
tests. Add audit test suite (accessibility, ethical, functional, design
tokens). Update test helpers and visual snapshots.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 15:06:26 +00:00
|
|
|
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 }) => {
|
2026-03-25 13:26:09 +00:00
|
|
|
await page.goto(CONFIG.baseURL + '/this-page-does-not-exist-at-all', { waitUntil: 'domcontentloaded' });
|
test: update e2e test suite and add audit tests
Refine auth, player, tracks, playlists, search, workflows, edge cases,
forms, responsive, network errors, error boundary, performance, visual
regression, cross-browser, profile, smoke, storybook, chat, and session
tests. Add audit test suite (accessibility, ethical, functional, design
tokens). Update test helpers and visual snapshots.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 15:06:26 +00:00
|
|
|
await page.waitForLoadState('networkidle').catch(() => {});
|
|
|
|
|
await page.waitForTimeout(3_000);
|
|
|
|
|
expect(page.url()).toContain('/404');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Le sidebar affiche les liens de navigation', async ({ page }) => {
|
|
|
|
|
await loginViaAPI(page, TEST_USERS.listener.email, TEST_USERS.listener.password);
|
|
|
|
|
await navigateTo(page, '/dashboard');
|
|
|
|
|
|
|
|
|
|
const sidebar = page.locator('[data-testid="app-sidebar"]');
|
|
|
|
|
// Le sidebar peut être caché sur mobile, vérifier sur desktop viewport
|
|
|
|
|
if (await sidebar.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
|
|
|
|
const links = await sidebar.locator('a[href], [role="link"]').count();
|
|
|
|
|
expect(links, 'Le sidebar devrait avoir au moins 3 liens de navigation').toBeGreaterThanOrEqual(3);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('La recherche retourne des résultats cohérents', async ({ page }) => {
|
|
|
|
|
await loginViaAPI(page, TEST_USERS.listener.email, TEST_USERS.listener.password);
|
|
|
|
|
await navigateTo(page, '/search');
|
|
|
|
|
|
|
|
|
|
const searchInput = page.locator('[data-testid="search-input"], input[type="search"], input[role="searchbox"]').first();
|
|
|
|
|
if (await searchInput.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
|
|
|
|
await searchInput.fill('test');
|
|
|
|
|
await page.waitForTimeout(2_000);
|
|
|
|
|
// La page ne devrait pas crasher après une recherche
|
|
|
|
|
const body = await page.textContent('body');
|
|
|
|
|
expect(body).not.toMatch(/500|Internal Server Error/i);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|