diff --git a/lib/utils.pm b/lib/utils.pm index d1d35851..bb7ac2e6 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -7,7 +7,7 @@ use Exporter; use lockapi; use testapi; -our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader get_milestone boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests/; +our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader get_milestone boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox/; sub run_with_error_check { my ($func, $error_screen) = @_; @@ -657,3 +657,18 @@ sub download_modularity_tests { assert_script_run 'curl -o /root/test.py https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/modular_functions.py'; assert_script_run 'chmod 755 /root/test.py'; } + +sub quit_firefox { +# Quit Firefox, handling the 'close multiple tabs' warning screen if +# it shows up + send_key "ctrl-q"; + # expect to get to either the tabs warning or a console + if (check_screen ["user_console", "root_console", "firefox_close_tabs"], 30) { + # if we hit a console, we're done + return unless match_has_tag "firefox_close_tabs"; + # otherwise, POJITO + assert_and_click "firefox_close_tabs"; + } + # it's a bit odd if we reach here, but could mean we quit to a + # desktop, or the firefox_close_tabs needle went stale... +} diff --git a/needles/firefox/firefox_close_tabs-20181031.json b/needles/firefox/firefox_close_tabs-20181031.json new file mode 100644 index 00000000..da51ed46 --- /dev/null +++ b/needles/firefox/firefox_close_tabs-20181031.json @@ -0,0 +1,15 @@ +{ + "tags": [ + "firefox_close_tabs" + ], + "properties": [], + "area": [ + { + "xpos": 669, + "ypos": 416, + "width": 66, + "height": 20, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/firefox/firefox_close_tabs-20181031.png b/needles/firefox/firefox_close_tabs-20181031.png new file mode 100644 index 00000000..39da362a Binary files /dev/null and b/needles/firefox/firefox_close_tabs-20181031.png differ diff --git a/tests/freeipa_password_change.pm b/tests/freeipa_password_change.pm index d573d527..bfae9b57 100644 --- a/tests/freeipa_password_change.pm +++ b/tests/freeipa_password_change.pm @@ -36,7 +36,7 @@ sub run { assert_and_click "freeipa_webui_logout"; wait_still_screen 3; # close browser, back to console - send_key "ctrl-q"; + quit_firefox; # we don't get back to a prompt instantly and keystrokes while X # is still shutting down are swallowed, so wait_still_screen before # finishing (and handing off to freeipa_client_postinstall) diff --git a/tests/freeipa_webui.pm b/tests/freeipa_webui.pm index f142fc92..4e225423 100644 --- a/tests/freeipa_webui.pm +++ b/tests/freeipa_webui.pm @@ -41,7 +41,7 @@ sub run { wait_still_screen 1; assert_and_click "freeipa_webui_policy_save"; # quit browser to return to console - send_key "ctrl-q"; + quit_firefox; # we don't get back to a prompt instantly and keystrokes while X # is still shutting down are swallowed, so wait_still_screen before # finishing (and handing off to freeipa_client_postinstall) diff --git a/tests/realmd_join_cockpit.pm b/tests/realmd_join_cockpit.pm index bc76f124..916f88fa 100644 --- a/tests/realmd_join_cockpit.pm +++ b/tests/realmd_join_cockpit.pm @@ -38,7 +38,7 @@ sub run { # join involves package installs, so it may take some time assert_screen "cockpit_join_complete", 300; # quit browser to return to console - send_key "ctrl-q"; + quit_firefox; # we don't get back to a prompt instantly and keystrokes while X # is still shutting down are swallowed, so wait_still_screen before # finishing (and handing off to freeipa_client_postinstall) diff --git a/tests/server_cockpit_default.pm b/tests/server_cockpit_default.pm index 95461734..054f14b7 100644 --- a/tests/server_cockpit_default.pm +++ b/tests/server_cockpit_default.pm @@ -12,7 +12,7 @@ sub run { # test cockpit web UI start start_cockpit(0); # quit firefox (return to console) - send_key "ctrl-q"; + quit_firefox; } sub test_flags {