Anti-flake technology that eliminates test instability
Test flakiness is the bane of CI/CD pipelines. TestDriver eliminates flaky tests with built-in anti-flake technology that automatically handles timing issues, animations, and dynamic content.
Traditional test frameworks suffer from race conditions and timing issues:
Copy
// ❌ May fail randomlyawait page.click('button');await page.click('.dropdown-item'); // Element might not be ready!// ❌ Arbitrary waitsawait page.click('button');await page.waitForTimeout(1000); // Hope 1 second is enoughawait page.click('.dropdown-item');// ❌ Complex wait logicawait page.click('button');await page.waitForSelector('.dropdown-item', { state: 'visible', timeout: 5000});await page.waitForLoadState('networkidle');await page.waitForTimeout(200); // Still need extra buffer!await page.click('.dropdown-item');
TestDriver handles all timing automatically. No explicit waits, no arbitrary timeouts, no flaky tests.
TestDriver waits for network activity to complete before asserting or locating elements:
Automatic Network Waiting
Copy
// TestDriver automatically waits for:// 1. Pending XHR/fetch requests to complete// 2. WebSocket messages to be processed// 3. Image/asset loading to finishawait testdriver.find('submit button').click();// ↑ Triggers API callawait testdriver.assert('Success message is visible');// ↑ Automatically waits for API response before asserting
No need for manual waitForResponse or waitForLoadState calls.
Loading Indicator Detection
Copy
// TestDriver detects common loading patterns:await testdriver.find('Load More button').click();// Automatically waits for:// - Loading spinner to appear and disappear// - Skeleton screens to be replaced// - Progress bars to complete// - "Loading..." text to disappearawait testdriver.find('newly loaded content').click();
Common loading indicators are recognized and waited for automatically.
Custom Network Conditions
Copy
// For slow networks or long-running requestsawait testdriver.find('submit button', { timeout: 60000, // Wait up to 60 seconds networkTimeout: 30000 // Allow 30s for network requests}).click();
The redraw system is configurable through redraw.js:
Copy
// Global redraw settingsconst testdriver = new TestDriver({ apiKey: process.env.TD_API_KEY, redraw: { enabled: true, stabilityDelay: 200, // Default stability wait (ms) maxStabilityWait: 5000, // Maximum time to wait for stability checkInterval: 50, // How often to check for stability networkIdle: true, // Wait for network idle domIdle: true, // Wait for DOM mutations to stop animationIdle: true, // Wait for CSS animations }});