# Mastodon App Store Snapshot Guide This documentation is a guide to create snapshots for App Store. The outer contributor could ignore this. ## Prepare toolkit The app use the Xcode UITest generate snapshots attachments. Then use the `xcparse` tool extract the snapshots. ```zsh # install xcparse from Homebrew brew install chargepoint/xcparse/xcparse ``` ## Take Snapshots We use `xcodebuild` CLI tool to trigger UITest. To change device for snapshot. Replace the `name` in `-destinatio` option to change device. For example: `-destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch) (5th generation)' \` ```zsh # list the destinations xcodebuild \ test \ -showdestinations \ -derivedDataPath '~/Downloads/MastodonBuild/Derived' \ -workspace Mastodon.xcworkspace \ -scheme 'Mastodon - Snapshot' ``` #### Auto-Login before make snapshots This script trigger the `MastodonUITests/MastodonUISnapshotTests/testSignInAccount` test case to sign-in the account. The test case may wait for 2FA code or email code. Please input it if needed. Also, you can skip this and sign-in the test account manually. Replace the `` and `` for test account. ```zsh # build and run test case for auto sign-in TEST_RUNNER_email='' \ TEST_RUNNER_password='' \ xcodebuild \ test \ -derivedDataPath '~/Downloads/MastodonBuild/Derived' \ -workspace Mastodon.xcworkspace \ -scheme 'Mastodon - Snapshot' \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 13 Pro Max' \ -testPlan 'AppStoreSnapshotTestPlan' \ -only-testing:MastodonUITests/MastodonUISnapshotTests/testSignInAccount ``` Note: UITest may running silent. Open the Simulator.app to make the device display. #### Take and extract snapshots ```zsh # take snapshots TEST_RUNNER_username_snapshot='Gargron' \ xcodebuild \ test \ -derivedDataPath '~/Downloads/MastodonBuild/Derived' \ -workspace Mastodon.xcworkspace \ -scheme 'Mastodon - Snapshot' \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 13 Pro Max' \ -testPlan 'AppStoreSnapshotTestPlan' \ -only-testing:MastodonUITests/MastodonUISnapshotTests/testSnapshot # output: Test session results, code coverage, and logs: /Users/Me/Downloads/MastodonBuild/Derived/Logs/Test/Test-Mastodon - Snapshot-2022.03.03_18-00-38-+0800.xcresult ** TEST SUCCEEDED ** ``` Use `xcparse screenshots ` extracts snapshots. ```zsh # scresult path for previous test case xcparse screenshots '' ~/Downloads/MastodonBuild/Screenshots/ # output 100% [============] 🎊 Export complete! 🎊 ```