Add E2E tests for internationalization across multiple pages

- Implemented navigation.spec.ts to test language switching and translation of navigation elements.
- Created sessions-page.spec.ts to verify translations on the sessions page, including headers, status badges, and date formatting.
- Developed settings-page.spec.ts to ensure settings page content is translated and persists across sessions.
- Added skills-page.spec.ts to validate translations for skill categories, action buttons, and empty states.
This commit is contained in:
catlog22
2026-01-30 22:54:21 +08:00
parent e78e95049b
commit 81725c94b1
150 changed files with 25341 additions and 1448 deletions

View File

@@ -0,0 +1,51 @@
// ========================================
// useProjectOverview Hook
// ========================================
// TanStack Query hook for project overview data
import { useQuery } from '@tanstack/react-query';
import { fetchProjectOverview } from '../lib/api';
// Query key factory
export const projectOverviewKeys = {
all: ['projectOverview'] as const,
detail: (path?: string) => [...projectOverviewKeys.all, 'detail', path] as const,
};
// Default stale time: 5 minutes
const STALE_TIME = 5 * 60 * 1000;
export interface UseProjectOverviewOptions {
/** Override default stale time (ms) */
staleTime?: number;
/** Enable/disable the query */
enabled?: boolean;
}
/**
* Hook for fetching project overview data
*
* @example
* ```tsx
* const { projectOverview, isLoading } = useProjectOverview();
* ```
*/
export function useProjectOverview(options: UseProjectOverviewOptions = {}) {
const { staleTime = STALE_TIME, enabled = true } = options;
const query = useQuery({
queryKey: projectOverviewKeys.detail(),
queryFn: fetchProjectOverview,
staleTime,
enabled,
retry: 2,
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000),
});
return {
projectOverview: query.data,
isLoading: query.isLoading,
error: query.error,
refetch: query.refetch,
};
}