Token导航 LogoToken导航TokenDH.com
playwright MCP work logo
开发工具未说明官方级别未说明来源级核验

playwright MCP work

MCP Server

使用Playwright构建的自动化UI测试工具,用于探索和验证公共网站(如Flipkart、YouTube、IMDb、DemoQA)的关键用户流程。测试使用可访问性优先的定位器、弹性回退和Playwright跟踪功能进行可靠的调试。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
调试工具TypeScript浏览器自动化

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

rohitsharma007

提供方

rohitsharma007

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

PMCP Playwright Project

Automated UI tests built with Playwright (TypeScript) to explore and validate key user flows across public sites (e.g., Flipkart, YouTube, IMDb, DemoQA). Tests use accessibility-first locators, resilient fallbacks, and Playwright tracing for reliable debugging.

Repository Structure

  • .github/

- generate_tests.prompt.md — guidance to consistently generate tests: navigate, explore key functionality, implement a Playwright TypeScript test, run with trace, iterate until passing.

  • .vscode/

- mcp.json, settings.json — editor configuration and integration settings.

  • docs/

- testing-guardrails.md — standard operating procedures, locator strategies, overlay handling, and running/trace review commands.

  • tests/

- flipkart-home.spec.ts — homepage smoke test for Flipkart; validates core structure and linked tiles. Planned to align with guardrails. - flipkart-search.spec.ts — Flipkart search flow; dismisses overlay, finds search box via guardrails, asserts results and product tiles. Passing with trace. - imdb-search.spec.ts — IMDb search flow (pattern similar to other search tests). - popular-flow.spec.ts — Example of a broader user journey or combined smoke checks (site-specific). - smoke-home.spec.ts — Generic homepage smoke test example (validate landmarks/tiles). - youtube-search.spec.ts — YouTube search flow (pattern similar to Flipkart/IMDb). - _template.spec.ts — reusable template showing how to apply guardrails in a basic search test; copy and adapt per site. - fixtures/ - sample.txt — sample fixture file for tests that read from disk. - utils/guardrails.ts — shared helpers: - dismissOverlays(page) — closes known modal overlays and backdrops. - searchInput(page) — resilient search locator (role → placeholder → generic input). - assertCoreStructure(page) — verifies visible header, main, footer, or #container.

  • test-results/

- Per-test run artifacts; folders include screenshots, videos, and trace.zip archives. - .last-run.json — metadata for the most recent test execution.

  • playwright.config.ts — Playwright configuration (project settings, reporter/timeouts, etc.).
  • package.json / package-lock.json — dependencies and scripts.

How Files Connect (End-to-End Flow)

  • Authoring:

- Use .github/generate_tests.prompt.md as the checklist to create new tests. - Start from tests/_template.spec.ts to quickly scaffold a new spec. - Import guardrails from tests/utils/guardrails.ts to standardize overlay handling, core structure assertions, and resilient locators.

  • Execution:

- Run tests via npx playwright test and enable tracing for debugging. - Tests produce artifacts under test-results/ with a trace.zip for each run.

  • Debugging:

- Open traces using npx playwright show-trace --port . - Inspect actions, assertions, DOM snapshots; iterate on selectors based on evidence.

  • Configuration:

- playwright.config.ts applies global settings (e.g., projects/browsers, timeouts, reporter). CLI flags like --headed and --trace=on complement the config.

Standard Testing Flow (SOP)

  1. Navigate and explore the target site in a headed browser.
  2. Close overlays and confirm a single key functionality (e.g., search, product tiles).
  3. Close exploration, implement a focused Playwright test in tests/ using TypeScript.
  4. Prefer getByRole/getByLabel/getByPlaceholder; rely on Playwright auto-waiting.
  5. Run with --trace=on; iterate until the test passes.
  6. Review the trace to validate actions and DOM; adjust selectors if needed.

Commands

  • Run a specific test headed with trace:

- npx playwright test tests/flipkart-search.spec.ts --headed --trace=on

  • Run all tests:

- npx playwright test

  • Open a trace:

- npx playwright show-trace test-results//trace.zip --port 9360

Adding New Tests

  • Copy tests/_template.spec.ts and adapt the URL and flow.
  • Import and call dismissOverlays(page), assertCoreStructure(page), and searchInput(page).
  • Focus on one meaningful assertion of the flow’s success (e.g., URL change, visible results/tiles).

Conventions

  • Keep tests small, descriptive, and site-focused.
  • Use accessibility-first selectors with resilient fallbacks.
  • Avoid arbitrary timeouts; leverage Playwright’s auto-wait.
  • Validate navigation via expect(page).toHaveURL(...) and core structure visibility.

Notes on Current Tests

  • flipkart-search.spec.ts passes and includes a trace.zip under test-results/flipkart-search-Flipkart-s-3b9bc-hes-and-shows-product-tiles-chromium/.
  • flipkart-home.spec.ts can be refactored to use guardrails.ts for robustness (overlay dismissal and improved search locator).

This README serves as the central reference for how the project’s folders, files, and execution flow connect. Use the guardrails to keep new tests consistent, resilient, and easy to debug with Playwright traces.

Local Setup

  • Prerequisites: Node.js 18+, npm 9+, Git
  • Clone the repo: git clone https://github.com/rohitsharma007/playwright_mcp_work.git
  • Change directory: cd playwright_mcp_work
  • Install dependencies: npm install
  • Install Playwright browsers: npx playwright install
  • Start MCP server (IDE integration): npm run mcp (manual: npx @playwright/mcp@latest)
  • Run all tests: npx playwright test
  • Run a specific test headed with trace: npx playwright test tests/flipkart-search.spec.ts --headed --trace=on
  • Open a trace viewer: npx playwright show-trace test-results//trace.zip --port 9362
  • Generate selectors interactively (optional): npx playwright codegen https://www.flipkart.com/

Common Troubleshooting

  • Overlays blocking interactions: use dismissOverlays(page) helper in tests; in exploration, press Escape or close .
  • Selector stability: prefer getByRole, getByLabel, getByPlaceholder; avoid strict href matching.
  • Slow loads: do not add timeouts; rely on Playwright’s auto-waiting with correct locators and expect assertions.

目录标签

目录标签

调试工具TypeScript浏览器自动化UI测试本地部署自动化测试Playwright可访问性测试

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP