Metadata-Version: 2.4
Name: qamigrate
Version: 0.1.0
Summary: AI-powered Selenium to Playwright migration tool
Project-URL: Homepage, https://github.com/qamigrate/qamigrate
Project-URL: Documentation, https://qamigrate.dev/docs
Project-URL: Repository, https://github.com/qamigrate/qamigrate
Author: QAMigrate Team
License: MIT
Keywords: ai,automation,migration,playwright,selenium,testing
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Requires-Dist: anthropic>=0.40.0
Requires-Dist: email-validator>=2.0.0
Requires-Dist: fastapi>=0.115.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic-settings>=2.5.0
Requires-Dist: pydantic>=2.9.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: rich>=13.9.0
Requires-Dist: structlog>=24.4.0
Requires-Dist: tree-sitter-java>=0.23.0
Requires-Dist: tree-sitter>=0.23.0
Requires-Dist: typer[all]>=0.12.0
Requires-Dist: uvicorn[standard]>=0.32.0
Requires-Dist: websockets>=13.0
Provides-Extra: dev
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest>=8.3.0; extra == 'dev'
Requires-Dist: ruff>=0.7.0; extra == 'dev'
Provides-Extra: visual
Requires-Dist: docker>=7.1.0; extra == 'visual'
Requires-Dist: imagehash>=4.3.0; extra == 'visual'
Requires-Dist: numpy>=2.0.0; extra == 'visual'
Requires-Dist: openai>=1.50.0; extra == 'visual'
Requires-Dist: opencv-python>=4.10.0; extra == 'visual'
Requires-Dist: pillow>=10.4.0; extra == 'visual'
Description-Content-Type: text/markdown

# QAMigrate

> AI-powered test framework migration

[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A [QATonic Innovations](https://github.com/QATonic) product.

---

QAMigrate converts test suites between frameworks automatically. It parses your code with Tree-sitter, generates equivalent code with Claude, and validates the output with the target language's compiler.

**Today:** Selenium Java -> Playwright Java
**Next:** Cypress -> Playwright, TestNG -> JUnit 5, RestAssured -> Karate, and more.

## What it does

Give it a Selenium file:

```java
// Selenium
@FindBy(id = "username")
private WebElement usernameInput;

public void login(String user, String pass) {
    usernameInput.clear();
    usernameInput.sendKeys(user);
    passwordInput.sendKeys(pass);
    wait.until(ExpectedConditions.elementToBeClickable(loginButton));
    loginButton.click();
}
```

Get Playwright back:

```java
// Playwright (generated by QAMigrate)
private final Locator usernameInput;

public LoginPage(Page page) {
    this.usernameInput = page.locator("#username");
}

public void login(String user, String pass) {
    usernameInput.fill(user);
    passwordInput.fill(pass);
    loginButton.click(); // Playwright auto-waits
}
```

## Supported patterns

- `@FindBy` annotations (id, css, xpath, className, name, linkText)
- `PageFactory.initElements` removal
- `WebDriverWait` / `ExpectedConditions` removal (Playwright auto-waits)
- `sendKeys` -> `fill`, `clear` removal, `click` direct conversion
- `Actions` (hover, drag) -> Playwright equivalents
- `Select` dropdowns -> `selectOption`
- `JavascriptExecutor` -> `page.evaluate()`
- Alert/iframe handling
- File uploads -> `setInputFiles`
- TestNG -> JUnit 5 lifecycle (`@BeforeMethod` -> `@BeforeEach`, etc.)
- `@DataProvider` -> `@MethodSource`
- `Assert.assertEquals/assertTrue` -> Playwright assertions
- `ChromeDriver` setup -> `Playwright.create()` + `browser.newContext()`
- Base class inheritance preservation

## Quick start

### Prerequisites

- Python 3.11+
- Java 17+ (for compilation validation)
- [Anthropic API key](https://console.anthropic.com/settings/keys)

### Install

```bash
pip install qamigrate
```

Or from source:

```bash
git clone https://github.com/qamigrate/qamigrate.git
cd qamigrate
pip install -e .
```

### Configure

```bash
# Set your API key
echo "ANTHROPIC_API_KEY=sk-ant-your-key" > .env

# Or export directly
export ANTHROPIC_API_KEY="sk-ant-your-key"
```

### Migrate

```bash
# Initialize in your Selenium project
qamigrate init --project ./my-selenium-project

# Scan to see what patterns are detected
qamigrate scan --project ./my-selenium-project

# Migrate a single file
qamigrate migrate LoginPage.java --project ./my-selenium-project

# Migrate everything
qamigrate migrate --all --project ./my-selenium-project
```

Output goes to a `playwright/` subdirectory next to each original file.

## CLI commands

| Command | Description |
|---------|-------------|
| `qamigrate init` | Initialize QAMigrate in a Selenium project |
| `qamigrate scan` | Analyze codebase, detect patterns, show complexity |
| `qamigrate migrate` | Convert files to Playwright |
| `qamigrate dashboard` | Launch the web UI |
| `qamigrate export` | Export migration results as ZIP or report |

## How it works

```
Scanner (Tree-sitter)     Deterministic AST parsing, 70+ pattern detection
       |
Coder (Claude API)        Generates Playwright Java via structured output
       |
Compiler (javac)          Validates generated code compiles
       |
Fixer (rules + Claude)    Fixes compilation errors, retries up to 3x
       |
Output                    Clean Playwright Java file
```

No frameworks, no LangChain -- just a plain Python pipeline calling each step in sequence.

## Configuration

Create `qamigrate.yaml` in your project root (or run `qamigrate init`):

```yaml
coder:
  model: "claude-sonnet-4-20250514"
  max_tokens: 8192

compiler:
  build_tool: "maven"    # or "gradle"
  java_version: "17"
  skip: false            # set true if Playwright JARs not available locally

supervisor:
  max_retries: 3
```

## Development

```bash
# Install dev dependencies
pip install -e ".[dev]"

# Run linter
ruff check src tests

# Run tests
pytest tests -v
```

## License

MIT
