maaend-test-image

Redact and import game screenshots into MaaEnd node recognition test sets.

3.7k|317|Updated Mar 18, 2022
One-click install
npx skills add https://github.com/MaaEnd/MaaEnd --skill maaend-test-image
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maaend-test-image
Source: https://github.com/MaaEnd/MaaEnd/tree/main/.agents/skills/maaend-test-image
Command: npx skills add https://github.com/MaaEnd/MaaEnd --skill maaend-test-image

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires maafw, numpy, opencv-python-headless, pillow, and includes scripts (resource) components.

What problem does it solve?

Adding raw game screenshots to the MaaEnd node recognition test suite risks leaking private information like UIDs and nicknames, and requires correctly wiring images into the tests/MaaEndTestset submodule and test_*.json case files. This Skill automates redaction, placement, test definition, and validation so no unredacted original ever enters the repository.

Core Features & Use Cases

  • Privacy Redaction: Covers fixed ADB/Win32 ROIs with pure green, runs the bundled MaaEnd OCR model to detect UID/# regions, and supports extra custom ROIs for anything OCR misses.
  • Test Case Authoring: Guides correct controller/resource paths, image naming with explicit .png, hits arrays (including per-controller box values and empty-array negative cases), and JSONC formatting conventions.
  • Validation & Submodule Commits: Runs pnpm check and pnpm test, inspects error_details.json, and commits images to the tests/MaaEndTestset submodule on main before updating the parent repo pointer.
  • Use Case: A contributor has a 1280x720 ADB screenshot for the delivery task transfer flow. The Skill redacts the UID, writes it to tests/MaaEndTestset/ADB/Official_CN/, adds a case with hits ["DeliveryJobsConfirmTaskTransfer"] to the matching test JSON, and verifies everything passes.

Quick Start

Add the screenshot at C:\Screenshots\confirm.png to the ADB Official_CN test set as a redacted image named delivery_confirm.png with expected hit DeliveryJobsConfirmTaskTransfer, then run pnpm check and pnpm test.

Frequently Asked Questions about maaend-test-image

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a test screenshot to the MaaEnd test set?

Run the redact_test_image.py script with the raw screenshot path and a destination under tests/MaaEndTestset/<controller>/<resource>/. Then add a case with the .png filename and expected hits to the matching test_*.json file, and run pnpm check and pnpm test.

How do I redact UID from game screenshots before committing?

The script automatically fills fixed ADB or Win32 ROIs with pure green and uses the repository's bundled OCR model to find regions containing UID or # markers. You can pass additional --extra-roi x,y,w,h arguments for anything OCR misses, then visually verify the final image.

What screenshot resolution does MaaEnd node testing require?

Screenshots must be exactly 1280x720 pixels. The script rejects any other resolution and also validates that all redaction ROIs stay within image bounds before writing the output PNG.

How do I write a negative test case for node recognition?

Set the hits field to an empty array in the test case JSON. The image field must still reference an actual redacted PNG file by name with the .png extension and no directory separators.

Why does pnpm test fail after adding a new test image?

Failures come from wrong image paths or controller/resource matrix mismatches, hits that do not match the actual screen content, or genuine node recognition failures. Check tests/maatools/error_details.json and confirm the image exists for every controller and resource combination.

Can I use this redaction script for PlayCover screenshots?

No. The fixed redaction ROIs are only calibrated for ADB and Win32 controllers. For PlayCover or new resolutions without reliable masking coordinates, confirm the redaction rules first rather than reusing other platforms' coordinates.