mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-11 07:28:13 +00:00
ci: check in the smoke test that the Directory header is above its results in both layouts
After the M3 search in the one-hand UI, the header's y must be smaller than both results'. The search is then repeated with the top bar (ui layout top) and checked the same way, and the app is left in the one-hand UI for later steps. A layout the helper cannot set is reported as a warning, not a failure: that is the harness, not the app.
This commit is contained in:
1 parent
611ca05536
commit
8e600e5c98
1 file changed
+40
-2
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installs the app in a new iPhone simulator and runs the scripted UI cases with the ui helper:
|
||||
# onboarding to the chat list, typing in the search field, and searching the test directory.
|
||||
# onboarding to the chat list, typing in the search field, and searching the test directory, whose results
|
||||
# must have the Directory header above them in both layouts. It leaves the app in the one-hand UI.
|
||||
# Usage: scripts/ci/ios-sim/smoke-test.sh <path to SimpleX.app> <output dir>
|
||||
# Each step saves a screenshot and an accessibility tree to the output dir and prints the tree to the log.
|
||||
# Later steps of the job get SIM_UDID and UI_OUT, with the simulator still running.
|
||||
@@ -59,6 +60,25 @@ expect_in_tree() {
|
||||
fi
|
||||
}
|
||||
|
||||
# the y of the first element with exactly this label
|
||||
element_y() {
|
||||
local tree
|
||||
tree=$("$ui" tree)
|
||||
grep -F "\"$1\" value=" <<< "$tree" | head -n 1 | sed -E 's/.* at [0-9-]+,([0-9-]+) .*/\1/'
|
||||
}
|
||||
|
||||
expect_header_above_results() {
|
||||
local header group channel
|
||||
header=$(element_y Directory)
|
||||
group=$(element_y "#ci_group")
|
||||
channel=$(element_y "#ci_channel")
|
||||
if [ -z "$header" ] || [ -z "$group" ] || [ -z "$channel" ] || [ "$header" -ge "$group" ] || [ "$header" -ge "$channel" ]; then
|
||||
echo "error: in the $1 layout the Directory header (y=$header) is not above its results (#ci_group y=$group, #ci_channel y=$channel)"
|
||||
exit 1
|
||||
fi
|
||||
echo "in the $1 layout the Directory header (y=$header) is above its results (#ci_group y=$group, #ci_channel y=$channel)"
|
||||
}
|
||||
|
||||
xcrun simctl install "$SIM_UDID" "$app"
|
||||
xcrun simctl launch "$SIM_UDID" "$bundle_id"
|
||||
|
||||
@@ -114,4 +134,22 @@ expect_in_tree -F '#ci_group'
|
||||
expect_in_tree -F 'Join group'
|
||||
expect_in_tree -F '#ci_channel'
|
||||
expect_in_tree -F 'Join channel'
|
||||
echo "smoke test passed: the directory search for \"$search_text\" shows #ci_group (Join group) and #ci_channel (Join channel)"
|
||||
expect_header_above_results reachable
|
||||
|
||||
# a layout the helper cannot set is a problem of the harness, not of the app, so it is reported rather than failed
|
||||
if "$ui" layout top; then
|
||||
"$ui" tap-value "Search or paste SimpleX link"
|
||||
"$ui" type "$search_text"
|
||||
sleep 2
|
||||
"$ui" tap "Search in Directory"
|
||||
if "$ui" wait "Search in Directory?" 10; then
|
||||
"$ui" tap "Search"
|
||||
fi
|
||||
"$ui" wait "Join channel" 60
|
||||
"$ui" shot directory-results-top
|
||||
expect_header_above_results top
|
||||
"$ui" layout reachable
|
||||
else
|
||||
echo "::warning::the top bar layout could not be set, so its Directory header was not checked"
|
||||
fi
|
||||
echo "smoke test passed: the directory search for \"$search_text\" shows #ci_group (Join group) and #ci_channel (Join channel), with the Directory header above them"
|
||||
Reference in new issue
Block a user