Log in to a test store on an iOS simulator. Use live-store DEBUG login by default, WireMock when mocks are requested, and the specified store for "my site".
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use swift-snapshot-testing to visually verify SwiftUI views during implementation. Renders views to PNG for comparison against design references. Fast feedback loop (~25s/cycle).
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Use swift-snapshot-testing to create a visual feedback loop when implementing UI changes. Render SwiftUI views to PNG after each code change, compare against design goals, fix mismatches, and repeat.
1. SETUP Add swift-snapshot-testing dependency (temporary)
2. GOAL Collect design reference images
3. SCAFFOLD Create snapshot test rendering the target view
4. LOOP For each implementation step:
a. Edit code
b. Run snapshot test (record mode)
c. Read generated PNG
d. Compare against design
e. If mismatch -> fix and re-snapshot
f. If match -> commit the verified change, move to next step
5. CLEANUP Revert dependency + delete test file
Check if swift-snapshot-testing already exists in Modules/Package.swift. If not, add it temporarily.
In the dependencies array of Modules/Package.swift:
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.0"),
In the relevant test target's dependencies array:
.product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
Common test targets in this project:
PointOfSaleTests — for POS viewsWooFoundationTests — for shared UI componentsYosemiteTests — for business logic viewsRemember the original state of Modules/Package.swift so you can revert exactly after cleanup.
If the user provides design reference images (Figma exports, screenshots):
mkdir -p ~/Downloads/snapshot_experiment
cp ~/path/to/design.png ~/Downloads/snapshot_experiment/design.png
Read each reference image to understand the target state before writing code.
If no reference image, the goal is inferred from the user's description of desired UI behavior.
Create a test file in the appropriate Modules/Tests/*Tests/ directory:
import XCTest
import SnapshotTesting
import SwiftUI
@testable import TargetModule
final class ViewNameSnapshotTests: XCTestCase {
override func invokeTest() {
withSnapshotTesting(record: .all) {
super.invokeTest()
}
}
func test_defaultState_snapshot() {
let view = YourView(/* props for default state */)
.frame(width: 375, height: 900)
assertSnapshot(of: view, as: .image(layout: .sizeThatFits))
}
func test_alternateState_snapshot() {
let view = YourView(/* props for alternate state */)
.frame(width: 375, height: 900)
assertSnapshot(of: view, as: .image(layout: .sizeThatFits))
}
}
Important details for this project:
record: .all in invokeTest() forces PNG generation every run.environment(\.horizontalSizeClass, .regular) — POS is iPad-first.frame(width:height:) to control render size. Start with height: 900, increase to 1200+ if content is clippedPOSPadding, POSSpacing, POSFontStyle, Color+POSColorPalette) when comparing POS designsUse the /simulator skill approach to discover a booted simulator UDID.
Run only the snapshot tests for fast feedback:
xcodebuild test \
-workspace WooCommerce.xcworkspace \
-scheme WooCommerce \
-destination 'platform=iOS Simulator,id=<SIMULATOR_UDID>' \
-only-testing:<TestTarget>/<SnapshotTestClass> \
CODE_SIGNING_ALLOWED=NO 2>&1 | tail -30
Prefer module-level test targets over the full app for faster feedback (~25s vs minutes).
Generated PNGs appear at:
Modules/Tests/<TestTarget>/__Snapshots__/<TestClass>/test_name.1.png
After each run:
cp Modules/Tests/<Target>/__Snapshots__/<Class>/test_name.1.png ~/Downloads/snapshot_experiment/step1.png
Common issues caught by snapshots:
.lineLimit(1).fixedSize(horizontal: true, vertical: false), reduce padding.environment(\.horizontalSizeClass, .regular)POSPadding/POSSpacing values against designWhen fixing: edit the code and re-run snapshots to verify. Only commit once the snapshot matches the design goal — don't commit untested changes.
After implementation is complete, revert ALL temporary changes:
# Revert Package.swift (removes snapshot dependency)
git checkout -- Modules/Package.swift
# Revert Package.resolved if it changed
git checkout -- Modules/Package.resolved
# Also revert workspace Package.resolved if changed
git checkout -- WooCommerce.xcworkspace/xcshareddata/swiftpm/Package.resolved
# Delete the snapshot test file
rm Modules/Tests/<TestTarget>/<SnapshotTestClass>.swift
# Delete generated snapshot directory
rm -rf Modules/Tests/<TestTarget>/__Snapshots__
# Verify clean state
git status
Critical: Never commit snapshot test files, __Snapshots__/ directories, or the swift-snapshot-testing dependency. These are temporary iteration tools only.
| Action | Command/Tool |
|---|---|
| Add dependency | Edit Modules/Package.swift |
| Run snapshots | xcodebuild test -only-testing:<Target>/<Class> |
| Find PNGs | Modules/Tests/<Target>/__Snapshots__/<Class>/test_name.1.png |
| View snapshot | Read tool on the PNG path |
| Compare | Read both snapshot PNG and design reference |
| Fix + re-run | Edit code, re-run xcodebuild, commit once verified |
| Clean up | git checkout -- Modules/Package.swift, rm test file + snapshots |
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Log in to a test store on an iOS simulator. Use live-store DEBUG login by default, WireMock when mocks are requested, and the specified store for "my site".
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Install dependencies and build tools for WooCommerce iOS
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Debug a failing test or build error in WooCommerce iOS
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Run SwiftLint on the WooCommerce iOS project
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Start or stop the WireMock API mock server for UI testing and E2E verification.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Create a pull request following WooCommerce iOS conventions
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.