Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

snapshot-testing

/snapshot-testing

Konfiguruje testy snapshotów z wzorcami w projekcie Arkive, diagnozuje nieudane weryfikacje i wiąże je z CI.

Repozytorium
arkive ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
23.09.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 23.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Konfiguruje testy snapshotów z wzorcami w projekcie Arkive, diagnozuje nieudane weryfikacje i wiąże je z CI.

Oryginalny opis (EN)

Use when: (1) enabling golden snapshot testing in a project that uses Arkive, (2) a verifyShowcase build failed and needs diagnosing, (3) the UI changed intentionally and goldens need re-recording, (4) wiring snapshot verification into CI. There is no test to write — Arkive generates it; this skill configures retention, records goldens, proves verification works, and diagnoses failures. Requires arkive 0.0.3+.

Jak działa

  1. Step 1 — Retention
  2. Step 2 — Pre-flight the repo
  3. Step 3 — Record and confirm the goldens actually landed
  4. Step 4 — Prove verification works before committing
  5. Step 5 — Diagnosing a failed verify
  6. CI
  7. Red flags — STOP
Sekcje z nagłówków SKILL.md, w oryginale · 90 linii, 704 słów
Podgląd SKILL.md
---
name: snapshot-testing
description: 'Use when: (1) enabling golden snapshot testing in a project that uses Arkive, (2) a verifyShowcase build failed and needs diagnosing, (3) the UI changed intentionally and goldens need re-recording, (4) wiring snapshot verification into CI. There is no test to write — Arkive generates it; this skill configures retention, records goldens, proves verification works, and diagnoses failures. Requires arkive 0.0.3+.'
---

# Arkive Snapshot Testing

Lock in approved UI with goldens and make regressions fail the build via
`verifyShowcase<Variant>`. Read
`references/arkive-cheatsheet.md` for retention semantics, paths,
and failure behavior.

**Scope:** this is code-vs-code-as-last-approved, judged pixel-exact against committed
goldens. Code-vs-*design* (Figma/specs, judged by eye) is `/arkive:design-loop` — it
needs no goldens at all. Don't conflate them.

**Version gate (do this first):** check the project's pinned arkive version.
`verifyShowcase` exists from **0.0.3**; on anything older, verification silently cannot
fail. If the pin is older, upgrade first (`/arkive:setup` covers resolving latest).

## Step 1 — Retention

Read the module's `arkive { snapshotRetention }`:

- **If NONE (or unset — NONE is the default): set it to `BASE`, and explain the change to
  the user, don't just do it silently.** The explanation: under NONE the showcase
  consumes every snapshot and nothing is verifiable; BASE keeps exactly one golden per
  component, which is the regression signal, without committing every font/density/RTL
  variant — a real app went from 57 goldens to 725 with variants retained, which is why
  ALL is not the default recommendation.
- **If BASE or ALL already:** leave it alone; the team made a choice.
- Suggest `ALL` only if the user explicitly wants variant-level regression coverage, and
  pair it with Git LFS for the golden directory.

## Step 2 — Pre-flight the repo

Check `.gitignore` (root and module) for the golden directory
(`src/test/snapshots/`). Goldens must be **committable** — verification in CI is
meaningless against images that only exist on one laptop. If ignored, surface it and fix
it with the user (scoped: Arkive's files are all prefixed `com.infinum.arkive_`).

## Step 3 — Record and confirm the goldens actually landed

Run `./gradlew :<module>:generateShowcase<Variant>` (recording takes minutes), then
verify the outcome — do not assume it:

1. Count `com.infinum.arkive_`-prefixed PNGs in `<module>/src/test/snapshots/images/`.
2. Cross-check against the component count in the module's `arkive-showcase.json` —
   under BASE they should match one-to-one.
3. Scan the build log for `Arkive: no snapshot recorded for component` warnings. A
   crashed preview has **no golden and will never be covered by verification** — report
   each one to the user rather than letting coverage silently shrink. (Re-run with
   `--info` to see the test-side crash message.)

## Step 4 — Prove verification works before committing

Run `./gradlew :<module>:verifyShowcase<Variant>` immediately. It must be green against
the goldens just recorded. Only then commit the goldens. Committing unverified goldens
means the first CI failure is undebuggable ("was it ever green?").

## Step 5 — Diagnosing a failed verify

`verifyShowcase` fails with **one aggregate error naming every mismatched component**,
each with a delta-image path
(`<module>/build/paparazzi/failures/<variant>/delta-*.png`) and an accept command.

| Failure shape | Meaning | Action |
|---|---|---|
| `Arkive: snapshot verification failed for N component(s)` | Rendering differs from the golden | **View the delta image** for each named component, then decide: regression → fix the code; intentional change → re-record |
| Missing golden for a component | Component added/renamed since goldens were recorded | Re-record and commit the new golden |
| `verifyShowcase... has nothing to verify — snapshotRetention is NONE` | Fails fast at configuration time | Go to Step 1 |
| The consumer's own `verifyPaparazzi` failing on non-Arkive tests | Their tests, their goldens | Out of scope — Arkive's generated test self-skips what retention didn't keep and never affects theirs |

**Intentional change flow:** `generateShowcase<Variant>` (re-records everything and
retention re-prunes) → `verifyShowcase<Variant>` green → commit the updated goldens in
the same PR as the UI change.

## CI

Run `verifyShowcase<Variant>` on pull requests. Goldens live in the repo; **recording
happens locally, never in CI** — a CI that re-records and verifies in one run can never
fail. If JVM rendering differs across OSes (fonts), pin the CI runner OS to what the
team records on.

## Red flags — STOP

- Re-recording to make a failing verify pass **without viewing the delta image first**.
  "Accept the changes" is for intentional changes; a regression accepted is a regression
  shipped.
- Committing goldens that were never proven green (Step 4 skipped).
- Flipping retention to ALL casually — 10× golden growth is a repo decision.
- Treating a crashed preview's absence from verification as "covered".
- Declaring snapshot testing "set up" when the goldens directory is still gitignored.
Pliki w paczce (2)
  • SKILL.md 5 KB
  • references 1 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · infinum/arkive90Apache-2.0
jacob-balslev/skill-graph100Apache-2.0
Amey-Thakur/AI-SKILLS90MIT

Migawka bazy z 13.11.2026 · wersja paczki ed890faa05d8 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100setup
    Dodaje bibliotekę Arkive do projektu: instaluje wersję z Maven Central, konfiguruje moduły z podglądami i generuje pokaz.
  • 90design-loop
    Wdraża interfejs z projektu w Figmie w aplikacji Arkive i porównuje wynik z projektem, aż różnice zostaną usunięte.
  • 100golden-and-snapshot-tests
    Pilnuje testów golden i snapshotów danych oraz pikseli: pliki *.golden.test.ts, wpisy kontraktowe tylko do dopisywania, tolerancja Skia i zasady użycia jest -u.
  • 100run-goldens-rebaseline
    Przeprowadza rytuał aktualizacji wzorców w Jest: najpierw asercje, potem przegląd każdej zmiany i usunięcie zbędnych plików.
  • 100snapshot-test-setup
    Konfiguruje testy regresji wizualnej SwiftUI z swift-snapshot-testing, generuje szablon testów snapshotowych i konfigurację CI, aby zapobiegać regresjom interfejsu.
  • 100managing-snapshot-tests
    Tworzy i waliduje migawki komponentów do testów regresji interfejsu użytkownika, w tym aktualizację snapshotów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.