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

View File

@@ -0,0 +1,11 @@
import BaseEnv from "@jest/environment-jsdom-abstract";
import { EnvironmentContext, JestEnvironmentConfig } from "@jest/environment";
//#region src/index.d.ts
declare class JSDOMEnvironment extends BaseEnv {
constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
}
declare const TestEnvironment: typeof JSDOMEnvironment;
//#endregion
export { TestEnvironment, JSDOMEnvironment as default };

View File

@@ -0,0 +1,18 @@
/**
* 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 {EnvironmentContext, JestEnvironmentConfig} from '@jest/environment';
import BaseEnv from '@jest/environment-jsdom-abstract';
declare class JSDOMEnvironment extends BaseEnv {
constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
}
export default JSDOMEnvironment;
export declare const TestEnvironment: typeof JSDOMEnvironment;
export {};

View File

@@ -0,0 +1,55 @@
/*!
* /**
* * 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = exports.TestEnvironment = void 0;
function JSDOM() {
const data = _interopRequireWildcard(require("jsdom"));
JSDOM = function () {
return data;
};
return data;
}
function _environmentJsdomAbstract() {
const data = _interopRequireDefault(require("@jest/environment-jsdom-abstract"));
_environmentJsdomAbstract = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/**
* 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.
*/
class JSDOMEnvironment extends _environmentJsdomAbstract().default {
constructor(config, context) {
super(config, context, JSDOM());
}
}
exports["default"] = JSDOMEnvironment;
const TestEnvironment = exports.TestEnvironment = JSDOMEnvironment;
})();
module.exports = __webpack_exports__;
/******/ })()
;

View File

@@ -0,0 +1,4 @@
import cjsModule from './index.js';
export const TestEnvironment = cjsModule.TestEnvironment;
export default cjsModule.default;