 aacb45156b
			
		
	
	aacb45156b
	
	
	
		
			
			- 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>
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| "use strict";
 | |
| 
 | |
| Object.defineProperty(exports, "__esModule", {
 | |
|   value: true
 | |
| });
 | |
| exports.waitForElementToBeRemoved = waitForElementToBeRemoved;
 | |
| var _waitFor = require("./wait-for");
 | |
| const isRemoved = result => !result || Array.isArray(result) && !result.length;
 | |
| 
 | |
| // Check if the element is not present.
 | |
| // As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
 | |
| function initialCheck(elements) {
 | |
|   if (isRemoved(elements)) {
 | |
|     throw new Error('The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.');
 | |
|   }
 | |
| }
 | |
| async function waitForElementToBeRemoved(callback, options) {
 | |
|   // created here so we get a nice stacktrace
 | |
|   const timeoutError = new Error('Timed out in waitForElementToBeRemoved.');
 | |
|   if (typeof callback !== 'function') {
 | |
|     initialCheck(callback);
 | |
|     const elements = Array.isArray(callback) ? callback : [callback];
 | |
|     const getRemainingElements = elements.map(element => {
 | |
|       let parent = element.parentElement;
 | |
|       if (parent === null) return () => null;
 | |
|       while (parent.parentElement) parent = parent.parentElement;
 | |
|       return () => parent.contains(element) ? element : null;
 | |
|     });
 | |
|     callback = () => getRemainingElements.map(c => c()).filter(Boolean);
 | |
|   }
 | |
|   initialCheck(callback());
 | |
|   return (0, _waitFor.waitFor)(() => {
 | |
|     let result;
 | |
|     try {
 | |
|       result = callback();
 | |
|     } catch (error) {
 | |
|       if (error.name === 'TestingLibraryElementError') {
 | |
|         return undefined;
 | |
|       }
 | |
|       throw error;
 | |
|     }
 | |
|     if (!isRemoved(result)) {
 | |
|       throw timeoutError;
 | |
|     }
 | |
|     return undefined;
 | |
|   }, options);
 | |
| }
 | |
| 
 | |
| /*
 | |
| eslint
 | |
|   require-await: "off"
 | |
| */ |