본문으로 건너뛰기
cccskills
무료GitHub에 공개

recording-browser-flow-as-test

Execute a user flow step-by-step in Cursor's built-in browser while documenting each action, then emit a Playwright test that replays the same flow using stable selectors derived from the accessibility tree.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Playwright
설치 방법 보기

포함된 파일(1)

  • SKILL.md3.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Recording Browser Flow as Playwright Test

Use the browser MCP as a recorder: every navigation, click, fill, and keypress becomes a row in a script. The agent then translates that trace into a Playwright test file in the repo (or a snippet to paste into an existing spec).

This is Cursor-native because it combines browser_snapshot (refs + roles + names) with structured actions — not a separate recorder extension.

Prerequisites

  • Target app reachable (e.g. dev server running); use finding-dev-server-url if needed.
  • Repo has or will have Playwright installed (@playwright/test). If not, add it with adding-e2e-tests or the project’s standard setup.

Recording workflow

1. Define the flow

One sentence scope, e.g. “Log in, open Settings, toggle dark mode, save.”

2. For each step, in order

  1. browser_snapshot — get the accessibility tree and element refs.

  2. Choose the smallest interaction:

    • browser_click with ref from snapshot (not coordinate clicks unless required).
    • browser_fill or browser_type for inputs.
    • browser_select_option for selects.
    • browser_navigate for full URL changes.
  3. Log the step in a structured list the main agent keeps:

    • Step number
    • Action verb (navigate, click, fill, press, select)
    • Locator strategy for Playwright — prefer:
      • getByRole('button', { name: '...' })
      • getByLabel('...')
      • getByPlaceholder('...')
      • getByTestId('...') if the app uses test IDs
    • Value (for fills), URL (for navigates)
    • Optional: short assertion (“expect URL to contain /settings”)
  4. After actions that change the DOM or navigate, take a new browser_snapshot before the next interaction.

  5. If the flow must wait for async content, use browser_wait_for or short incremental waits per cursor-ide-browser guidance — then snapshot again.

3. Add assertions

From the final snapshot and URL, add at least:

  • expect(page).toHaveURL(...) or URL fragment check
  • One visible outcome: text, role, or test id

4. Generate Playwright output

Emit a test file, e.g. tests/recorded/<flow-name>.spec.ts, containing:

  • test.describe and test('...', async ({ page }) => { ... })
  • Steps as await page.goto(...), await page.getByRole(...).click(), etc.
  • No raw snapshot refs in the final file — they are session-specific.

5. Run and harden

npx playwright test tests/recorded/<flow-name>.spec.ts

Fix flakiness: prefer expect(locator).toBeVisible() before clicks, use toPass() retries for async lists, avoid arbitrary waitForTimeout except as last resort.

Tips

  • Stable selectors: roles and accessible names beat CSS from devtools. Add data-testid in app code if names are ambiguous.
  • Auth: if the flow needs login, use env vars for test credentials or Playwright storageState — never commit secrets.
  • Parallel runs: ensure test data does not collide with other tests.

When not to use

  • Flows that require manual 2FA, captchas, or email links — stop and ask the user for a test bypass or mock.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use Cursor's browser aria snapshots to audit a page for accessibility issues — missing labels, broken tab order, contrast, and ARIA misuse.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

0xAidan/polymarket-bot-test42026년 9월 4일 업데이트

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

0xAidan/polymarket-bot-test42026년 9월 4일 업데이트

Generate OpenAPI/Swagger documentation for an API, including endpoint schemas, request/response types, and interactive docs UI.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

0xAidan/polymarket-bot-test42026년 9월 4일 업데이트

Add authentication to a web application using NextAuth.js (Auth.js), including OAuth providers, session management, and protected routes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

0xAidan/polymarket-bot-test42026년 9월 4일 업데이트

Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

0xAidan/polymarket-bot-test42026년 9월 4일 업데이트

Set up Playwright end-to-end testing in a project, including test configuration, example tests, and CI integration.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

0xAidan/polymarket-bot-test42026년 9월 4일 업데이트

0xAidan의 스킬 모두 보기

이 스킬의 문제 신고