npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

testgenius-ai

v1.3.0

Published

πŸš€ TestGenius AI - The Ultimate E2E Testing Framework for Everyone | No Coding Required β€’ AI-Powered Automation β€’ Beautiful Reports β€’ Zero Complexity

Readme

🧠 Smart AI Testing Framework

AI-powered, WebDriverIO-based, fully dynamic E2E testing with zero hardcoded steps.


What is This?

A next-generation, AI-driven end-to-end testing framework that uses OpenAI and WebDriverIO to:

  • Dynamically interpret test instructions (no static parsing)
  • Support async test case formats (with setup, data, and task functions)
  • Leverage a Smart AI Agent for intelligent, context-aware automation
  • Auto-generate and execute plans using natural language
  • Provide beautiful, actionable reports

✨ Key Features

  • No static plans: All test steps are dynamically generated and executed by AI
  • Async test case support: Write tests as async functions for setup, data, and task
  • Smart AI Agent: LangGraph-based, memory-persistent, tool-driven agent
  • WebDriverIO integration: Modern browser automation, cross-browser support
  • Intelligent tools: Navigation, click, fill, verify, wait, screenshot, and more
  • Cost tracking: Real-time OpenAI usage and cost monitoring
  • Beautiful reporting: HTML and Allure support
  • Backward compatible: Old static test formats still work

πŸš€ Quick Start

Option 1: Install from NPM (Recommended)

# Install globally for CLI access
npm install -g testgenius-ai

# Or install locally in your project
npm install testgenius-ai

Option 2: Clone and Install Locally

# Clone the repository
git clone https://github.com/hiroksarker/testgenius-ai.git
cd testgenius-ai

# Install dependencies
npm install

Set Up Environment Variables

⚠️ IMPORTANT: OpenAI API Key Required

Create a .env file in the project root:

cp env.example .env

Edit .env and add your OpenAI API key:

# Required: Your OpenAI API key for AI-powered test execution
OPENAI_API_KEY=your_actual_openai_api_key_here

Alternative: Set as environment variable:

export OPENAI_API_KEY=your_actual_openai_api_key_here

Run Tests

If installed globally:

# Run demo test
testgenius run tests/smart-ai-demo.js

# List all tests
testgenius list

# Run all tests
testgenius run

If installed locally or cloned:

# Run demo test
node tests/smart-ai-demo.js

# Or use npm script
npm start

πŸ“ Writing Smart AI Tests

Async, Dynamic Test Format

// tests/smart-login-test.js
module.exports = {
  name: 'Smart Login Test',
  site: 'https://the-internet.herokuapp.com/login',

  setup: async () => ({
    env: 'production',
    timestamp: new Date().toISOString()
  }),

  data: async () => ({
    username: 'tomsmith',
    password: 'SuperSecretPassword!',
    expectedTitle: 'The Internet'
  }),

  task: async (data, setup) =>
    `Login to the application using username "${data.username}" and password "${data.password}", then verify the page title contains "${data.expectedTitle}"`
};

Static (Legacy) Format

module.exports = {
  name: 'Simple Login Test',
  site: 'https://the-internet.herokuapp.com/login',
  task: 'Navigate to login page, enter credentials, click login, verify dashboard access'
};

πŸ€– Example: Smart AI Demo

const { TestRunner } = require('./dist/framework/core/TestRunner');
const { AITestExecutor } = require('./dist/framework/core/AITestExecutor');

const smartAITest = {
  name: 'Smart AI Demo Test',
  site: 'https://the-internet.herokuapp.com/login',
  setup: async () => ({ env: 'production' }),
  data: async () => ({ username: 'tomsmith', password: 'SuperSecretPassword!', expectedTitle: 'The Internet' }),
  task: async (data) => `Login to the application using username "${data.username}" and password "${data.password}", then verify the page title contains "${data.expectedTitle}"`
};

async function runSmartAIDemo() {
  const testRunner = new TestRunner();
  await testRunner.autoSetup();
  const result = await testRunner.runAutoTest(smartAITest);
  console.log(result);
}

if (require.main === module) runSmartAIDemo();

πŸ› οΈ Smart AI Tools

  • Navigation: smart_navigate
  • Click: smart_click
  • Fill: smart_fill
  • Verify: smart_verify
  • Wait: smart_wait
  • Screenshot: smart_screenshot
  • Get Content: smart_get_content

All tools use schema validation and multiple detection strategies (CSS, XPath, text, etc).


🧠 How It Works

  • Test case β†’ Async functions for setup, data, and task
  • Smart AI Agent:
    • Receives the task as natural language
    • Dynamically generates an execution plan
    • Selects and invokes tools (navigation, click, fill, etc)
    • Handles errors, retries, and context
    • Tracks cost and statistics
  • No static parsing: Every run is fully dynamic and AI-driven

πŸ–₯️ CLI Commands

Global Installation (Recommended)

# Install globally
npm install -g testgenius-ai

# Available commands
testgenius --help                    # Show all available commands
testgenius run                       # Run all tests in the project
testgenius run <test-file>           # Run a specific test file
testgenius list                      # List all available test files
testgenius report                    # Generate and open test reports
testgenius setup                     # Interactive setup wizard

Local Installation

# Install locally
npm install testgenius-ai

# Use with npx
npx testgenius run
npx testgenius list
npx testgenius report

Direct Node Usage

# Run specific test file
node tests/smart-ai-demo.js

# Use npm scripts
npm start                           # Run default test
npm run build                       # Build TypeScript
npm run watch                       # Watch mode for development

πŸ“¦ NPM Usage Examples

Quick Start Examples

# 1. Install and run in one go
npm install -g testgenius-ai && testgenius setup

# 2. Install locally and run with npx
npm install testgenius-ai
npx testgenius run tests/smart-ai-demo.js

# 3. Install as dev dependency
npm install --save-dev testgenius-ai

Project Integration Examples

# Add to existing project
npm install testgenius-ai

# Add to package.json scripts
{
  "scripts": {
    "test:ai": "testgenius run",
    "test:ai:demo": "testgenius run tests/smart-ai-demo.js",
    "test:ai:report": "testgenius report"
  }
}

# Run via npm scripts
npm run test:ai
npm run test:ai:demo
npm run test:ai:report

Development Examples

# Clone and develop
git clone https://github.com/hiroksarker/testgenius-ai.git
cd testgenius-ai
npm install
npm run build
npm start

# Watch mode for development
npm run watch

# Lint code
npm run lint

# Clean build
npm run clean && npm run build

CI/CD Integration Examples

# GitHub Actions example
- name: Install TestGenius AI
  run: npm install -g testgenius-ai

- name: Run AI Tests
  run: |
    export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
    testgenius run

# Docker example
FROM node:18
RUN npm install -g testgenius-ai
COPY . .
RUN testgenius run

πŸ“Š Reporting & Cost Tracking

  • HTML and Allure reports (with screenshots, step logs, and stats)
  • Real-time OpenAI token/cost tracking
  • Execution statistics: Success rate, tool usage, average response time

🧩 Configuration

Environment Setup

The framework uses environment variables for configuration. Copy env.example to .env and customize:

cp env.example .env

Required Variables:

  • OPENAI_API_KEY - Your OpenAI API key (required for AI functionality)

Optional Variables:

  • DEFAULT_BROWSER - Browser to use (chrome, firefox, edge)
  • DEFAULT_HEADLESS - Run in headless mode (true/false)
  • DEFAULT_TIMEOUT - Test operation timeout (milliseconds)
  • AI_MODEL - OpenAI model to use (default: gpt-4o)

Framework Configuration

Edit testgenius.config.js for browser, headless mode, timeouts, reporting, and more.


πŸ†˜ Troubleshooting

Common Issues

❌ "OpenAI API key not found"

  • Ensure .env file exists with OPENAI_API_KEY=your_key_here
  • Or set environment variable: export OPENAI_API_KEY=your_key_here
  • Get your API key from OpenAI Platform

❌ "WebDriverIO not found"

npm install webdriverio

❌ "Browser not launching"

  • Check browser installation (Chrome, Firefox, Edge)
  • Verify WebDriverIO configuration in testgenius.config.js

❌ "Tests failing with element not found"

  • Check if test site is accessible
  • Verify element selectors in test cases
  • Review browser console for JavaScript errors

Getting Help

  • See WIKI_HOME.md for detailed documentation
  • Check the project wiki for advanced guides

πŸ“š Resources


πŸ“ License

MIT


πŸš€ Get Started Now

# Quick start with npm
npm install -g testgenius-ai
testgenius setup
testgenius run

Ready to revolutionize your testing? Try Smart AI Testing Framework today!