Skip to content

nlovell1/smarttest-studio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartTest Studio

AI-powered Playwright test generator that analyzes web pages and produces executable test code.

TypeScript React Playwright

What It Does

Provide a URL, get back working Playwright tests. The system:

  1. Crawls the page with Playwright to extract forms, buttons, and inputs
  2. Sends page structure to GPT-4 to generate test scenarios
  3. Converts scenarios into executable Playwright TypeScript code
  4. Runs tests in Chromium and captures screenshots
  5. Returns results with generated code

Tech Stack

  • Frontend: React, TypeScript
  • Backend: Node.js, Express, TypeScript
  • Testing: Playwright
  • AI: OpenAI GPT-4

Quick Start

# Clone and install
git clone https://github.com/yourusername/smarttest-studio.git
cd smarttest-studio

# Backend
cd backend
npm install
npx playwright install chromium
cp .env.example .env
# Add OPENAI_API_KEY to .env

# Frontend
cd ../frontend
npm install

# Run (two terminals)
cd backend && npm run dev
cd frontend && npm start

Visit http://localhost:3000

Project Structure

smarttest-studio/
├── backend/
│   ├── src/
│   │   ├── routes/api.ts           # Express API
│   │   ├── services/
│   │   │   ├── crawler.ts          # Page analysis
│   │   │   ├── aiGenerator.ts      # GPT-4 integration
│   │   │   ├── codeGenerator.ts    # Code generation
│   │   │   └── testExecutor.ts     # Test execution
│   │   └── types/
│   └── package.json
└── frontend/
    ├── src/
    │   ├── components/              # React UI
    │   └── api/client.ts
    └── package.json

API

POST /api/test-generation-flow

// Request
{ "url": "https://example.com/login" }

// Response
{
  "pageAnalysis": { ... },
  "testScenarios": [ ... ],
  "playwrightCode": "import { test } from '@playwright/test'...",
  "results": { ... },
  "screenshots": [ ... ]
}

Example Output

Input: https://the-internet.herokuapp.com/login

Generated code:

import { test, expect } from '@playwright/test';

test('Valid login credentials', async ({ page }) => {
  await page.goto('https://the-internet.herokuapp.com/login');
  await page.fill('#username', 'tomsmith');
  await page.fill('#password', 'SuperSecretPassword!');
  await page.click('button[type="submit"]');
  await expect(page.locator('.flash.success')).toBeVisible();
});

Limitations

MVP scope:

  • Single-page analysis
  • No auth/persistence
  • Local execution only
  • Basic error handling

License

MIT

Note

Built for Stably AI application to demonstrate Playwright and LLM integration.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages