Skip to content

testdriverai/demo-v7-first-release

Repository files navigation

TestDriver Vitest Plugin Example

This example project demonstrates how to use the TestDriver Vitest plugin in your own projects.

Setup

# Install dependencies
npm install

# Set your API key
export TD_API_KEY=your_api_key_here

# Run tests
vitest run tests/*.test.mjs

Project Structure

examples/vitest-plugin/
├── package.json          # Project config with testdriverai dependency
├── vitest.config.mjs     # Vitest configuration
├── README.md             # This file
└── tests/
    ├── basic.test.mjs    # Simple example
    ├── airbnb.test.mjs    # More complex example
    ├── lifecycle.test.mjs # Using lifecycle helpers
    └── once.test.mjs     # Using it.once() for setup

Examples

Basic Usage

import { describe, expect, it } from "vitest";
import { TestDriver } from "testdriverai/vitest";

describe("My Test", () => {
  it("should work", async (context) => {
    const testdriver = TestDriver(context, { headless: true });
    
    await testdriver.provision.chrome({ url: "https://example.com" });
    
    const result = await testdriver.assert("page loaded");
    expect(result).toBeTruthy();
  });
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors