mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
improve the contribution docs with preview tests setup
This commit is contained in:
+6
-4
@@ -91,15 +91,17 @@ Git LFS is used to store UI and Preview test snapshots. `swift run tools setup-p
|
||||
git lfs install
|
||||
```
|
||||
|
||||
### Snapshot (Preview) Tests
|
||||
### Snapshot Tests
|
||||
|
||||
If you make changes to the UI you may cause existing UI and Preview test snapshots to fail. The UITests run user flows and record snapshots while doing so using the settings defined under [checkEnvironments](https://github.com/element-hq/element-x-ios/blob/c29175d1f924e58b9646a200dbab0301fce3c258/UITests/Sources/Application.swift#L35-L37) while the PreviewTests use the settings defined in [PreviewTests.swift](https://github.com/element-hq/element-x-ios/blob/c29175d1f924e58b9646a200dbab0301fce3c258/PreviewTests/Sources/PreviewTests.swift#L18-L20). The snapshots are stored under `Sources/__Snapshots__` in their respective target's folder.
|
||||
|
||||
To run preview tests, select the `PreviewTests` scheme with an iPhone SE running iOS 26.5 in Xcode and run tests (` - U`). Language and region must be set to `en-US`. Newly created screens will automatically have their screenshots added based off their `TestablePreview` Swift previews. If you are modifying an existing screen, you will first need to delete the old snapshots for that screen before running the tests. Alternatively, if you enable `RECORD_FAILURES` in the preview test plans's environment variables (`PreviewTests/SupportingFiles/Previewtests.xctestplan`), it will overwrite snapshot failures with the updated screenshot.
|
||||
To run the preview tests:
|
||||
|
||||
Language and region settings screenshot:
|
||||
1. Use an iPhone SE (3rd generation) simulator running iOS 26.5.
|
||||
2. On that simulator, go to Settings -> General -> Language & Region and select United States as the region, with English (US) as the only preferred language. This is a one time setup, as long as you keep using the same simulator.
|
||||
3. Select the `PreviewTests` scheme and run the tests.
|
||||
|
||||

|
||||
Newly created screens will automatically have their screenshots added based off their `TestablePreview` Swift previews. If you are modifying an existing screen, you will first need to delete the old snapshots for that screen before running the tests. Alternatively, if you enable `RECORD_FAILURES` in the preview test plans's environment variables (`PreviewTests/SupportingFiles/Previewtests.xctestplan`), it will overwrite snapshot failures with the updated screenshot.
|
||||
|
||||
### Githooks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user