Donobu LogoDonobu Logo
  • Blog
  • Documentation
  • FAQ
  • Contact
Sign Up
Download
Donobu LogoDonobu Logo

AI QA. Self-healing. Zero friction.

© Copyright 2025 Donobu. All Rights Reserved.

About
  • Blog
  • Contact
Product
  • Documentation
  • Context Buffet
Legal
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Get Started with Donobu
    • Creating Your First Flow
    • Using a Logged-In Browser State for Autonomous Runs
  • Donobu API
    • API Configuration
    • Working with Flows
  • Donobu Features
  • Step-by-Step Tutorials
  • Best Practices & Tips
  • Integrations & Ecosystem
    • Testing Framework Integrations
    • CI/CD Pipeline Integrations
    • Monitoring & Alerting
  • Troubleshooting Guide
  • Security and Trust
    • Subprocessors

Testing Framework Integrations

Learn how to integrate Donobu with popular testing frameworks like Playwright, Jest, and Cypress for comprehensive test automation.

Testing Framework Integration Overview

Donobu seamlessly integrates with popular testing frameworks, allowing you to incorporate AI-powered automation into your existing test infrastructure.

Playwright Integration

Donobu can generate complete Playwright test suites from your flows, making it easy to integrate with existing test infrastructure.

Converting Flows to Playwright

# Convert single flow to Playwright script
curl -X GET http://localhost:31000/api/flows/{flowId}/code \
  --output test-script.js

# Generate complete test project
curl -X POST http://localhost:31000/api/flows/project \
  -H "Content-Type: application/json" \
  -d '{
    "flowIds": ["flow-1", "flow-2", "flow-3"],
    "options": {
      "runInHeadedMode": false,
      "slowMotionDelay": 0,
      "disableSelfHealingTests": false
    }
  }' \
  --output playwright-tests.zip

Example Generated Playwright Test

const { test, expect } = require('@playwright/test');

test('User Login Flow', async ({ page }) => {
  // Navigate to login page
  await page.goto('https://app.example.com/login');
  
  // Fill login form
  await page.locator('#email').fill('user@example.com');
  await page.locator('#password').fill('password123');
  await page.locator('#login-button').click();
  
  // Verify successful login
  await expect(page.locator('.dashboard')).toBeVisible();
});

Playwright Configuration

// playwright.config.js
module.exports = {
  testDir: './tests',
  timeout: 30000,
  use: {
    baseURL: 'https://staging.example.com',
    headless: true,
    screenshot: 'only-on-failure',
    video: 'retain-on-failure',
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
    {
      name: 'firefox',
      use: { ...devices['Desktop Firefox'] },
    },
  ],
};

Jest Integration

Integrate Donobu flows with Jest test suites for comprehensive testing.

Donobu Helper Class

// donobu-helper.js
const axios = require('axios');

class DonobuHelper {
  constructor(baseURL = 'http://localhost:31000/api') {
    this.baseURL = baseURL;
  }

  async createFlow(config) {
    const response = await axios.post(`${this.baseURL}/flows`, config);
    return response.data.id;
  }

  async waitForCompletion(flowId, timeout = 60000) {
    const start = Date.now();
    while (Date.now() - start < timeout) {
      const response = await axios.get(`${this.baseURL}/flows/${flowId}`);
      const flow = response.data;
      
      if (flow.state === 'SUCCESS') {
        return flow.result;
      } else if (flow.state === 'FAILED') {
        throw new Error(`Flow failed: ${flow.result?.error || 'Unknown error'}`);
      }
      
      await new Promise(resolve => setTimeout(resolve, 1000));
    }
    throw new Error('Flow timeout');
  }
}

module.exports = DonobuHelper;

Jest Test Example

// __tests__/integration.test.js
const DonobuHelper = require('../donobu-helper');

describe('E2E User Flows', () => {
  let donobu;

  beforeAll(() => {
    donobu = new DonobuHelper();
  });

  test('User registration flow', async () => {
    const flowId = await donobu.createFlow({
      name: 'User Registration Test',
      targetWebsite: 'https://app.example.com/register',
      overallObjective: 'Complete user registration with test data',
      envVars: ['TEST_EMAIL', 'TEST_PASSWORD'],
      maxToolCalls: 15
    });

    const result = await donobu.waitForCompletion(flowId);
    
    expect(result.success).toBe(true);
    expect(result.details).toContain('registration completed');
  }, 90000);
});

WebdriverIO Integration

Custom WebdriverIO Service

// wdio-donobu-service.js
class DonobuService {
  async onPrepare() {
    // Initialize Donobu configurations
    console.log('Setting up Donobu integration...');
  }

  async beforeTest(test) {
    // Create flow for each test
    this.flowId = await this.createDonobuFlow(test);
  }

  async afterTest(test, context, { passed }) {
    if (!passed) {
      // Get debugging information from Donobu
      const screenshots = await this.getFlowScreenshots(this.flowId);
      // Attach to test results
    }
  }

  async createDonobuFlow(test) {
    // Implementation to create flow based on test metadata
  }
}

module.exports = DonobuService;

Cypress Integration

Custom Cypress Commands

// cypress/support/commands.js
Cypress.Commands.add('runDonobuFlow', (config) => {
  return cy.request({
    method: 'POST',
    url: 'http://localhost:31000/api/flows',
    body: config
  }).then((response) => {
    const flowId = response.body.id;
    return cy.waitForFlowCompletion(flowId);
  });
});

Cypress.Commands.add('waitForFlowCompletion', (flowId) => {
  return cy.request(`http://localhost:31000/api/flows/${flowId}`)
    .then((response) => {
      const flow = response.body;
      if (flow.state === 'SUCCESS') {
        return flow.result;
      } else if (flow.state === 'FAILED') {
        throw new Error(`Flow failed: ${flow.result?.error}`);
      } else {
        // Wait and retry
        cy.wait(1000);
        return cy.waitForFlowCompletion(flowId);
      }
    });
});

Cypress Test Example

// cypress/e2e/user-flows.cy.js
describe('User Workflows', () => {
  it('should complete user onboarding', () => {
    cy.runDonobuFlow({
      name: 'User Onboarding Flow',
      targetWebsite: 'https://app.example.com/onboarding',
      overallObjective: 'Complete the user onboarding process',
      maxToolCalls: 20
    }).then((result) => {
      expect(result.success).to.be.true;
    });
  });
});

Best Practices for Framework Integration

1. Environment Configuration

  • Use environment-specific configurations
  • Manage API keys and credentials securely
  • Set appropriate timeouts for different test types

2. Test Organization

  • Group related flows into test suites
  • Use descriptive naming conventions
  • Implement proper setup and teardown

3. Error Handling

  • Implement robust retry mechanisms
  • Capture screenshots and videos on failures
  • Log detailed error information

4. Performance Optimization

  • Run flows in parallel where possible
  • Use headless mode for faster execution
  • Implement efficient resource cleanup

5. Reporting Integration

  • Integrate with existing test reporting tools
  • Capture Donobu metrics (token usage, execution time)
  • Generate comprehensive test reports

By integrating Donobu with your preferred testing framework, you can leverage AI-powered automation while maintaining your existing test infrastructure and practices.

  1. Playwright Integration
    1. Converting Flows to Playwright
    2. Example Generated Playwright Test
    3. Playwright Configuration
    4. Jest Integration
    5. WebdriverIO Integration
    6. Cypress Integration
    7. Best Practices for Framework Integration