Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first_boot: Simplify periodic check/assert_screen to not miss generic-desktop #1794

Merged
merged 4 commits into from Sep 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/main_common.pm
Expand Up @@ -51,15 +51,20 @@ sub set_defaults_for_username_and_password {
$testapi::password = '';
}
else {
$testapi::username = "bernhard";
if (get_var('FLAVOR', '') =~ /SAP/) {
$testapi::username = "root"; #in sles4sap only root user created
}
else {
$testapi::username = "bernhard";
}
$testapi::password = "nots3cr3t";
}

$testapi::username = get_var("USERNAME") if get_var("USERNAME");
$testapi::password = get_var("PASSWORD") if defined get_var("PASSWORD");

if (get_var("LIVETEST") && (get_var("LIVECD") || get_var("PROMO"))) {
$testapi::username = "linux"; # LiveCD account
$testapi::username = "linux"; # LiveCD account
$testapi::password = "";
}
}
Expand Down
113 changes: 48 additions & 65 deletions tests/installation/first_boot.pm
Expand Up @@ -12,6 +12,33 @@ use strict;
use base "y2logsstep";
use testapi;

sub handle_login {
if (get_var('DESKTOP_MINIMALX_INSTONLY')) {
# return at the DM and log in later into desired wm
return;
}
mouse_hide();
wait_still_screen;
if (get_var('DM_NEEDS_USERNAME')) {
type_string $username;
}
if (match_has_tag("sddm")) {
# make sure choose plasma5 session
assert_and_click "sddm-sessions-list";
assert_and_click "sddm-sessions-plasma5";
assert_and_click "sddm-password-input";
}
else {
send_key "ret";
if (!check_screen "displaymanager-password-prompt") {
record_soft_failure;
assert_screen "displaymanager-password-prompt";
}
}
type_string "$password";
send_key "ret";
}

sub run() {
my $self = shift;

Expand All @@ -24,6 +51,7 @@ sub run() {

if (get_var("NOAUTOLOGIN") || get_var("IMPORT_USER_DATA")) {
assert_screen [qw/displaymanager emergency-shell emergency-mode/], 200;
handle_login;
if (match_has_tag('emergency-shell')) {
# get emergency shell logs for bug, scp doesn't work
script_run "cat /run/initramfs/rdsosreport.txt > /dev/$serialdev";
Expand All @@ -32,74 +60,29 @@ sub run() {
type_password;
send_key 'ret';
}
if (get_var('DESKTOP_MINIMALX_INSTONLY')) {
# return at the DM and log in later into desired wm
return;
}
mouse_hide();
wait_still_screen;
if (get_var('DM_NEEDS_USERNAME')) {
type_string $username;
}
if (get_var('FLAVOR', '') =~ /SAP/) {
type_string "root"; #in sles4sap only root user created
}
if (match_has_tag("sddm")) {
# make sure choose plasma5 session
assert_and_click "sddm-sessions-list";
assert_and_click "sddm-sessions-plasma5";
assert_and_click "sddm-password-input";
}
else {
send_key "ret";
if (!check_screen "displaymanager-password-prompt") {
record_soft_failure;
assert_screen "displaymanager-password-prompt";
}
}
type_string "$password";
send_key "ret";
}

# 2 is not magic number here, we're using 400 seconds in the past,
# decrease the timeout to 300 seconds now thus doing two times.
my $retry = 2;
# Check for errors during first boot
while ($retry) {
# GNOME and KDE get into screenlock after 5 minutes without activities.
# using 300 seconds here then we can get the wrong desktop screenshot at least
# in case desktop screenshot changed, otherwise we get the screenlock screenshot.
my $ret = check_screen "generic-desktop", 300;
if ($ret) {
mouse_hide();
last;
}
else {
# special case for KDE
if (check_var("DESKTOP", "kde")) {
# KDE Greeter was removed from Leap 42.1 though
if (check_screen "kde-greeter", 60) {
send_key "esc";
next;
}
if (check_screen "drkonqi-crash") {
# handle for KDE greeter crashed and drkonqi popup
send_key "alt-d";

# maximize
send_key "alt-shift-f3";
sleep 8;
save_screenshot;
send_key "alt-c";
next;

}
}
}
$retry--;
my @tags = qw/generic-desktop/;
if (check_var('DESKTOP', 'kde') && get_var('VERSION', '') =~ /^1[23]/) {
push(@tags, 'kde-greeter');
}
# GNOME and KDE get into screenlock after 5 minutes without activities.
# using multiple check intervals here then we can get the wrong desktop
# screenshot at least in case desktop screenshot changed, otherwise we get
# the screenlock screenshot.
my $timeout = 600;
my $check_interval = 30;
while ($timeout > $check_interval) {
my $ret = check_screen \@tags, $check_interval;
last if $ret;
$timeout -= $check_interval;
}
# the last check after previous intervals must be fatal
assert_screen \@tags, $check_interval;
if (match_has_tag('kde-greeter')) {
send_key "esc";
assert_screen 'generic-desktop';
}
# get the last screenshot
assert_screen "generic-desktop", 5;
}

sub test_flags() {
Expand Down