fix: resolve all lint errors in e2e tests and improve type safety

- Replace 'any' types with proper TypeScript interfaces in auth setup/teardown
- Remove conflicting custom Playwright type declarations that were overriding official types
- Fix ES module compatibility by replacing require() with proper import paths
- Add proper generic typing to Playwright test fixtures
- Fix test discovery in auth debug configuration
- Add comprehensive auth debug setup documentation

Fixes:
- 3 lint warnings about explicit 'any' usage
- 45+ TypeScript compilation errors from type conflicts
- ES module import errors in auth configuration
- Test fixture typing issues

All e2e tests now pass lint and type checking with zero warnings.
This commit is contained in:
William Valentin
2025-09-08 08:47:21 -07:00
parent 4d12aeef61
commit a1b3c6a8ed
6 changed files with 533 additions and 127 deletions

82
types/playwright.d.ts vendored
View File

@@ -1,82 +0,0 @@
// Temporary type declarations for Playwright
// This file can be removed once @playwright/test is properly installed
declare module '@playwright/test' {
export interface Page {
goto(url: string): Promise<void>;
click(selector: string): Promise<void>;
fill(selector: string, value: string): Promise<void>;
selectOption(selector: string, value: string): Promise<void>;
locator(selector: string): Locator;
waitForSelector(
selector: string,
options?: { timeout?: number }
): Promise<void>;
setViewportSize(size: { width: number; height: number }): Promise<void>;
}
export interface Locator {
click(): Promise<void>;
fill(value: string): Promise<void>;
toBeVisible(): Promise<void>;
toContainText(text: string | string[]): Promise<void>;
toHaveClass(pattern: RegExp): Promise<void>;
not: Locator;
first(): Locator;
toHaveCount(count: number): Promise<void>;
}
export interface TestFunction {
(name: string, fn: ({ page }: { page: Page }) => Promise<void>): void;
describe: (name: string, fn: () => void) => void;
beforeEach: (fn: ({ page }: { page: Page }) => Promise<void>) => void;
extend: (fixtures: Record<string, unknown>) => TestFunction;
}
export interface ExpectFunction {
(actual: unknown): {
toBeVisible(): Promise<void>;
toContainText(text: string | string[]): Promise<void>;
toHaveClass(pattern: RegExp): Promise<void>;
not: {
toBeVisible(): Promise<void>;
toHaveClass(pattern: RegExp): Promise<void>;
};
toHaveCount(count: number): Promise<void>;
};
}
export const test: TestFunction;
export const expect: ExpectFunction;
export interface Config {
testDir?: string;
fullyParallel?: boolean;
forbidOnly?: boolean;
retries?: number;
workers?: number;
reporter?: string;
use?: {
baseURL?: string;
trace?: string;
screenshot?: string;
video?: string;
};
projects?: Array<{
name: string;
use: Record<string, unknown>;
}>;
webServer?: {
command: string;
url: string;
reuseExistingServer: boolean;
timeout: number;
};
}
export function defineConfig(config: Config): Config;
export const devices: {
[key: string]: Record<string, unknown>;
};
}