From 8ebf3bdddbd375d0b4148be309faeb5cb5819838 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sun, 24 Mar 2024 09:45:47 -0700 Subject: [PATCH] Tweak Clocks alarm test for change in upstream code Upstream now sets an alarm with no explicit recurrence inactive after it is stopped (previously it assumed recurrence every day). We need the test to handle both behaviours for a while (until we are no longer testing < 46.0 anywhere). Signed-off-by: Adam Williamson --- tests/applications/clocks/alarm.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/applications/clocks/alarm.pm b/tests/applications/clocks/alarm.pm index 0ad1c1a5..27df1540 100644 --- a/tests/applications/clocks/alarm.pm +++ b/tests/applications/clocks/alarm.pm @@ -30,14 +30,24 @@ sub run { # After another minute or so, the alarm should ring again. # This time we will use the stop button to stop it. assert_and_click("clocks_button_alarm_stop", timeout => 120); - # The alarm should switch off but should stay listed active. - assert_screen("clocks_alarm_active"); - # Now toggle the switch to inactivate it. + # Up to 46.0, the alarm would stay active after being stopped; from + # 46.0 onwards it goes inactive. FIXME this can be simplified to + # assume it starts at 'inactive' once we are no longer testing + # < 46.0 anywhere + assert_screen(["clocks_alarm_active", "clocks_alarm_inactive"]); + # Now toggle the switch to change its state assert_and_click("gnome_button_toggle"); - assert_screen("clocks_alarm_inactive"); + # whichever state it was in, check it's now in the other + if (match_has_tag("clocks_alarm_active")) { + assert_screen("clocks_alarm_inactive"); + } + else { + assert_screen("clocks_alarm_active"); + } # Delete alarm using the delete button. assert_and_click("gnome_button_cross_remove"); - if (check_screen("clocks_alarm_inactive")) { + sleep 2; + if (check_screen(["clocks_alarm_active", "clocks_alarm_inactive"])) { die("The alarm should have been deleted but it is still visible in the GUI"); }