Files
simplex-chat/scripts/ci/ui-tests/plan.sh
T
Narasimha-sc 69b3cc4f0e ui tests: about 300 more tests across all areas, server control, relays, remote desktop, CI workflow
- Tests for connection plans, prepared chats, edit/delete/selection, forwarding, drafts, group preferences and admission, group lifecycle, compose, live messages, item info, reports and moderation, privacy and SimpleX Lock, chat data and database, address and contact preferences, profiles, contact info, unread and search, files and reactions, group info and events, chat shell and statuses, joining, support and business chats, settings and appearance, network and servers, channels, remote desktop, Android intents and notifications.
- Harness: server stop/start, smp2/xftp2, SOCKS stub, CLI chat relays, CLI remote host/controller, chat scroll and drag helpers, file chooser answers, clipboard in popups.
- ui-tests workflow (manual dispatch only) running both suites on GitHub runners.
- App findings recorded in plan section 15.5 (items 7-23), each covered by a test marked @KnownAppIssue.
2026-10-22 19:45:11 +00:00

72 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# Reads the ui-tests workflow's inputs and writes to GITHUB_OUTPUT which platforms run, and the desktop and Android
# shards as matrices.
# Usage: PLATFORM=desktop|android|both TESTS='<classes or patterns>' scripts/ci/ui-tests/plan.sh
# Without TESTS, the desktop tests run in one shard per test package; a test package no shard names fails the plan, so
# a new package can't go untested. The Android tests run in android_shards shards of AndroidJUnitRunner's own sharding
# (-e numShards -e shardIndex). With TESTS (comma- or space-separated), one job per platform runs them: as Gradle
# --tests filters on desktop, with Class#method written Class.method, and as `am instrument -e class` on Android.
set -euo pipefail
out=${GITHUB_OUTPUT:-/dev/null}
ui=apps/multiplatform/common/src
roots=("$ui/uiTestShared/kotlin/chat/simplex/app/ui" "$ui/desktopTest/kotlin/chat/simplex/app/ui")
android_shards=4
shards='[
{"shard": "chat", "tests": "chat.simplex.app.ui.chat.*"},
{"shard": "groups", "tests": "chat.simplex.app.ui.groups.*"},
{"shard": "main", "tests": "chat.simplex.app.ui.main.*"},
{"shard": "settings-desktop", "tests": "chat.simplex.app.ui.settings.* chat.simplex.app.ui.desktop.* chat.simplex.app.ui.harness.*"}
]'
case "${PLATFORM:-}" in
desktop) desktop=true android=false ;;
android) desktop=false android=true ;;
both) desktop=true android=true ;;
*)
echo "::error::platform must be desktop, android or both, not \"${PLATFORM:-}\""
exit 1
;;
esac
allowed='^[A-Za-z0-9_.*#, ]*$'
if ! [[ "${TESTS:-}" =~ $allowed ]]; then
echo "::error::tests may have only class names, patterns (* . # _), commas and spaces"
exit 1
fi
read -r -a tests <<< "${TESTS//,/ }"
if [ "${#tests[@]}" -eq 0 ]; then
covered=$(jq -r '[.[].tests | split(" ")[] | sub("^chat\\.simplex\\.app\\.ui\\."; "") | sub("\\.\\*$"; "")] | join(" ")' <<< "$shards")
missing=$(find "${roots[@]}" -name '*Test.kt' | sed 's|.*/chat/simplex/app/ui/||' | cut -d/ -f1 | sort -u | while read -r pkg; do
case " $covered " in
*" $pkg "*) ;;
*) echo "chat.simplex.app.ui.$pkg" ;;
esac
done)
if [ -n "$missing" ]; then
echo "::error::no desktop shard runs the tests in $(paste -sd ' ' <<< "$missing") (add a shard in scripts/ci/ui-tests/plan.sh)"
exit 1
fi
matrix=$(jq -c . <<< "$shards")
android_matrix=$(jq -cn --argjson n "$android_shards" '[range($n) | {shard: "\(. + 1)-of-\($n)", args: "-e numShards \($n) -e shardIndex \(.)"}]')
else
if [ "$android" = true ] && [[ "${tests[*]}" == *"*"* ]]; then
echo "::error::Android runs whole class names (or Class#method), not patterns with *"
exit 1
fi
desktop_tests="${tests[*]}"
matrix=$(jq -cn --arg tests "${desktop_tests//#/.}" '[{shard: "selected", tests: $tests}]')
android_classes=$(IFS=,; echo "${tests[*]}")
android_matrix=$(jq -cn --arg classes "$android_classes" '[{shard: "selected", args: "-e class \($classes)"}]')
fi
{
echo "desktop=$desktop"
echo "android=$android"
echo "desktop-shards=$matrix"
echo "android-shards=$android_matrix"
} | tee -a "$out"