pfw-snapshot-testing

Snapshot test Swift code to detect UI and logic regressions.

16|2|Updated Mar 29, 2018
One-click install
npx skills add https://github.com/khoi/dotfiles --skill pfw-snapshot-testing-khoi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pfw-snapshot-testing
Source: https://github.com/khoi/dotfiles/tree/main/chezmoi/dot_pfw/skills/snapshot-testing
Command: npx skills add https://github.com/khoi/dotfiles --skill pfw-snapshot-testing-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Snapshot testing helps Swift developers verify UI and logic by comparing runtime output against stored references, preventing regressions in UI and behavior.

Core Features & Use Cases

  • Snapshot assertions for Swift tests using the SnapshotTesting library.
  • Record mode support to capture new snapshots and validate changes across UI and logic.
  • Integration with Swift Package Manager and Xcode test targets for seamless workflow.
  • Use Case: Verify that a SwiftUI view maintains its layout across minor code changes and refactors.

Quick Start

Add SnapshotTesting to your Swift package dependencies and import SnapshotTesting in your tests to start creating snapshot assertions.

Frequently Asked Questions about pfw-snapshot-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up snapshot testing in a Swift project?

Apply snapshot testing to verify SwiftUI views and logic by comparing runtime output against stored references, preventing regressions in UI layout and behavior during development and refactoring.

When do I need to use snapshot tests for SwiftUI views?

You need snapshot tests for SwiftUI views when you want to ensure a view maintains its layout across minor code changes and refactors, verifying UI stability by comparing runtime output against stored references.

Does snapshot testing work with Xcode test targets and CI environments?

Yes, snapshot testing integrates with Xcode test targets and Swift Package Manager for seamless workflow, enabling deterministic snapshot comparisons in both local development and CI environments.

How do I capture new snapshots when updating Swift UI code?

You can capture new snapshots when updating Swift UI code by using the record mode support provided by the SnapshotTesting library to capture new references and validate changes across UI and logic.

What is the best way to detect UI regressions in Swift?

The best way to detect UI regressions in Swift is using snapshot testing to compare runtime output against stored references, applying deterministic snapshot assertions across unit and UI tests to prevent behavioral changes.