Operations 9 min read

The Third Way to Enable AI Automation in TestHub: Using Playwright MCP

This article walks through configuring TestHub to run AI‑driven UI tests with Playwright MCP, covering version‑management workflow, adding the MCP server, setting up a multimodal large model, installing the Playwright browsers (including proxy settings for China), and executing a complete AI‑generated test case that creates and verifies a new version entry.

Advanced AI Application Practice
Advanced AI Application Practice
Advanced AI Application Practice
The Third Way to Enable AI Automation in TestHub: Using Playwright MCP

Business Background

The author uses the open‑source TestHub as the system under test and demonstrates automating the "add version" feature. The manual process involves eight steps: opening the URL, logging in, navigating to the AI case generation module, opening version management, clicking "new version", filling in name, project, description, saving, and verifying the entry.

TestHub Configuration

1. Add Playwright MCP

TestHub Planet edition includes Playwright MCP; it can be added with a single click in the Home → Configuration Center → MCP Server Configuration.

2. Configure the Quality Digital Human

In the Configuration Center → Quality Digital Human page, a multimodal large model is required for screenshot and OCR tasks. The author uses Kimi‑K2.6, noting satisfactory results.

3. Install Playwright Browsers

If the browsers are not yet installed, run: playwright install chromium Because Playwright pulls binaries from overseas CDNs, downloads may time out in China. The author suggests using a proxy tool or configuring a domestic mirror (e.g., npmmirror). Example commands:

set PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright</code><code>playwright install chromium

For PowerShell:

$env:PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright"</code><code>playwright install chromium

For Linux/macOS:

export PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright</code><code>playwright install chromium

Before installing, clear any failed caches:

Windows: rmdir /s /q "%LOCALAPPDATA%\ms-playwright" macOS/Linux: rm -rf ~/.cache/ms-playwright Verify installation by checking the version output, e.g., playwright build v1148, or by running a simple script.

To install only Chromium and skip Firefox/WebKit, add the chromium argument.

TestHub Hermes AI Test Practice

1. Check WebSocket Connection

Ensure the WS connection is active before starting a task; if disconnected, use the diagnostic tool in the top‑right corner to clear cache, restart the session, or reconnect.

2. AI Test Execution

With the environment ready, the user sends a natural‑language prompt to Hermes. The author provides a concrete prompt that instructs Playwright MCP to:

Use Playwright MCP tool to complete the following test tasks:</code><code>1. Open http://localhost:3000/ and log in with testadmin / admin123456;</code><code>2. Open the "AI case generation" page and switch to the new tab;</code><code>3. Enter version management and click "New Version";</code><code>4. Fill in the dialog: version name "V8.0" + timestamp, select the first project, description "This is the TestHub Hermes version description";</code><code>5. Click "Save";</code><code>6. Verify the first entry in the version list matches the new version.

Hermes processes the task by analyzing the request, locating the required skill, loading the skill definition, invoking the multimodal model, controlling the browser, taking page snapshots to locate elements, and finally generating a test summary report.

Key Observations

Use concise, clear natural‑language steps that mirror manual actions.

Include unique version identifiers (e.g., V8.0 + timestamp) to aid verification.

Ensure WS connectivity, Playwright MCP, and the chosen multimodal model are prepared.

Conclusion

The essential points for successful AI‑driven TestHub automation are: (1) verify WS connection and set up Playwright MCP and browsers; (2) select a capable multimodal large model; (3) craft prompt steps that exactly match manual operations, keeping them brief and unambiguous.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

MCPHermesUI testingPlaywrightAI automationTestHub
Advanced AI Application Practice
Written by

Advanced AI Application Practice

Advanced AI Application Practice

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.