test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
import { type Page, type Locator, expect } from '@playwright/test';
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
2026-04-02 17:42:03 +00:00
|
|
|
// CONFIGURATION — Basee sur le code source reel de Veza
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
export const CONFIG = {
|
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
|
|
|
/** Base URL du frontend Vite dev server (use 127.0.0.1 to avoid IPv6 ::1 resolution issues) */
|
|
|
|
|
baseURL: process.env.PLAYWRIGHT_BASE_URL || `http://127.0.0.1:${process.env.PORT || '5173'}`,
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
|
|
|
|
/** Base URL de l'API backend (proxied via Vite en dev) */
|
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
|
|
|
apiURL: process.env.PLAYWRIGHT_API_URL || `http://127.0.0.1:${process.env.PORT || '5173'}`,
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
|
|
|
|
/** Base URL du stream server Rust */
|
|
|
|
|
streamURL: process.env.PLAYWRIGHT_STREAM_URL || 'http://localhost:18082',
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
/** Comptes de test (seed: veza-backend-api/cmd/tools/seed/seed_users.go) */
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
users: {
|
|
|
|
|
listener: {
|
2026-04-02 17:42:03 +00:00
|
|
|
email: 'user@veza.music',
|
|
|
|
|
password: 'User123!',
|
|
|
|
|
username: 'music_fan',
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
},
|
|
|
|
|
creator: {
|
2026-04-02 17:42:03 +00:00
|
|
|
email: 'artist@veza.music',
|
|
|
|
|
password: 'Artist123!',
|
|
|
|
|
username: 'top_artist',
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
},
|
|
|
|
|
admin: {
|
2026-04-02 17:42:03 +00:00
|
|
|
email: 'admin@veza.music',
|
|
|
|
|
password: 'Admin123!',
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
username: 'admin_veza',
|
|
|
|
|
},
|
|
|
|
|
moderator: {
|
2026-04-02 17:42:03 +00:00
|
|
|
email: 'mod@veza.music',
|
|
|
|
|
password: 'Mod123!',
|
|
|
|
|
username: 'mod_veza',
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** Timeouts (ms) */
|
|
|
|
|
timeouts: {
|
|
|
|
|
navigation: 15_000,
|
|
|
|
|
action: 5_000,
|
|
|
|
|
animation: 1_000,
|
|
|
|
|
networkIdle: 10_000,
|
|
|
|
|
},
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// AUTH HELPERS
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Login via l'interface utilisateur (page /login).
|
2026-04-02 17:42:03 +00:00
|
|
|
* STRICT: echoue si le login ne redirige pas hors de /login.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function loginViaUI(
|
|
|
|
|
page: Page,
|
|
|
|
|
email: string,
|
|
|
|
|
password: string,
|
|
|
|
|
options: { rememberMe?: boolean } = {},
|
|
|
|
|
): Promise<void> {
|
2026-03-25 01:53:47 +00:00
|
|
|
await page.goto(`${CONFIG.baseURL}/login`, { waitUntil: 'domcontentloaded' });
|
2026-04-02 17:42:03 +00:00
|
|
|
|
|
|
|
|
// Wait for the app to finish initializing (splash -> login form)
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
await page.locator('main, [role="main"]').first().waitFor({
|
|
|
|
|
state: 'visible',
|
|
|
|
|
timeout: CONFIG.timeouts.navigation,
|
2026-04-02 17:42:03 +00:00
|
|
|
});
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
|
|
|
|
const emailInput = page.locator('input[type="email"]');
|
|
|
|
|
await emailInput.waitFor({ state: 'visible', timeout: CONFIG.timeouts.navigation });
|
|
|
|
|
await emailInput.clear();
|
|
|
|
|
await emailInput.fill(email);
|
|
|
|
|
|
|
|
|
|
const passwordInput = page.locator('input[type="password"]');
|
|
|
|
|
await passwordInput.clear();
|
|
|
|
|
await passwordInput.fill(password);
|
|
|
|
|
|
|
|
|
|
if (options.rememberMe) {
|
|
|
|
|
const rememberMe = page.locator('#remember_me');
|
2026-04-02 17:42:03 +00:00
|
|
|
if (await rememberMe.isVisible()) {
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
await rememberMe.check();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitBtn = page.getByTestId('login-submit');
|
2026-04-02 17:42:03 +00:00
|
|
|
await expect(submitBtn).toBeVisible({ timeout: CONFIG.timeouts.action });
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
await submitBtn.click();
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// STRICT: must redirect away from /login
|
|
|
|
|
await page.waitForURL((url) => !url.pathname.includes('/login'), {
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
timeout: CONFIG.timeouts.navigation,
|
2026-04-02 17:42:03 +00:00
|
|
|
});
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Login via l'API directement (plus rapide, pour les tests qui n'ont pas besoin de tester le login).
|
2026-04-02 17:42:03 +00:00
|
|
|
* STRICT: echoue si l'API retourne une erreur.
|
2026-04-05 14:15:11 +00:00
|
|
|
*
|
|
|
|
|
* Auth uses httpOnly cookies set by backend. Each test needs to call the login API
|
|
|
|
|
* so that the browser context receives the auth cookies. We cannot skip this — the
|
|
|
|
|
* cookie cannot be copied across browser contexts from JavaScript.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function loginViaAPI(
|
|
|
|
|
page: Page,
|
|
|
|
|
email: string,
|
|
|
|
|
password: string,
|
|
|
|
|
): Promise<void> {
|
2026-03-25 01:53:47 +00:00
|
|
|
const base = CONFIG.baseURL;
|
|
|
|
|
await page.goto(`${base}/`, { waitUntil: 'commit', timeout: CONFIG.timeouts.navigation });
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
2026-04-05 14:15:11 +00:00
|
|
|
const response = await page.request.post(`${base}/api/v1/auth/login`, {
|
|
|
|
|
data: { email, password, remember_me: false },
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// STRICT: login must succeed
|
|
|
|
|
expect(response.ok(), `Login API failed: ${response.status()} for ${email}`).toBeTruthy();
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
2026-04-05 14:15:11 +00:00
|
|
|
// Set the auth-storage flag so React knows user is authenticated.
|
|
|
|
|
// The actual token is in an httpOnly cookie set automatically by the backend response.
|
|
|
|
|
await page.evaluate(() => {
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
const authState = {
|
|
|
|
|
state: { isAuthenticated: true, isLoading: false, error: null },
|
|
|
|
|
version: 1,
|
|
|
|
|
};
|
|
|
|
|
localStorage.setItem('auth-storage', JSON.stringify(authState));
|
2026-04-05 14:15:11 +00:00
|
|
|
});
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
2026-03-25 01:53:47 +00:00
|
|
|
await page.goto(`${CONFIG.baseURL}/dashboard`, { waitUntil: 'domcontentloaded', timeout: 30_000 });
|
2026-04-02 17:42:03 +00:00
|
|
|
await page.locator('main, [role="main"]').first().waitFor({
|
|
|
|
|
state: 'visible',
|
|
|
|
|
timeout: 20_000,
|
|
|
|
|
});
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// NAVIGATION HELPERS
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Navigue vers un path et attend que l'app soit prete.
|
|
|
|
|
* STRICT: echoue si la page ne charge pas (main element must appear).
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function navigateTo(page: Page, path: string): Promise<void> {
|
2026-03-25 01:53:47 +00:00
|
|
|
const url = path.startsWith('http') ? path : `${CONFIG.baseURL}${path}`;
|
|
|
|
|
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30_000 });
|
2026-04-05 14:15:11 +00:00
|
|
|
await page.waitForLoadState('networkidle', { timeout: 5_000 }).catch(() => {
|
|
|
|
|
// networkidle can legitimately timeout on pages with websockets/polling — not a test failure
|
|
|
|
|
});
|
2026-04-02 17:42:03 +00:00
|
|
|
// App must render a main content area
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
await page.locator('main, [role="main"]').first().waitFor({
|
|
|
|
|
state: 'visible',
|
|
|
|
|
timeout: 20_000,
|
2026-04-02 17:42:03 +00:00
|
|
|
});
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Verifie qu'une page se charge sans erreur critique.
|
|
|
|
|
* STRICT: fails on 500 errors visible in the page.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function assertPageLoads(page: Page, path: string): Promise<string[]> {
|
|
|
|
|
const errors: string[] = [];
|
|
|
|
|
|
|
|
|
|
page.on('console', (msg) => {
|
|
|
|
|
if (msg.type() === 'error') {
|
|
|
|
|
errors.push(msg.text());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
page.on('pageerror', (err) => {
|
|
|
|
|
errors.push(err.message);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await navigateTo(page, path);
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
const body = await page.textContent('body') || '';
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
expect(body).not.toMatch(/500|Internal Server Error/i);
|
|
|
|
|
|
|
|
|
|
return errors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// FORM HELPERS
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Remplit un formulaire avec les champs donnes.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function fillForm(
|
|
|
|
|
page: Page,
|
|
|
|
|
fields: Record<string, string>,
|
|
|
|
|
): Promise<void> {
|
|
|
|
|
for (const [label, value] of Object.entries(fields)) {
|
|
|
|
|
const input = page.getByLabel(new RegExp(label, 'i'))
|
|
|
|
|
.or(page.getByPlaceholder(new RegExp(label, 'i')));
|
|
|
|
|
await input.first().fill(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// ASSERTION HELPERS
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Verifie qu'il n'y a pas de texte de debug visible.
|
|
|
|
|
* STRICT: fails if [object Object] or excessive undefined/null/NaN found.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function assertNoDebugText(page: Page): Promise<void> {
|
2026-04-02 17:42:03 +00:00
|
|
|
const body = await page.textContent('body') || '';
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
expect(body).not.toContain('[object Object]');
|
|
|
|
|
const suspiciousPatterns = /\bundefined\b(?!.*password)|\bnull\b.*\bnull\b|\bNaN\b/g;
|
|
|
|
|
const matches = body.match(suspiciousPatterns);
|
2026-04-02 17:42:03 +00:00
|
|
|
expect(
|
|
|
|
|
matches?.length ?? 0,
|
|
|
|
|
`Debug text found in page: ${matches?.slice(0, 3).join(', ')}`,
|
|
|
|
|
).toBeLessThanOrEqual(2);
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Verifie que la page n'a pas d'erreur serveur visible.
|
|
|
|
|
* STRICT: fails on 500 errors or empty body.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function assertNotBroken(page: Page): Promise<void> {
|
2026-04-02 17:42:03 +00:00
|
|
|
const body = await page.textContent('body') || '';
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
expect(body).not.toMatch(/500|Internal Server Error|unexpected error/i);
|
|
|
|
|
expect(body.length).toBeGreaterThan(50);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Collecte les erreurs reseau (5xx) pendant une action.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function collectNetworkErrors(
|
|
|
|
|
page: Page,
|
|
|
|
|
action: () => Promise<void>,
|
|
|
|
|
): Promise<string[]> {
|
|
|
|
|
const errors: string[] = [];
|
|
|
|
|
|
|
|
|
|
const handler = (response: { status: () => number; url: () => string }) => {
|
|
|
|
|
if (response.status() >= 500) {
|
|
|
|
|
errors.push(`${response.status()} ${response.url()}`);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
page.on('response', handler);
|
|
|
|
|
await action();
|
|
|
|
|
page.off('response', handler);
|
|
|
|
|
|
|
|
|
|
return errors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// LAYOUT HELPERS
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Dismiss the mobile sidebar if it's open.
|
|
|
|
|
*/
|
|
|
|
|
export async function dismissMobileSidebar(page: Page): Promise<void> {
|
|
|
|
|
const sidebarOverlay = page.locator('div[aria-hidden="true"][role="presentation"].fixed.inset-0');
|
|
|
|
|
if (await sidebarOverlay.isVisible({ timeout: 1_000 }).catch(() => false)) {
|
|
|
|
|
await page.keyboard.press('Escape');
|
2026-04-02 17:42:03 +00:00
|
|
|
await sidebarOverlay.waitFor({ state: 'hidden', timeout: 3_000 });
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// PLAYER HELPERS
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Verifie que le player global est visible et le retourne.
|
|
|
|
|
* STRICT: fails if player is not visible.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function assertPlayerVisible(page: Page): Promise<Locator> {
|
|
|
|
|
const player = page.getByTestId('global-player')
|
|
|
|
|
.or(page.locator('[role="region"][aria-label="Global player"]'));
|
|
|
|
|
|
|
|
|
|
await expect(player.first()).toBeVisible({ timeout: CONFIG.timeouts.action });
|
|
|
|
|
return player.first();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Navigate to a page that displays track cards (role="article").
|
|
|
|
|
* Returns true if tracks are found, false if the database has no tracks.
|
|
|
|
|
* Does NOT swallow errors — navigation failures will throw.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function navigateToPageWithTracks(page: Page): Promise<boolean> {
|
|
|
|
|
await dismissMobileSidebar(page);
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// Try /feed first
|
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 navigateTo(page, '/feed');
|
|
|
|
|
const feedTrack = page.locator('[role="article"]').first();
|
|
|
|
|
if (await feedTrack.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// Fallback: /discover -> click first genre
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
await navigateTo(page, '/discover');
|
|
|
|
|
const genreBtn = page.locator('button').filter({ has: page.locator('.font-heading.font-bold') }).first();
|
|
|
|
|
|
|
|
|
|
if (await genreBtn.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
|
|
|
|
await genreBtn.click();
|
|
|
|
|
await page.waitForLoadState('networkidle').catch(() => {});
|
|
|
|
|
const genreTrack = page.locator('[role="article"]').first();
|
|
|
|
|
if (await genreTrack.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Lance la lecture du premier track disponible.
|
2026-04-02 17:42:03 +00:00
|
|
|
* STRICT: fails if no play button is found or if it can't be clicked.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function playFirstTrack(page: Page): Promise<void> {
|
|
|
|
|
await dismissMobileSidebar(page);
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// If no track cards on current page, navigate to one that has them
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
const currentTrack = page.locator('[role="article"]').first();
|
|
|
|
|
if (!await currentTrack.isVisible({ timeout: 3_000 }).catch(() => false)) {
|
2026-04-02 17:42:03 +00:00
|
|
|
const found = await navigateToPageWithTracks(page);
|
|
|
|
|
expect(found, 'No tracks found in feed or discover — database may need seeding').toBeTruthy();
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// Hover to reveal play button
|
|
|
|
|
const trackCard = page.locator('[role="article"]').first();
|
|
|
|
|
await expect(trackCard).toBeVisible({ timeout: CONFIG.timeouts.action });
|
|
|
|
|
await trackCard.hover();
|
|
|
|
|
await page.waitForTimeout(300);
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// Click play
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
const playBtn = page.getByRole('button', { name: /^lire |^play /i }).first()
|
|
|
|
|
.or(page.locator('[aria-label*="Lire"]').first())
|
|
|
|
|
.or(page.locator('[aria-label*="Play"]').first());
|
|
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
await expect(playBtn).toBeVisible({ timeout: CONFIG.timeouts.action });
|
|
|
|
|
await playBtn.click();
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
2026-04-02 17:42:03 +00:00
|
|
|
// Wait for player to appear
|
|
|
|
|
await page.waitForTimeout(CONFIG.timeouts.animation);
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
2026-04-02 17:42:03 +00:00
|
|
|
// COMPONENT SELECTORS — Bases sur le code source reel
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
export const SELECTORS = {
|
2026-04-02 17:42:03 +00:00
|
|
|
sidebar: '[data-testid="app-sidebar"]',
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
header: 'header, [data-testid="app-header"], [role="banner"]',
|
2026-04-02 17:42:03 +00:00
|
|
|
playerBar: '[data-testid="global-player"]',
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
|
|
|
|
|
loginForm: '[data-testid="login-form"]',
|
|
|
|
|
registerForm: '[data-testid="register-form"]',
|
|
|
|
|
|
|
|
|
|
audioElement: '[data-testid="audio-element"]',
|
|
|
|
|
progressBar: '[role="slider"][aria-label="Progression"]',
|
|
|
|
|
volumeSlider: '[data-testid="volume-control"] [role="slider"]',
|
|
|
|
|
|
|
|
|
|
toast: '[data-testid="toast-alert"]',
|
|
|
|
|
trackCard: '[role="article"]',
|
|
|
|
|
searchInput: '[data-testid="search-input"], [role="search"] input, input[type="search"], input[role="searchbox"]',
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// UTILITY
|
|
|
|
|
// =============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Attend qu'un toast soit visible, puis retourne son texte.
|
2026-04-02 17:42:03 +00:00
|
|
|
* STRICT: fails if no toast appears within timeout.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export async function waitForToast(page: Page): Promise<string> {
|
|
|
|
|
const toast = page.getByTestId('toast-alert').first();
|
2026-04-02 17:42:03 +00:00
|
|
|
await expect(toast).toBeVisible({ timeout: CONFIG.timeouts.action });
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
return (await toast.textContent()) || '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-02 17:42:03 +00:00
|
|
|
* Genere un identifiant unique pour les donnees de test.
|
test: add comprehensive e2e test suite (34 spec files)
New tests/e2e/ suite covering:
- Auth, navigation, player, tracks, playlists
- Search, discover, social, marketplace, chat
- Accessibility, API, workflows, edge cases
- Routes coverage, forms validation, modals
- Empty states, responsive, network errors
- Error boundary, performance, visual regression
- Cross-browser, profile, smoke, upload
- Storybook, deep pages, visual bugs
- Includes fixtures, helpers, global setup/teardown
- Playwright config and coverage map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:36:22 +00:00
|
|
|
*/
|
|
|
|
|
export function testId(prefix = 'e2e'): string {
|
|
|
|
|
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
|
|
|
}
|