From 4bed0588344a65efbe306a999ec93925b9f57674 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 22 Sep 2021 14:10:04 -0700 Subject: [PATCH] GNOME application tests: robustify various spots with waits These tests are failing a lot in various places on aarch64. We just need to slow down a bit and let the poor thing catch up sometimes. Signed-off-by: Adam Williamson --- lib/utils.pm | 16 +++++++++++++++- tests/applications/evince/aaa_setup.pm | 10 ++++++++++ tests/applications/gedit/aaa_setup.pm | 12 ++++++++++-- tests/applications/gedit/delete_line.pm | 1 + tests/applications/gedit/find_text.pm | 7 +++---- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 23ce9f64..ef83152f 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 boot_decrypt check_release menu_launch_type repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper check_and_install_git download_testdata/; +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 boot_decrypt check_release menu_launch_type repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper check_and_install_git download_testdata disable_update_notifications/; # We introduce this global variable to hold the list of applications that have # registered during the apps_startstop_test when they have sucessfully run. @@ -1460,4 +1460,18 @@ sub download_testdata { assert_script_run("chown -R test:test $location"); } +# Disable update notifications on GNOME to avoid them popping up and +# messing up a needle match in a running test. +sub disable_update_notifications { + menu_launch_type "gnome-terminal"; + # wait to be sure it's fully open + wait_still_screen 5; + # When the application opens, run command in it to set the background to black + type_very_safely "gsettings set org.gnome.software download-updates-notify false\n"; + wait_still_screen 2; + send_key 'alt-f4'; + wait_still_screen 5; +} + + 1; diff --git a/tests/applications/evince/aaa_setup.pm b/tests/applications/evince/aaa_setup.pm index da65a8cb..683e7b66 100644 --- a/tests/applications/evince/aaa_setup.pm +++ b/tests/applications/evince/aaa_setup.pm @@ -17,15 +17,23 @@ sub run { download_testdata("evince", "Documents"); # Exit the terminal desktop_vt; + # slow down keypresses a bit to try and avoid sequences like + # ctrl-o failing on aarch64 + set_var("VNC_TYPING_LIMIT_DEFAULT", 5); + + disable_update_notifications; # Start the application menu_launch_type("evince"); # Check that is started assert_screen 'apps_run_dviewer'; + wait_still_screen 5; # Open the test file to create a starting point for the other Evince tests. # Click on Open button to open the File Open Dialog assert_and_click("evince_open_file_dialog", button => "left", timeout => 30); + # wait out the animation + wait_still_screen 5; if (get_var("CANNED")) { # open the Documents folder. @@ -43,6 +51,8 @@ sub run { # Check that the file has been successfully opened. assert_screen("evince_file_opened"); + # let things settle down before we screenshot. + wait_still_screen 5; } sub test_flags { diff --git a/tests/applications/gedit/aaa_setup.pm b/tests/applications/gedit/aaa_setup.pm index 2548dbc4..bc549b39 100644 --- a/tests/applications/gedit/aaa_setup.pm +++ b/tests/applications/gedit/aaa_setup.pm @@ -7,7 +7,6 @@ use utils; sub run { my $self = shift; - # Go to the root console to set up the test data and necessary stuff. $self->root_console(tty=>3); @@ -16,16 +15,23 @@ sub run { download_testdata("gedit", "Documents"); # Return to Desktop desktop_vt(); + # slow down keypresses a bit to try and avoid sequences like + # ctrl-o failing on aarch64 + set_var("VNC_TYPING_LIMIT_DEFAULT", 5); + + disable_update_notifications; # Start the application menu_launch_type("gedit"); # Check that it started assert_screen("apps_run_texteditor"); + wait_still_screen 5; # Open the test file send_key("ctrl-o"); - # Open the documents location + # Wait out animation, then open the documents location + wait_still_screen 5; assert_and_click("gnome_open_location_documents"); # Choose the file @@ -39,6 +45,8 @@ sub run { # Check that the document has been opened assert_screen("gedit_text_file_opened"); + # let things settle down before we screenshot + wait_still_screen 5; } sub test_flags { diff --git a/tests/applications/gedit/delete_line.pm b/tests/applications/gedit/delete_line.pm index bcd0d20d..6f628726 100644 --- a/tests/applications/gedit/delete_line.pm +++ b/tests/applications/gedit/delete_line.pm @@ -10,6 +10,7 @@ sub run { my $self = shift; # Click on a word on the line. assert_and_click "gedit_line_word"; + wait_still_screen 2; # Delete the line send_key("ctrl-d"); # Move cursor out of the way. diff --git a/tests/applications/gedit/find_text.pm b/tests/applications/gedit/find_text.pm index 9e9811b0..b945d5ef 100644 --- a/tests/applications/gedit/find_text.pm +++ b/tests/applications/gedit/find_text.pm @@ -8,11 +8,10 @@ use utils; # that spelling control can be used to find and replace spelling mistakes. sub run { - my $self = shift; # Search the text for specific string. - # At first, Wait 1 second for the test to get ready, as the control character was not properly recognized - # when the test started immediately after the rollback. - sleep 1; + my $self = shift; + # wait a bit for system to settle + wait_still_screen 5; # Invoke the Find dialogue send_key "ctrl-f"; # Type string