Operations 13 min read

How to Set Up a Cursor + Playwright Automation Testing Environment

This step‑by‑step guide shows how to install Cursor and Playwright‑MCP, configure the MCP server (including Windows path fixes), generate a test plan from CSV files, run automated tests with Playwright, and produce a detailed test report with screenshots and issue analysis.

Xiaolong Cloud Tech Team
Xiaolong Cloud Tech Team
Xiaolong Cloud Tech Team
How to Set Up a Cursor + Playwright Automation Testing Environment

1. Install Cursor and Playwright‑MCP

Use npm install -g @playwright/mcp@latest and npm install -g playwright@latest to install the latest MCP and Playwright packages globally, then run npx playwright install --with-deps to download the required browsers.

2. Configure Cursor

Open Cursor, click the gear icon, locate the “MCP” option, and add a new MCP server configuration with the following JSON:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}

On Windows, the MCP server may fail to start unless the npm package directory is added to the system PATH and the command is wrapped with cmd /c:

{
  "mcpServers": {
    "playwright": {
      "command": "cmd /c npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}
Cursor MCP configuration UI
Cursor MCP configuration UI

3. Prepare Test Cases

Place all test‑case files (Excel, JSON, XML, CSV, etc.) in the project root. With Cursor 1.7’s plan mode, the tool asks clarification questions and then generates a complete test plan based on the CSV data.

Plan mode generating test plan
Plan mode generating test plan

4. Execute Automated Tests

After reviewing the generated Markdown test plan, run the build operation. Cursor’s Agent mode launches Playwright’s built‑in Chromium, navigates to the local URL, and executes each step automatically. The whole process finishes in about 20 minutes, far quicker than the estimated 4–5 hours.

Automated test execution in Cursor
Automated test execution in Cursor

5. Review Test Report

The generated report (saved as /xxxxx/系统管理测试报告.md) includes test overview, scope, result statistics, detailed step results, screenshots, and identified issues. Example statistics:

| Module | Cases | Passed | Failed | Blocked | Pass Rate |
|--------|-------|--------|--------|---------|-----------|
| Department Management | 2 | 2 | 0 | 0 | 100% |
| User Management | 1 | 1 | 0 | 0 | 100% |
| **Total** | **3** | **3** | **0** | **0** | **100%** |

Key test steps (e.g., adding a department, linking users, assigning departments) are documented with screenshots and validation results, all marked as passed.

Test report excerpt
Test report excerpt

6. Issues and Recommendations

Two minor issues were observed:

Intermittent “to‑do” pop‑up blocks actions – resolved by pressing ESC. Suggested improvement: refine modal layering.

Element click timeouts – mitigated with JavaScript clicks. Suggested improvement: enhance element locating and click reliability.

Additional suggestions include batch operations for the “link user” feature and permission controls for “assign department”.

7. Environment Details

Browser: Chromium (Playwright)

Resolution: 1280×720

Tool: Playwright MCP

Screenshot folder:

/Users/fits-vue/Documents/康复系统/FitsAdmin_RTMS/test-screenshots/
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.

MCPNode.jsCICursorautomation testingPlaywrightTest Plan
Xiaolong Cloud Tech Team
Written by

Xiaolong Cloud Tech Team

Xiaolong Cloud Tech Team

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.