diff --git a/scripts/ci/ios-sim/smoke-test.sh b/scripts/ci/ios-sim/smoke-test.sh index b3a7f7e7db..357e5af473 100755 --- a/scripts/ci/ios-sim/smoke-test.sh +++ b/scripts/ci/ios-sim/smoke-test.sh @@ -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 # 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"