os-autoinst-distri-rocky/tests/desktop_notifications_postinstall.pm
Adam Williamson ddc91efeff detect (rather than guessing) desktop vt
use 'ps' output for Xorg and Xwayland. We'd need some new
openQA var to get this right by 'guessing', as it's vt1 for
Workstation when running live - so long as autologin worked -
but vt2 after install. We'd need a var or some other thing to
detect which case we're running in. LIVE doesn't do it, it's
set even when running a post-install test from a live image.

So instead let's just do it a bit more cleverly. This also
gives us a bit of insurance against changes in GDM, SDDM etc.
behaviour, so long as Xwayland or Xorg is running (and we can
add additional processes to the list, like gnome-shell, if
needed/appropriate). We assume the *final* listed process -
i.e. the most recently-started one - will be the desktop;
this covers gdm's behaviour of starting up on vt1 then running
the user session on vt2. We can make this function more complex
and add args if we ever get to the point where we have multi-
user tests running or anything (e.g. allow to pass a username
and only look for that user's processes).

Landing without review as this broke the live variant of the
test on Workstation in production (kinda not sure why it worked
in testing, or I didn't notice that it failed, but never mind).
I've tested it on staging.
2016-09-24 13:04:04 -07:00

72 lines
2.4 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use main_common;
use packagetest;
# This test sort of covers QA:Testcase_desktop_update_notification
# and QA:Testcase_desktop_error_checks . If it fails, probably *one*
# of those failed, but we don't know which (deciphering which is
# tricky and involves likely-fragile needles to try and figure out
# what notifications we have).
sub run {
my $self = shift;
# for the live image case, handle bootloader here
unless (get_var("BOOTFROM")) {
$self->do_bootloader(postinstall=>0);
}
assert_screen "graphical_desktop_clean", 300;
# ensure we actually have some package updates available
# we're kinda theoretically racing with the update check here,
# but we have no great way to handle that especially live; let's
# just assume we're gonna win
$self->root_console(tty=>3);
prepare_test_packages;
desktop_vt;
# now, WE WAIT. this is just an unconditional wait - rather than
# breaking if we see an update notification appear - so we catch
# things that crash a few minutes after startup, etc.
for my $n (1..5) {
sleep 120;
mouse_set 10, 10;
mouse_hide;
}
my $desktop = get_var("DESKTOP");
if ($desktop eq 'gnome') {
# of course, we have no idea what'll be in the clock, so we just
# have to click where we know it is
mouse_set 512, 10;
mouse_click;
}
elsif ($desktop eq 'kde' && !get_var("BOOTFROM")) {
# the order and number of systray icons varies in KDE, so we
# can't really just use a systray 'no notifications' needle.
# instead open up the 'extended systray' thingy and click on
# the notifications bit
assert_and_click 'desktop_expand_systray';
assert_and_click 'desktop_systray_notifications';
}
if (get_var("BOOTFROM")) {
# we should see an update notification and no others
check_screen "desktop_update_notification_only";
}
else {
# for the live case there should be *no* notifications
assert_screen "desktop_no_notifications";
}
}
sub test_flags {
# without anything - rollback to 'lastgood' snapshot if failed
# 'fatal' - whole test suite is in danger if this fails
# 'milestone' - after this test succeeds, update 'lastgood'
# 'important' - if this fails, set the overall state to 'fail'
return { fatal => 1 };
}
1;
# vim: set sw=4 et: