From 47664b0dd868097d8cea2dfa334ac1fb3aaf5205 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sat, 1 Apr 2023 14:55:27 -0700 Subject: [PATCH] desktop_switch_layout: give switching 3 tries to work There's a fairly longstanding issue in GDM where switching layout just doesn't work sometimes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6066#note_1707051 there doesn't seem to be any progress on getting this fixed, and it's annoying constantly restarting tests that fail on it. So this just makes us try three times to switch before giving up. Signed-off-by: Adam Williamson --- lib/utils.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index bc90925c..dec187b1 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -119,8 +119,10 @@ sub desktop_switch_layout { my $switcher = "alt-shift"; # anaconda $switcher = "super-spc" if $environment eq 'gnome'; # KDE? not used yet - send_key $switcher; - assert_screen "${environment}_layout_${layout}", 3; + # FIXME we use send_key_until_needlematch because sometimes the + # switch just doesn't work in gdm: + # https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6066#note_1707051 + send_key_until_needlematch("${environment}_layout_${layout}", $switcher, 3, 3); } # this is used at the end of console_login to check if we got a prompt