Factor out clicking of update and akonadi notifications in KDE

There are three places where we basically want to click away
pop-up update notifications and the buggy akonadi_migration_agent
notification if it's there, in KDE tests. Let's share this code
between them, and also let's record soft failures for the buggy
cases in the desktop_notifications test.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-07-17 09:02:24 -07:00
parent eba6818f5b
commit 25f408ea7e
4 changed files with 39 additions and 31 deletions

View File

@ -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 start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean 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 bypass_1691487 get_release_number _assert_and_click/;
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 start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean 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 bypass_1691487 get_release_number _assert_and_click click_unwanted_notifications/;
sub run_with_error_check {
my ($func, $error_screen) = @_;
@ -911,3 +911,26 @@ sub _assert_and_click {
return assert_and_click($mustmatch, $args{button}, $args{timeout}, 0, $args{dclick});
}
}
sub click_unwanted_notifications {
# there are a few KDE tests where at some point we want to click
# on all visible 'update available' notifications (there can be
# more than one, thanks to
# https://bugzilla.redhat.com/show_bug.cgi?id=1730482 ) and the
# buggy 'akonadi_migration_agent' notification if it's showing -
# https://bugzilla.redhat.com/show_bug.cgi?id=1716005
# Returns an array indicating which notifications it closed
wait_still_screen 5;
my $count = 10;
my @closed;
while ($count > 0 && check_screen "desktop_update_notification_popup", 5) {
$count -= 1;
push (@closed, 'update');
assert_and_click "desktop_update_notification_popup";
}
if (check_screen "akonadi_migration_agent", 5) {
assert_and_click "akonadi_migration_agent";
push (@closed, 'akonadi');
}
return @closed;
}

View File

@ -30,23 +30,8 @@ sub run {
wait_still_screen 2;
# Close the application
assert_and_click "kde_ok";
# If Updates Available notification(s) is/are shown, we want
# to get rid of that, because it can be later displayed
# over some applications preventing openQA to find
# correct buttons, which creates false positives. See
# https://bugzilla.redhat.com/show_bug.cgi?id=1730482 for
# KDE showing multiple notifications
my $count = 10;
while ($count > 0 && check_screen "desktop_update_notification_popup", 5) {
$count -= 1;
assert_and_click "desktop_update_notification_popup";
}
# also close akonadi_migration_agent notification if it shows up
# otherwise it makes wait_still_screen always time out
# https://bugzilla.redhat.com/show_bug.cgi?id=1716005
if (check_screen "akonadi_migration_agent", 10) {
assert_and_click "akonadi_migration_agent";
}
# get rid of unwanted notifications that interfere with tests
click_unwanted_notifications;
}
sub test_flags {

View File

@ -98,10 +98,16 @@ sub run {
# then check there are no others; see
# https://bugzilla.redhat.com/show_bug.cgi?id=1730482 for
# KDE showing multiple notifications
my $count = 10;
while (check_screen "desktop_update_notification", 5 && $count > 0) {
$count -= 1;
assert_and_click "desktop_update_notification";
my @closed = click_unwanted_notifications;
if (grep {$_ eq 'akonadi'} @closed) {
# this isn't an SELinux denial or a crash, so it's not
# a hard failure...
record_soft_failure "stuck akonadi_migration_agent notification - RHBZ #1716005";
}
my @upnotes = grep {$_ eq 'update'} @closed;
if (scalar @upnotes > 1) {
# Also not a hard failure, but worth noting
record_soft_failure "multiple update notifications - RHBZ #1730482";
}
}
# the order and number of systray icons varies in KDE, so we

View File

@ -30,15 +30,9 @@ sub run {
# run the updater
if ($desktop eq 'kde') {
# if the permanent pop-up notification appeared, get rid of
# it, as it blocks the refresh button. For extra fun, we can
# get *more than one* of them, so just keep clicking till
# they're all gone, up to 10 at least
my $count = 10;
while (check_screen "desktop_update_notification_popup", 10 && $count > 0) {
$count -=1;
assert_and_click "desktop_update_notification_popup";
}
# get rid of notifications which get in the way of the things
# we need to click
click_unwanted_notifications;
# KDE team tells me the 'preferred' update method is the
# systray applet
assert_and_click 'desktop_expand_systray';