1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-21 21:43:08 +00:00

Change up 'clean desktop' check again (use a util function)

Well, that OCR needle isn't working out so great, as it seems
to match when it shouldn't:

https://openqa.fedoraproject.org/tests/119217#step/_graphical_wait_login/5

So let's try another approach. Ditch the OCR needle and have a
function for checking we're at a clean desktop. It does the
normal needle match, but if we're on GNOME, it also tries
hitting alt+f1 and seeing if we're at the overview; if so, it
hits alt+f1 again (to go back to the desktop) and returns.
This commit is contained in:
Adam Williamson 2017-07-10 11:41:02 -07:00
parent 9cc8b594fe
commit aca7de2861
10 changed files with 60 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 get_milestone boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user/;
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/;
sub run_with_error_check {
my ($func, $error_screen) = @_;
@ -482,3 +482,41 @@ sub anaconda_create_user {
assert_and_click "anaconda_spoke_done";
}
}
sub check_desktop_clean {
# Check we're at a 'clean' desktop. This used to be a simple
# needle check, but Rawhide's default desktop is now one which
# changes over time, and the GNOME top bar is now translucent
# by default; together these changes mean it's impossible to
# make a reliable needle, so we need something more tricksy to
# cover that case. 'tries' is the amount of check cycles to run
# before giving up and failing; each cycle should take ~3 secs.
my %args = (
tries => 10,
@_
);
foreach my $i (1..$args{tries}) {
# we still *do* the needle check, for all cases it covers
return if (check_screen "graphical_desktop_clean", 1);
# now do the special GNOME case
if (get_var("DESKTOP") eq "gnome") {
send_key "alt-f1";
if (check_screen "overview_app_grid", 2) {
send_key "alt-f1";
wait_still_screen 3;
# go back to the desktop, if we're still at the app
# grid (can be a bit fuzzy depending on response lag)
while (check_screen "overview_app_grid", 1) {
send_key "alt-f1";
wait_still_screen 3;
}
return;
}
}
else {
# to keep the timing equal
sleep 2;
}
}
die "Clean desktop not reached!";
}

View File

@ -1,25 +0,0 @@
{
"area": [
{
"height": 15,
"type": "ocr",
"width": 67,
"xpos": 9,
"ypos": 6
},
{
"height": 1,
"type": "match",
"width": 1,
"xpos": 946,
"ypos": 12
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"ENV-DISTRI-fedora",
"LANGUAGE-english",
"graphical_desktop_clean"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"height": 45,
"type": "match",
"width": 45,
"xpos": 24,
"ypos": 657
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"overview_app_grid"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

View File

@ -26,7 +26,7 @@ sub run {
send_key "esc";
send_key "esc";
send_key "esc";
assert_screen "graphical_desktop_clean";
check_desktop_clean;
}
}

View File

@ -89,7 +89,7 @@ sub run {
# Move the mouse somewhere it won't highlight the match areas
mouse_set(300, 200);
# KDE can take ages to start up
assert_screen "graphical_desktop_clean", 120;
check_desktop_clean(tries=>40);
}
}

View File

@ -14,7 +14,7 @@ use utils;
sub run {
my $self = shift;
assert_screen 'graphical_desktop_clean';
check_desktop_clean;
send_key 'alt-f1';
# wait out animations
wait_still_screen 2;

View File

@ -65,7 +65,7 @@ sub run {
type_very_safely get_var("USER_PASSWORD", "weakpassword");
send_key 'ret';
}
assert_screen 'graphical_desktop_clean', 90;
check_desktop_clean(tries=>30);
# 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.

View File

@ -5,7 +5,7 @@ use utils;
sub run {
my $self=shift;
assert_screen 'graphical_desktop_clean';
check_desktop_clean;
menu_launch_type('terminal');
wait_still_screen 5;
# need to be root