Skip to main content

playwright-dotnet-refactor

Refactor generated Playwright .NET test drafts into readable xUnit tests with role-based locators, intent-based assertions, and minimal helper extraction. Use when a generated Playwright test is noisy, brittle, or hard to maintain and needs cleanup without changing user intent.

소스 정보

저장소
NimblePros/eShopOnWeb
최근 소스 활동
2026년 7월 9일 22:17
감지된 SKILL.md 언어
영어
스타
633
포크
294

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
2 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
playwright-dotnet-refactor
description
Refactor generated Playwright .NET test drafts into readable xUnit tests with role-based locators, intent-based assertions, and minimal helper extraction. Use when a generated Playwright test is noisy, brittle, or hard to maintain and needs cleanup without changing user intent.
metadata
{"author":"nimblepros","version":"1.0","spec":"agentskills.io"}
# Playwright .NET Refactor Skill ## Purpose Turn generated Playwright .NET test code into maintainable xUnit tests while preserving the original user journey and intent. ## Use This Skill When - You have generated Playwright C# code from codegen and want production-quality tests. - Selectors are brittle (CSS-heavy, position-dependent, implementation-coupled). - Assertions are missing, weak, or coupled to internals instead of user-visible outcomes. - Test flow is hard to read and would benefit from light structure. ## Inputs To Gather Before Refactor 1. Raw generated Playwright C# test draft. 2. Intended user scenario in one sentence. 3. Target location for test (file/class name). 4. Existing fixture and conventions in the repo (for this repo, prefer xUnit and BrowserFixture patterns). 5. Any known app constraints (auth state, seed data, environment, flaky selectors). ## Refactor Rules 1. Preserve user intent. - Keep the same user-visible workflow and expected behavior. - Do not silently add or remove meaningful scenario steps. 2. Prefer role-based locators. - Prioritize GetByRole, then GetByLabel/GetByPlaceholder, then GetByText, then GetByTestId. - Avoid brittle CSS/XPath selectors unless no better semantic locator exists. 3. Produce readable xUnit tests. - Use clear test names describing behavior and expected outcome. - Keep Arrange/Act/Assert intent obvious through structure and naming. - Minimize incidental complexity in the main test body. 4. Extract helpers only when readability improves. - Extract repeated or noisy interaction sequences. - Keep helpers small and intention-revealing. - Do not introduce abstractions that hide simple steps. 5. Avoid implementation-detail assertions. - Assert only user-observable behavior (visible text, accessible state, navigation outcome, enabled/disabled controls, etc.). - Do not assert internal IDs, hidden DOM structure, CSS class internals, or framework-specific plumbing unless user-visible behavior depends on them. 6. Keep tests deterministic. - Prefer Playwright assertions and explicit waits tied to user-visible conditions. - Avoid arbitrary sleeps. ## Output Contract Return: 1. Refactored C# xUnit test code. 2. Optional helper/page object code only if it materially improves readability. 3. Short rationale list covering: - Locator improvements made. - Assertion improvements made. - Helper extraction decisions. - Any uncertainty or assumptions. ## Quality Gate Checklist - User intent preserved. - Locators are semantic and stable. - Assertions are user-observable. - Test reads clearly top-to-bottom. - No unnecessary abstraction introduced. - No arbitrary waits or timing hacks. ## Prompt Starter Use [assets/refactor-prompt-template.md](assets/refactor-prompt-template.md) as the reusable Level 2 prompt.
GitHub에서 보기