ci: wait for Your servers before opening the test server, and scroll to the names settings in the desktop smoke test

This commit is contained in:
spacedandy-agents-simplex committed 2026-10-15 16:41:38 +00:00
1 parent 51bcb8fdf6
commit 3908a19bc7
2 files changed
+53 -4

No files matched your search

+32 -4
View File
@@ -151,6 +151,26 @@ in_row_of() {
[ "$label" -ge "$name" ] && [ $((label - name)) -lt 45 ]
}
# the value is on the same line as its setting's title
in_line_with() {
local value title
value=$(y_of "$1") || return 1
title=$(y_of "$2") || return 1
[ $((value - title)) -lt 10 ] && [ $((title - value)) -lt 10 ]
}
# Scrolls the left pane down until the text shows above its bottom toolbar.
scroll_to() {
local y
for _ in 1 2 3 4 5 6 7 8; do
if y=$(y_of "$1") && [ "$y" -lt 640 ]; then
return 0
fi
"$ui" scroll 195 400 down
done
return 1
}
# the count's text is smaller than the description's above it: both have capitals and ascenders, no descenders
count_text_smaller() {
local count description
@@ -377,24 +397,32 @@ use_names_server() {
"$ui" click "$switch_x" "$y"
"$ui" shot new-server
"$ui" key Escape
# the New server screen shows the address with "127.0.0.1" too, until it closes
"$ui" wait "Add server" 10
"$ui" wait "Test servers" 10
"$ui" click-text "127.0.0.1" 10
"$ui" wait "To resolve names" 10
"$ui" wait "SMP server" 10
scroll_to "To resolve names" || fail "no \"To resolve names\" in the test server's settings"
# the dropdown opens from its value; a custom server's roles default to yes, yes and no, so this is the names one
"$ui" click-text "default (no)"
"$ui" click-text "yes" 10
"$ui" shot names-server-roles
"$ui" wait "To resolve names" 10
in_row_of "yes" "To resolve names" || fail "the test server's \"To resolve names\" is not yes"
in_line_with "yes" "To resolve names" || fail "the test server's \"To resolve names\" is not yes"
"$ui" key Escape
"$ui" wait "Add server" 10
"$ui" key Escape
for operator in "SimpleX Chat" Flux; do
"$ui" click-text "$operator" 10
"$ui" wait "To resolve names" 10
# the operator's own toggle: the title "<operator> servers" can wrap
"$ui" wait "Use servers" 10
scroll_to "To resolve names" || fail "no \"To resolve names\" in the $operator settings"
y=$(y_of "To resolve names")
"$ui" click "$switch_x" "$y"
"$ui" shot "names-off-$(tr -cd 'a-zA-Z' <<< "$operator")"
"$ui" key Escape
"$ui" wait "Your servers" 10
done
scroll_to "Save servers" || fail "no \"Save servers\" in Network & servers"
"$ui" click-text "Save servers" 10
sleep 2
"$ui" shot servers-saved
+21
View File
@@ -12,6 +12,8 @@
# ui wait <text> [secs] wait up to secs (30) until the text is on screen
# ui click <x> <y> click at x,y
# ui click-text <text> [secs] wait up to secs (20) for the text and click its centre
# ui scroll <x> <y> <up|down> [clicks]
# turn the mouse wheel over x,y, 3 clicks unless given
# ui avatar <text> [colour] print how many pixels of the profile image left of a list row's name (the text) stand out
# from the background, and their mean colour, saving the area as UI_OUT/NN-avatar-<text>.png;
# with red, green or blue, fail unless that colour dominates
@@ -150,6 +152,21 @@ click() {
sleep 1
}
# X buttons 4 and 5 are the wheel turned up and down
scroll() {
local button
case "$3" in
up) button=4 ;;
down) button=5 ;;
*)
echo "error: scroll up or down, not \"$3\""
return 1
;;
esac
xdotool mousemove --sync "$1" "$2" click --repeat "$4" --delay 100 "$button"
sleep 1
}
# A list row's profile image is 42 px square, 8 px left of the row's name, and starts a little below the name's top:
# the area allows for OCR's box being a few pixels off, and leaves out the rows above and below.
avatar() {
@@ -207,6 +224,10 @@ case "${1:-}" in
click "$x" "$y"
log "click-text \"$2\" at $x,$y"
;;
scroll)
scroll "$2" "$3" "$4" "${5:-3}"
log "scroll $4 at $2,$3, ${5:-3} clicks"
;;
avatar) avatar "$2" "${3:-}" ;;
type)
xdotool type --delay 50 -- "$2"