본문으로 건너뛰기
Skillpedia
테스트40k · #7157

cypress-flake-fixer

하는 일

이 AI 에이전트는 Cypress 자동화 소프트웨어 테스트의 문제를 찾아 고치는 데 도움을 줍니다. 간헐적 실패를 일으키는 코드 패턴을 찾아 수정 방법을 제안합니다.

사용하는 경우

  • ✓테스트가 가끔 실패하지만 항상 그렇지는 않을 때.
  • ✓테스트가 내 컴퓨터에서는 통과하지만 다른 환경(지속적 통합 같은)에서는 실패할 때.
  • ✓Cypress를 최신 버전으로 업데이트하면서 기존 테스트가 여전히 작동하는지 확인하고 싶을 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/cypress-flake-fixer/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/cypress-flake-fixer/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 Cypress 프로젝트에서 불안정한(flaky) 테스트 문제를 찾아 고쳐 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 Cypress 테스트 코드를 불안정성을 일으키는 알려진 패턴과 비교해 분석합니다. 대기 시간을 늘리거나 동작을 억지로 강제하지 않고, 테스트를 더 신뢰할 수 있게 만드는 수정안을 제안합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Cypress Flake Fixer

Audit an existing Cypress suite for the code patterns that cause intermittent failures, then fix them without hiding the problem behind retries, longer timeouts, or force: true.

When to Use This Skill

  • A Cypress spec passes locally and fails in CI, or fails once in every few runs
  • The suite contains cy.wait(<number>), { force: true }, or tests that only pass in order
  • Errors mention "detached from the DOM", "timed out retrying", or a subject that "is no longer attached"
  • The project is upgrading Cypress across a major version (12 through 16)
  • A review of Cypress test code is requested

For writing new Cypress tests from scratch, coding standards are enough. This skill is for diagnosing and repairing an existing suite.

Prerequisites

  • Node.js 18 or later to run the scanner (it has no dependencies and does not need Cypress installed)
  • The Cypress version, read from package.json. Fixes differ by major version

Workflow

1. Scan

node ./scripts/scan-cypress.mjs <project-root>
node ./scripts/scan-cypress.mjs <project-root> --json          # machine-readable
node ./scripts/scan-cypress.mjs <project-root> --strict        # add low-confidence rules
node ./scripts/scan-cypress.mjs cypress/e2e/checkout.cy.ts     # one file

The scanner reads the Cypress version from the nearest package.json and grades removed APIs as error when the installed major already rejects them and warn when they break on upgrade. Run --list-rules for the catalog.

Findings are heuristic. Open each location and confirm before editing.

2. Measure before changing anything

When the goal is to fix a specific flaky spec, record how often it fails first. Without a baseline there is no way to tell a fix from luck.

for i in $(seq 1 20); do npx cypress run --spec "cypress/e2e/checkout.cy.ts" --quiet || echo "FAIL $i"; done

A spec that fails 1 run in 10 needs about 30 clean runs after the fix before the fix is believable.

3. Fix in this order

Order Rules Why first
1 CY002, CY003, CY007 graded error The test is wrong or already broken; other fixes build on correct command flow
2 CY001, intercept ordering Time-based waits are the largest single source of flake
3 CY005, CY006 Broken retry-ability causes detached-DOM and one-shot assertion failures
4 CY004 force: true hides a real overlap, animation, or disabled state
5 CY008, CY010, CY012 State leaks and order dependence
6 CY013, CY101, CY102 Selector and assertion hygiene

Before-and-after code for every rule is in references/anti-patterns.md. Replacements for removed APIs are in references/removed-apis.md. Read the section for the rule being fixed; do not load both files upfront.

4. Replace each fixed wait with the condition it was standing in for

Do not delete a cy.wait(n) or swap it for a guess. Work out what the delay covered:

The wait covered Replace with
A network request cy.intercept(...).as('x') registered before the trigger, then cy.wait('@x')
A render that follows a request or state change A .should() on the DOM that results
A debounce, throttle, polling interval, or toast timeout cy.clock() before cy.visit(), then cy.tick(ms)
A CSS animation or transition An assertion on the final state; Cypress already waits for the element to stop moving before acting
Client-side hydration of server-rendered HTML A signal the app sets when hydration finishes (see Gotchas)
Unknown Run the test in npx cypress open, select the wait in the Command Log, and read which requests and DOM changes happened during it

5. Verify

  1. Run the changed spec alone, then repeat it at least as many times as the baseline run.
  2. Rerun the scanner and compare counts per rule.
  3. Run the full suite once to catch order dependence exposed by the change.

Rules for the fix itself

  • Change test code only. If the test exposes an application bug (double submit, missing loading state, race in the UI), report it instead of working around it.
  • Do not raise defaultCommandTimeout, add retries, or add { force: true } to make a test pass. Each one converts a visible failure into a slower or hidden one.
  • Do not replace cy.wait(2000) with cy.wait(5000), or with .should('exist') on an element that was already present.

…

자주 묻는 질문

‘불안정한(flaky)’ 테스트란 무엇인가요?

테스트 대상 코드가 바뀌지 않았는데도 어떤 때는 통과하고 어떤 때는 실패하는 테스트입니다. 소프트웨어가 작동하는지 안정적으로 알려 주지 않아 답답합니다.

이 에이전트를 쓰려면 무언가 설치해야 하나요?

아니요, AI 에이전트는 설치가 필요하지 않습니다. 제공된 코드를 분석하는 방식으로 작동합니다.

‘안티패턴’이란 무엇인가요?

처음에는 잘 작동하는 것처럼 보일 수 있지만, 결국 불안정하거나 유지보수하기 어려운 테스트 같은 문제로 이어지는 흔한 코딩 방식입니다.

상세 정보

작성자의 원본 설명

Find and fix flake-prone anti-patterns in an existing Cypress suite, and APIs removed in Cypress 12 to 16. Bundles a zero-dependency scanner for fixed cy.wait() delays, assigned command return values, async/await, force: true, chaining after actions, one-shot expect() inside .then(), conditional testing, and removed APIs such as Cypress.env(), cy.exec(), cy.server()/cy.route(). Use when asked to f

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7157
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬