For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /index.md.
  • English
  • Use the UI like a user
    Vision-driven E2E testing in natural language

    A GUI Agent and E2E testing framework for web, mobile, and desktop.

    15k+Github Stars
    MITFully open source
    #2No.2 in Github trending

    Back to the essence of E2E testing with vision

    E2E testing should verify the interface, not its code structure. Tests tied to UI code structure are inherently fragile — and even more importantly, they cannot tell whether a user can actually understand and use the interface, or whether the UI conveys the right information.

    In the AI-native era, vision models give us the ability to test closer to the essence of E2E — looking at the screen to act and judge like a user. With accuracy and cost now in balance, the next stage of E2E testing is already here.

    Describe steps and expectations in natural language

    Describe what a user wants to do and what they should see. Express the same intent in YAML with Midscene Test, or in your existing JavaScript tests.

    YAML · @midscene/test
    Rstest + JavaScript
    Vitest + JavaScript
    beforeEach:
      - gotoUrl: https://your-shop.example
    
    cases:
      - name: "Find headphones under $100"
        steps:
          - aiAct: "Search for headphones and filter the results to prices under $100"
          - aiWaitFor: "The filtered search results are visible"
          - aiAssert: "There are products in the search results, and each costs less than $100"

    A GUI Agent built for vision-driven testing

    If you already have a test suite, Midscene’s GUI Agent brings visual actions and assertions directly into it. We recommend Playwright Test for web apps and Rstest or Vitest for mobile and desktop apps.

    Operate and verify by vision alone

    Midscene reads screenshots rather than code, testing the interface the way a user uses it.

    1. PlanRead screenshots and decide the next step
    2. Locate & ActLocate targets on screen and perform the UI action
    3. VerifyAssert on what users actually see
    See real-world examples
    your-shop.example01 · Plan
    < $100
    $79
    $89

    One API, across platforms

    Visual localization does not depend on the UI rendering stack or code structure, so the same API works on web, mobile, desktop, and canvas-based interfaces.

    Model options and cost

    Pure vision testing avoids sending large DOM trees to the model. With today’s vision models, accuracy and API cost reach a practical balance for E2E testing.

    Benchmarks

    Midscene Test: what an E2E framework looks like when tests are pure intent

    Through extensive practice, we found that once vision models handle UI interaction and verification, what remains in a test case is pure intent. At that point, traditional test frameworks built around hand-coded locators and page objects become unnecessary overhead.

    Midscene Test (@midscene/test) starts from that premise to rethink what an AI-native E2E framework should optimize for: expressing test cases as pure intent, encapsulating deterministic business operations as reusable capabilities, and letting engineers and AI agents maintain the same test suite together. Get started with Midscene Test

    Interactive and business operations in one YAML file

    Each YAML step calls a Node: an AI, platform, or custom business operation. Compose them into a test case.

    cases/refund.yaml
    beforeEach:  - order.prepare: { status: paid }Business  - gotoUrl: ${shopUrl}/orders/latestBusinesscases:  - name: A paid order supports a full refund    steps:      - aiAct: Apply for a full refund and submitInteractive      - aiAssert: The page shows that the refund was submittedInteractive      - order.checkRefund: { status: refunding }BusinessafterEach:  - clearCookies: {}Business

    Separate intent from business logic, maintained by people and AI

    Wrap reusable business logic in custom Nodes. Midscene Test generates a Markdown Node Spec listing every Node and its inputs, so QA engineers and AI agents can write cases without reading TypeScript. Learn how to develop custom Nodes

    1. nodes/order.ts
      defineNode({
        name: 'order.prepare',
        description: "Create a test order",
        inputSchema: z.strictObject({
          status: z.literal('paid'),
        }),
        async execute({ input }) {
          await orders.create(input);
        },
      });
    2. midscene-node-spec.md
      ### order.prepare
      Create a test order
      - status: "paid"
    3. case.yaml
      steps:
        - order.prepare:
            status: paid

    Replay every action in visual reports

    Every run generates an interactive HTML report. Inspect the full lifecycle step tree, drill into each Agent step’s Plan, Locate, and action timings, and scrub through the screenshot timeline to replay exactly what happened on screen. Explore reporting

    Midscene.js/Overview/PassedFind headphones under $100
    10.6s28.5K tokensVisualYAML
    #3aiActPassed

    Type "headphones" in the search box and click Search

    ExecutionTime
    Plan1.82s
    Locate0.42s
    Input0.96s
    Tap0.55s
    Elapsed3.75s
    Model2.24s
    RecordPlan · 1.82s
    2s
    4s
    6s
    8s
    Midscene Shop
    Ready to search
    Wireless Headphones$89
    Add to cart

    Engineering foundation built for visual agents

    Midscene Test ships with the runtime and CI capabilities needed to run visual agents reliably at scale: multi-project orchestration, isolated concurrency, guaranteed teardown, GitHub Actions integration, and machine-readable outputs.

    Who is using Midscene

    Next steps

    To let AI coding agents operate your UI, explore Midscene Skills.