Set up comprehensive frontend testing infrastructure

- Install Jest for unit testing with React Testing Library
- Install Playwright for end-to-end testing
- Configure Jest with proper TypeScript support and module mapping
- Create test setup files and utilities for both unit and e2e tests

Components:
* Jest configuration with coverage thresholds
* Playwright configuration with browser automation
* Unit tests for LoginForm, AuthContext, and useSocketIO hook
* E2E tests for authentication, dashboard, and agents workflows
* GitHub Actions workflow for automated testing
* Mock data and API utilities for consistent testing
* Test documentation with best practices

Testing features:
- Unit tests with 70% coverage threshold
- E2E tests with API mocking and user journey testing
- CI/CD integration for automated test runs
- Cross-browser testing support with Playwright
- Authentication system testing end-to-end

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-11 14:06:34 +10:00
parent c6d69695a8
commit aacb45156b
6109 changed files with 777927 additions and 1 deletions

82
frontend/node_modules/@jest/core/build/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,82 @@
import { BaseReporter, Reporter, ReporterContext } from "@jest/reporters";
import { AggregatedResult, Test, TestContext } from "@jest/test-result";
import { TestWatcher } from "jest-watcher";
import { ChangedFiles } from "jest-changed-files";
import { TestPathPatternsExecutor } from "@jest/pattern";
import { Config } from "@jest/types";
import { TestRunnerContext } from "jest-runner";
//#region src/types.d.ts
type Stats = {
roots: number;
testMatch: number;
testPathIgnorePatterns: number;
testRegex: number;
testPathPatterns?: number;
};
type Filter = (testPaths: Array<string>) => Promise<{
filtered: Array<string>;
}>;
//#endregion
//#region src/SearchSource.d.ts
type SearchResult = {
noSCM?: boolean;
stats?: Stats;
collectCoverageFrom?: Set<string>;
tests: Array<Test>;
total?: number;
};
declare class SearchSource {
private readonly _context;
private _dependencyResolver;
private readonly _testPathCases;
constructor(context: TestContext);
private _getOrBuildDependencyResolver;
private _filterTestPathsWithStats;
private _getAllTestPaths;
isTestFilePath(path: string): boolean;
findMatchingTests(testPathPatternsExecutor: TestPathPatternsExecutor): SearchResult;
findRelatedTests(allPaths: Set<string>, collectCoverage: boolean): Promise<SearchResult>;
findTestsByPaths(paths: Array<string>): SearchResult;
findRelatedTestsFromPattern(paths: Array<string>, collectCoverage: boolean): Promise<SearchResult>;
findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): Promise<SearchResult>;
private _getTestPaths;
filterPathsWin32(paths: Array<string>): Array<string>;
getTestPaths(globalConfig: Config.GlobalConfig, projectConfig: Config.ProjectConfig, changedFiles?: ChangedFiles, filter?: Filter): Promise<SearchResult>;
findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Promise<Array<string>>;
}
//#endregion
//#region src/TestScheduler.d.ts
type ReporterConstructor = new (globalConfig: Config.GlobalConfig, reporterConfig: Record<string, unknown>, reporterContext: ReporterContext) => BaseReporter;
type TestSchedulerContext = ReporterContext & TestRunnerContext;
declare function createTestScheduler(globalConfig: Config.GlobalConfig, context: TestSchedulerContext): Promise<TestScheduler>;
declare class TestScheduler {
private readonly _context;
private readonly _dispatcher;
private readonly _globalConfig;
constructor(globalConfig: Config.GlobalConfig, context: TestSchedulerContext);
addReporter(reporter: Reporter): void;
removeReporter(reporterConstructor: ReporterConstructor): void;
scheduleTests(tests: Array<Test>, watcher: TestWatcher): Promise<AggregatedResult>;
private _partitionTests;
_setupReporters(): Promise<void>;
private _addCustomReporter;
private _bailIfNeeded;
}
//#endregion
//#region src/cli/index.d.ts
declare function runCLI(argv: Config.Argv, projects: Array<string>): Promise<{
results: AggregatedResult;
globalConfig: Config.GlobalConfig;
}>;
//#endregion
//#region src/version.d.ts
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare function getVersion(): string;
//#endregion
export { SearchSource, createTestScheduler, getVersion, runCLI };

114
frontend/node_modules/@jest/core/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,114 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {TestPathPatternsExecutor} from '@jest/pattern';
import {BaseReporter, Reporter, ReporterContext} from '@jest/reporters';
import {AggregatedResult, Test, TestContext} from '@jest/test-result';
import {Config} from '@jest/types';
import {ChangedFiles} from 'jest-changed-files';
import {TestRunnerContext} from 'jest-runner';
import {TestWatcher} from 'jest-watcher';
export declare function createTestScheduler(
globalConfig: Config.GlobalConfig,
context: TestSchedulerContext,
): Promise<TestScheduler>;
declare type Filter = (testPaths: Array<string>) => Promise<{
filtered: Array<string>;
}>;
export declare function getVersion(): string;
declare type ReporterConstructor = new (
globalConfig: Config.GlobalConfig,
reporterConfig: Record<string, unknown>,
reporterContext: ReporterContext,
) => BaseReporter;
export declare function runCLI(
argv: Config.Argv,
projects: Array<string>,
): Promise<{
results: AggregatedResult;
globalConfig: Config.GlobalConfig;
}>;
declare type SearchResult = {
noSCM?: boolean;
stats?: Stats;
collectCoverageFrom?: Set<string>;
tests: Array<Test>;
total?: number;
};
export declare class SearchSource {
private readonly _context;
private _dependencyResolver;
private readonly _testPathCases;
constructor(context: TestContext);
private _getOrBuildDependencyResolver;
private _filterTestPathsWithStats;
private _getAllTestPaths;
isTestFilePath(path: string): boolean;
findMatchingTests(
testPathPatternsExecutor: TestPathPatternsExecutor,
): SearchResult;
findRelatedTests(
allPaths: Set<string>,
collectCoverage: boolean,
): Promise<SearchResult>;
findTestsByPaths(paths: Array<string>): SearchResult;
findRelatedTestsFromPattern(
paths: Array<string>,
collectCoverage: boolean,
): Promise<SearchResult>;
findTestRelatedToChangedFiles(
changedFilesInfo: ChangedFiles,
collectCoverage: boolean,
): Promise<SearchResult>;
private _getTestPaths;
filterPathsWin32(paths: Array<string>): Array<string>;
getTestPaths(
globalConfig: Config.GlobalConfig,
projectConfig: Config.ProjectConfig,
changedFiles?: ChangedFiles,
filter?: Filter,
): Promise<SearchResult>;
findRelatedSourcesFromTestsInChangedFiles(
changedFilesInfo: ChangedFiles,
): Promise<Array<string>>;
}
declare type Stats = {
roots: number;
testMatch: number;
testPathIgnorePatterns: number;
testRegex: number;
testPathPatterns?: number;
};
declare class TestScheduler {
private readonly _context;
private readonly _dispatcher;
private readonly _globalConfig;
constructor(globalConfig: Config.GlobalConfig, context: TestSchedulerContext);
addReporter(reporter: Reporter): void;
removeReporter(reporterConstructor: ReporterConstructor): void;
scheduleTests(
tests: Array<Test>,
watcher: TestWatcher,
): Promise<AggregatedResult>;
private _partitionTests;
_setupReporters(): Promise<void>;
private _addCustomReporter;
private _bailIfNeeded;
}
declare type TestSchedulerContext = ReporterContext & TestRunnerContext;
export {};

4128
frontend/node_modules/@jest/core/build/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

6
frontend/node_modules/@jest/core/build/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import cjsModule from './index.js';
export const SearchSource = cjsModule.SearchSource;
export const createTestScheduler = cjsModule.createTestScheduler;
export const getVersion = cjsModule.getVersion;
export const runCLI = cjsModule.runCLI;