Skip to main content

A deterministic UI mutation testing engine for Playwright

Project description

Project Vandal: UI Mutation Testing Engine

Project Vandal CI

Project Vandal is a lightweight, non-LLM UI mutation testing engine integrated with Playwright. It allows you to sabotage your UI in subtle ways to verify if your end-to-end tests are resilient and capable of detecting regressions.

Features

  • Mutation Strategies:
    • stealth_disable: Disables pointer events on elements, making them unclickable while remaining visually present.
    • ghost_element: Makes elements invisible and unclickable.
    • data_sabotage: Replaces text or input values with junk data.
    • logic_sabotage: Prevents event propagation (e.g., stopping click handlers from firing).
  • Playwright Integration: Easy-to-use context manager (Vandal) for wrapping test logic.
  • Reporting: Automated mutation report showing which "mutants" were killed (detected by tests) or survived.
  • Detailed Guide: See TESTER_GUIDE.md for advanced usage and customization.

Project Structure

  • core.py: The heart of the mutation engine (JavaScript-based strategies).
  • playwright_ext.py: Playwright wrapper and context manager.
  • demo_vandal.py: A demonstration script showing Vandal in action.
  • vandal_demo_app.html: A simple demo application for testing.

Installation

Ensure you have Playwright installed:

# Clone the repository
git clone https://github.com/godhiraj-code/vandal.git
cd vandal

# Install dependencies
pip install playwright
playwright install chromium

Usage

You can use the Vandal class as a context manager in your Playwright tests:

from vandal import Vandal

async with Vandal(page) as v:
    # Aply a mutation to an element
    await v.apply_mutation("stealth_disable", "#login-btn")
    
    # Run your test logic
    await page.click("#login-btn")
    
    # Assert the outcome
    assert await page.inner_text("#msg") == "Success"

Running the Demo

The project includes a demo script that tests a simple login button.

Headless Mode

PYTHONPATH="." python demo_vandal.py --headless
PYTHONPATH="." python demo_vandal.py --headed

In headed mode, the script includes a slow_mo delay and holds the browser open for 5 seconds after completion so you can see the results.

Why "Vandal"?

Unlike traditional mutation testing that modifies source code, Project Vandal sabotages the UI layer directly in the browser. This is particularly effective for catching:

[!NOTE] Project Vandal is an open-source research initiative by Dhiraj Das | Automation Architect.

  • CSS regressions that block interactions.
  • Event listener bugs.
  • Data binding failures.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

project_vandal-0.2.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

project_vandal-0.2.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file project_vandal-0.2.0.tar.gz.

File metadata

  • Download URL: project_vandal-0.2.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for project_vandal-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e00628c81ec1cc48cd563dc65cb1a4933f3e97f1ca417a4b5c1bfe43c3c5d647
MD5 b1dd61d89e5d378e6fb01b489f7efca7
BLAKE2b-256 bb9ed581c1135e0b850399f0ded05a8218cbe3fbb27bac591c5a2fcd595a102c

See more details on using hashes here.

File details

Details for the file project_vandal-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: project_vandal-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for project_vandal-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbf076aaafb48b7e1889c65c1f8fc1ec9e54b23102cb9ac250e325674c01fcec
MD5 9656ae52d092f4c0eb7b78b1a98d416c
BLAKE2b-256 7ffcff8548fe73304351dbbac9f8c535908ef60f8cb98e3b7384fa04e88818a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page