From 5038dcaab00f29f70221c368670c2ab6d6d4d125 Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Thu, 6 Oct 2022 09:18:21 +0200 Subject: [PATCH] Fix the logic in Kmail startstop test Sometimes the windows are displayed in the reversed order, which prevents the checks to find the needles and the test fail even if it should pass. This change should address this case. --- tests/apps_startstop/kde/kmail.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/apps_startstop/kde/kmail.pm b/tests/apps_startstop/kde/kmail.pm index dc808fcd..9975f6c5 100644 --- a/tests/apps_startstop/kde/kmail.pm +++ b/tests/apps_startstop/kde/kmail.pm @@ -12,13 +12,19 @@ sub run { menu_launch_type 'kmail'; # Cancel Kmail data wizard assert_and_click 'kde_cancel_button'; - if (check_screen("kde_cancel_button", 1)) { - click_lastmatch; + # Sometimes, the Kmail window is shown over the settings window. + # If that is the case, assert that Kmail is running and exit. + unless (check_screen("kmail_runs")) { + if (check_screen("kde_cancel_button", 1)) { + click_lastmatch; + } + assert_screen("kmail_runs"); } - # Check that it is started - assert_screen 'kmail_runs'; - # Close the application - quit_with_shortcut(); + else { + assert_screen("kmail_runs"); + } + # Close the application + quit_with_shortcut(); } sub test_flags {