Add iOS simulator UI smoke check
This commit is contained in:
@@ -32,3 +32,9 @@ Launch the fake-backed app in the first available iPhone simulator:
|
||||
```bash
|
||||
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer scripts/run-ios-simulator-app.sh
|
||||
```
|
||||
|
||||
Run the simulator launch plus screenshot sanity check:
|
||||
|
||||
```bash
|
||||
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer scripts/smoke-ios-simulator-ui.sh
|
||||
```
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
- `swift build --product TeleTuiIOSApp`
|
||||
- `swift run TeleTuiIOSSmokeTests`
|
||||
- `DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer scripts/build-ios-simulator-app.sh`
|
||||
- `DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer scripts/smoke-ios-simulator-ui.sh`
|
||||
- `DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer scripts/check-ios-tdlib-linking.sh` once TDLib iOS artifacts are available
|
||||
|
||||
`swift test` is not currently a CI gate on this host because the CLI Swift toolchain available to the package does not expose `XCTest` or `Testing`. The deterministic view-model coverage lives in the executable `TeleTuiIOSSmokeTests` target until an Xcode test target is introduced.
|
||||
|
||||
39
scripts/smoke-ios-simulator-ui.sh
Executable file
39
scripts/smoke-ios-simulator-ui.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
if [[ -z "${DEVELOPER_DIR:-}" && -d /Applications/Xcode.app/Contents/Developer ]]; then
|
||||
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
|
||||
fi
|
||||
|
||||
screenshot_path="${IOS_SCREENSHOT_PATH:-/private/tmp/tele-tui-ios-simulator-smoke.png}"
|
||||
simulator_udid="${IOS_SIMULATOR_UDID:-}"
|
||||
if [[ -z "${simulator_udid}" ]]; then
|
||||
simulator_udid="$(xcrun simctl list devices available | awk -F '[()]' '/iPhone/ { print $2; exit }')"
|
||||
fi
|
||||
|
||||
if [[ -z "${simulator_udid}" ]]; then
|
||||
printf 'No available iPhone simulator found. Run scripts/check-ios-prereqs.sh for details.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"${repo_root}/scripts/run-ios-simulator-app.sh"
|
||||
|
||||
# Give SwiftUI a short render window after launch returns.
|
||||
sleep "${IOS_SCREENSHOT_DELAY_SECONDS:-2}"
|
||||
|
||||
xcrun simctl io "${simulator_udid}" screenshot "${screenshot_path}"
|
||||
|
||||
width="$(sips -g pixelWidth "${screenshot_path}" | awk '/pixelWidth/ { print $2 }')"
|
||||
height="$(sips -g pixelHeight "${screenshot_path}" | awk '/pixelHeight/ { print $2 }')"
|
||||
bytes="$(wc -c < "${screenshot_path}" | tr -d ' ')"
|
||||
|
||||
if [[ "${width}" -lt 300 || "${height}" -lt 600 || "${bytes}" -lt 10000 ]]; then
|
||||
printf 'Simulator screenshot failed sanity checks: width=%s height=%s bytes=%s path=%s\n' \
|
||||
"${width}" "${height}" "${bytes}" "${screenshot_path}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'Simulator UI smoke screenshot: %s (%sx%s, %s bytes)\n' \
|
||||
"${screenshot_path}" "${width}" "${height}" "${bytes}"
|
||||
Reference in New Issue
Block a user