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 Polling for Slow Elements
Copy
// For elements that take time to appear, use pollingasync function waitForElement(description, timeoutMs = 60000) { const startTime = Date.now(); while (Date.now() - startTime < timeoutMs) { const element = await testdriver.find(description); if (element.found()) return element; await new Promise(r => setTimeout(r, 1000)); } throw new Error(`Element "${description}" not found`);}const button = await waitForElement('submit button');await button.click();
Compare what TestDriver saw vs. what you expected.
Copy
const element = await testdriver.find('login button');if (!element.found()) { // Screenshot shows what TestDriver analyzed console.log('Check screenshot:', element.screenshotPath); // Similarity score indicates how close it got console.log('Best match similarity:', element.aiResponse?.similarity); // Review the description for clarity console.log('Search description:', 'login button');}
4
Refine Your Description
Use debug insights to improve element descriptions.
Copy
// Too vagueconst btn = await testdriver.find('button');// Better - more specificconst loginBtn = await testdriver.find('blue login button in header');// Best - unique identifying featuresconst submitBtn = await testdriver.find('submit button with arrow icon');