Skip to content

Commit

Permalink
Use more strict 'assert_screen_change' where possible
Browse files Browse the repository at this point in the history
os-autoinst/os-autoinst#689 added a new function to
the testapi 'assert_screen_change' which should be used wherever there is no
explicit checking of the return value of 'wait_screen_change'.

Leaving alone the occurences of 'wait_screen_change' where the return code
is checked.
  • Loading branch information
okurz committed May 15, 2017
1 parent 1956b9d commit 6095ef7
Show file tree
Hide file tree
Showing 40 changed files with 125 additions and 115 deletions.
2 changes: 1 addition & 1 deletion lib/installation_user_settings.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use testapi;

sub type_password_and_verification {
for (1 .. 2) {
wait_screen_change { type_string "$password\t" };
assert_screen_change { type_string "$password\t" };
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/registration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ sub fill_in_registration_data {
if (!check_screen(\@known_untrusted_keys, 0)) {
record_soft_failure 'untrusted gpg key';
}
wait_screen_change {
assert_screen_change {
send_key 'alt-t';
};
next;
Expand Down
4 changes: 2 additions & 2 deletions lib/susedistribution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use utils 'ensure_unlocked_desktop';
use testapi qw(send_key %cmd assert_screen check_screen check_var get_var save_screenshot
match_has_tag set_var type_password type_string wait_idle wait_serial
mouse_hide send_key_until_needlematch record_soft_failure
wait_still_screen wait_screen_change);
wait_still_screen assert_screen_change);


sub handle_password_prompt {
Expand Down Expand Up @@ -132,7 +132,7 @@ sub x11_start_program($$$) {
if ($options->{valid}) {
for (1 .. 3) {
last unless check_screen 'desktop-runner-border', 2;
wait_screen_change {
assert_screen_change {
send_key 'ret';
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ sub ensure_unlocked_desktop {
last; # desktop is unlocked, mission accomplished
}
if (match_has_tag 'screenlock') {
wait_screen_change {
assert_screen_change {
send_key 'esc'; # end screenlock
};
}
Expand Down
48 changes: 24 additions & 24 deletions lib/x11regressiontest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sub import_pictures {
}

# Open the dialog 'Import From Folder'
wait_screen_change {
assert_screen_change {
send_key "ctrl-i";
};
assert_screen 'shotwell-importing';
Expand Down Expand Up @@ -62,7 +62,7 @@ sub upload_libreoffice_specified_file() {
wait_still_screen;
type_string("cd /home/$username/Documents && ls -l");
send_key "ret";
wait_screen_change {
assert_screen_change {
assert_screen("libreoffice-find-tar-file");
type_string("tar -xjvf ooo-test-doc-types.tar.bz2");
send_key "ret";
Expand All @@ -80,7 +80,7 @@ sub cleanup_libreoffice_specified_file() {
wait_still_screen;
type_string("ls -l /home/$username/Documents");
send_key "ret";
wait_screen_change {
assert_screen_change {
assert_screen("libreoffice-find-no-tar-file");
};
wait_still_screen;
Expand Down Expand Up @@ -279,11 +279,11 @@ sub start_evolution {
assert_screen "evolution_wizard-restore-backup";
send_key $self->{next};
assert_screen "evolution_wizard-identity";
wait_screen_change {
assert_screen_change {
send_key "alt-e";
};
type_string "SUSE Test";
wait_screen_change {
assert_screen_change {
send_key "alt-a";
};
type_string "$mail_box";
Expand Down Expand Up @@ -331,40 +331,40 @@ sub setup_mail_account {
}

assert_screen "evolution_wizard-receiving";
wait_screen_change {
assert_screen_change {
send_key "alt-t";
};
send_key "ret";
send_key_until_needlematch "evolution_wizard-receiving-$proto", "down", 10, 3;
wait_screen_change {
assert_screen_change {
send_key "ret";
};
wait_screen_change {
assert_screen_change {
send_key "alt-s";
};
type_string "$mail_recvServer";
if ($proto eq 'pop') {
#No need set receive port with POP
}
elsif ($proto eq 'imap') {
wait_screen_change {
assert_screen_change {
send_key "alt-p";
};
type_string "$mail_recvport";
}
else {
die "Unsupported protocol: $proto";
}
wait_screen_change {
assert_screen_change {
send_key "alt-n";
};
type_string "$mail_user";
wait_screen_change {
assert_screen_change {
send_key "alt-m";
};
send_key "ret";
send_key_until_needlematch "evolution_wizard-receiving-ssl", "down", 5, 3;
wait_screen_change {
assert_screen_change {
send_key "ret";
};
$self->evolution_add_self_signed_ca($account);
Expand All @@ -377,35 +377,35 @@ sub setup_mail_account {

#setup sending protocol as smtp
assert_screen "evolution_wizard-sending";
wait_screen_change {
assert_screen_change {
send_key "alt-t";
};
send_key "ret";
save_screenshot;
send_key_until_needlematch "evolution_wizard-sending-smtp", "down", 5, 3;
wait_screen_change {
assert_screen_change {
send_key "ret";
};
wait_screen_change {
assert_screen_change {
send_key "alt-s";
};
type_string "$mail_sendServer";
wait_screen_change {
assert_screen_change {
send_key "alt-p";
};
type_string "$mail_sendport";
wait_screen_change {
assert_screen_change {
send_key "alt-v";
};
wait_screen_change {
assert_screen_change {
send_key "alt-m";
};
send_key "ret";
send_key_until_needlematch "evolution_wizard-sending-starttls", "down", 5, 3;
send_key "ret";

#Known issue: hot key 'alt-y' doesn't work
#wait_screen_change {
#assert_screen_change {
# send_key "alt-y";
#};
#send_key "ret";
Expand All @@ -415,7 +415,7 @@ sub setup_mail_account {
assert_and_click "evolution_wizard-sending-setauthtype";
send_key_until_needlematch "evolution_wizard-sending-authtype", "down", 5, 3;
send_key "ret";
wait_screen_change {
assert_screen_change {
send_key "alt-n";
};
sleep 1;
Expand Down Expand Up @@ -520,11 +520,11 @@ sub setup_evolution_for_ews {
assert_screen "evolution_wizard-restore-backup";
send_key "alt-o";
assert_screen "evolution_wizard-identity";
wait_screen_change {
assert_screen_change {
send_key "alt-e";
};
type_string "SUSE Test";
wait_screen_change {
assert_screen_change {
send_key "alt-a";
};
type_string "$mailbox";
Expand All @@ -538,7 +538,7 @@ sub setup_evolution_for_ews {
assert_screen 'evolution_wizard-receiving';
}

wait_screen_change {
assert_screen_change {
send_key "alt-t";
};
send_key "ret";
Expand Down Expand Up @@ -596,7 +596,7 @@ sub evolution_send_message {
assert_screen "evolution_mail-compose-message";
assert_and_click "evolution_mail-message-to";
type_string "$mailbox";
wait_screen_change {
assert_screen_change {
send_key "alt-u";
};
wait_still_screen;
Expand Down
6 changes: 3 additions & 3 deletions lib/y2logsstep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ sub get_to_console() {
# to workaround dep issues
sub record_dependency_issues {
while (check_screen 'dependancy-issue', 5) {
wait_screen_change {
assert_screen_change {
if (check_var('VIDEOMODE', 'text')) {
send_key 'alt-s';
}
else {
send_key 'alt-1';
}
};
wait_screen_change {
assert_screen_change {
send_key 'spc';
};
send_key 'alt-o';
Expand All @@ -92,7 +92,7 @@ sub check_and_record_dependency_problems {

if (get_var("WORKAROUND_DEPS")) {
$self->record_dependency_issues;
wait_screen_change {
assert_screen_change {
send_key 'alt-a';
};
send_key 'alt-o';
Expand Down
2 changes: 1 addition & 1 deletion tests/autoyast/installation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sub accept_license {
send_key $cmd{accept};
$confirmed_licenses++;
# Prevent from matching previous license
wait_screen_change {
assert_screen_change {
send_key $cmd{next};
};
}
Expand Down
2 changes: 1 addition & 1 deletion tests/console/yast2_bootloader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sub run() {
send_key "alt-o"; # OK => Close
assert_screen([qw(yast2_bootloader-missing_package yast2_console-finished)], 200);
if (match_has_tag('yast2_bootloader-missing_package')) {
wait_screen_change { send_key 'alt-i'; };
assert_screen_change { send_key 'alt-i'; };
}
assert_screen 'yast2_console-finished', 200;
wait_serial("yast2-bootloader-status-0") || die "'yast2 bootloader' didn't finish";
Expand Down
4 changes: 2 additions & 2 deletions tests/console/yast2_i.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ sub run() {
assert_screen ['yast2-sw-packages-autoselected', 'yast2-sw_automatic-changes', 'yast2-sw_shows_summary'], 60;
# automatic changes for manual selections
if (match_has_tag('yast2-sw-packages-autoselected') or match_has_tag('yast2-sw_automatic-changes')) {
wait_screen_change { send_key 'alt-o' };
assert_screen_change { send_key 'alt-o' };
next;
}
elsif (match_has_tag('yast2-sw_shows_summary')) {
wait_screen_change { send_key 'alt-f' };
assert_screen_change { send_key 'alt-f' };
last;
}
}
Expand Down
20 changes: 10 additions & 10 deletions tests/console/yast2_nis.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sub run() {
script_run "zypper -n in yast2-nis-client"; # make sure yast client module installed
type_string "yast2 nis\n";
assert_screen 'nis-client';
wait_screen_change { send_key 'alt-u' };
assert_screen_change { send_key 'alt-u' };
send_key 'alt-m';
assert_screen 'nis-client-automounter-enabled'; # this checks if nis and automounter got really enabled
send_key 'alt-i'; # enter Nis domain for enter string suse.de
Expand All @@ -29,21 +29,21 @@ sub run() {
type_string "10.162.0.1";
send_key 'alt-t'; # open port in firewall
assert_screen 'open_port_in_firewall'; # check the port is open
wait_screen_change { send_key 'alt-p' }; # check Netconfif NIS Policy
assert_screen_change { send_key 'alt-p' }; # check Netconfif NIS Policy
send_key 'up';
wait_screen_change { send_key 'ret' };
assert_screen_change { send_key 'ret' };
assert_screen 'only-manual-changes'; # check the needle
send_key 'alt-p'; # enter Netconfif NIS Policy again for custom policy
wait_screen_change { send_key 'down' };
assert_screen_change { send_key 'down' };
send_key 'ret';
wait_screen_change { send_key 'alt-x' }; # check Expert...
wait_screen_change { send_key 'alt-b' };
assert_screen_change { send_key 'alt-x' }; # check Expert...
assert_screen_change { send_key 'alt-b' };
assert_screen 'expert_settings'; # check the needle enable Broken server
send_key 'alt-y';
wait_screen_change { type_string "-c" }; # only checks if the config file has syntax errors and exits
assert_screen_change { type_string "-c" }; # only checks if the config file has syntax errors and exits
send_key 'alt-o';
assert_screen 'nis-client-configuration';
send_key 'alt-s'; # enter NFS configuration...
assert_screen_change { send_key 'alt-s' }; # enter NFS configuration...
assert_screen 'nfs-client-configuration'; # add nfs settings
send_key 'alt-a';
assert_screen 'nfs-server-hostname'; # check that type string is sucessful
Expand All @@ -55,10 +55,10 @@ sub run() {
type_string "/mounts_local";
send_key 'alt-o';
assert_screen 'nfs_server_added'; # check Mount point
wait_screen_change { send_key 'alt-t' }; # go back to nfs configuration and delete configuration created before
assert_screen_change { send_key 'alt-t' }; # go back to nfs configuration and delete configuration created before
assert_screen 'nis_server_delete'; # confirm to delete configuration
send_key 'alt-y';
wait_screen_change { send_key 'alt-o' };
assert_screen_change { send_key 'alt-o' };
send_key 'alt-f'; # close the dialog...
assert_screen 'nis_server_not_found'; # check error message for 'nis server not found'
send_key 'alt-o'; # close it now even when config is not valid
Expand Down
6 changes: 3 additions & 3 deletions tests/installation/change_desktop.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ sub change_desktop() {
else {
if (!check_var('DESKTOP', 'gnome')) {
send_key_until_needlematch 'gnome-selected', 'down', 10;
wait_screen_change { send_key ' '; };
assert_screen_change { send_key ' '; };
}
if (check_var('DESKTOP', 'kde')) {
send_key_until_needlematch 'kde-unselected', 'down', 10;
wait_screen_change { send_key ' '; };
assert_screen_change { send_key ' '; };
}
if (check_var('DESKTOP', 'textmode')) {
send_key_until_needlematch 'x11-selected', 'down', 10;
wait_screen_change { send_key ' '; };
assert_screen_change { send_key ' '; };
}
assert_screen "desktop-selected";
}
Expand Down
2 changes: 1 addition & 1 deletion tests/installation/encrypted_volume_activation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ my $after_cancel_tags = [
sub run {
assert_screen 'encrypted_volume_activation_prompt';
if (get_var('ENCRYPT_CANCEL_EXISTING')) {
wait_screen_change { send_key 'alt-c'; };
assert_screen_change { send_key 'alt-c'; };
assert_screen($after_cancel_tags);
if (match_has_tag('encrypted_volume_activation_prompt')) {
record_soft_failure 'bsc#989770';
Expand Down
2 changes: 1 addition & 1 deletion tests/installation/first_boot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ sub post_fail_hook() {
my $self = shift;

# Reveal what is behind Plymouth splash screen
wait_screen_change {
assert_screen_change {
send_key 'esc';
};
# if we found a shell, we do not need the memory dump
Expand Down
2 changes: 1 addition & 1 deletion tests/installation/install_and_reboot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ sub run() {
$self->save_upload_y2logs();
select_console 'installation';
}
wait_screen_change {
assert_screen_change {
send_key 'alt-o'; # Reboot
};

Expand Down
4 changes: 2 additions & 2 deletions tests/installation/partitioning_firstdisk.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ sub run() {
send_key $cmd{createpartsetup};
assert_screen 'prepare-hard-disk';

wait_screen_change {
assert_screen_change {
send_key 'alt-1';
};
send_key 'alt-n';

assert_screen 'use-entire-disk';
wait_screen_change {
assert_screen_change {
send_key 'alt-e';
};
send_key $cmd{next};
Expand Down
2 changes: 1 addition & 1 deletion tests/installation/partitioning_raid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sub addraid {
# add
send_key $cmd{add};
wait_still_screen;
wait_screen_change {
assert_screen_change {
send_key $cmd{next};
};

Expand Down
Loading

0 comments on commit 6095ef7

Please sign in to comment.