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 Jan 13, 2017
1 parent 4d8f4d8 commit b034e97
Show file tree
Hide file tree
Showing 43 changed files with 123 additions and 123 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 @@ -180,7 +180,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 @@ -9,7 +9,7 @@ use strict;
use testapi qw(send_key %cmd assert_screen check_screen check_var get_var
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 @@ -120,7 +120,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 @@ -268,7 +268,7 @@ sub ensure_unlocked_desktop {
last; # desktop is uncloked, mission accomplished
}
if (match_has_tag 'screenlock') {
wait_screen_change {
assert_screen_change {
send_key 'esc'; # end screenlock
};
}
Expand Down
52 changes: 26 additions & 26 deletions lib/x11regressiontest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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 @@ -66,7 +66,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 @@ -84,7 +84,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 @@ -283,11 +283,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 @@ -315,48 +315,48 @@ 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";
};
# add self-signed CA with internal account
if ($account =~ m/internal/) {
assert_and_click "evolution_wizard-receiving-checkauthtype";
assert_screen "evolution_mail_meeting_trust_ca";
send_key "alt-a";
wait_screen_change {
assert_screen_change {
send_key $self->{next};
send_key "ret";
}
Expand All @@ -376,35 +376,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 @@ -414,7 +414,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 All @@ -424,7 +424,7 @@ sub setup_mail_account {
assert_and_click "evolution_wizard-sending-checkauthtype";
assert_screen "evolution_mail_meeting_trust_ca";
send_key "alt-a";
wait_screen_change {
assert_screen_change {
send_key $self->{next};
send_key "ret";
}
Expand Down Expand Up @@ -537,11 +537,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 @@ -555,7 +555,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 @@ -613,7 +613,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 @@ -56,15 +56,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 @@ -91,7 +91,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 @@ -27,7 +27,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 @@ -79,10 +79,10 @@ sub run() {
assert_screen(\@tags, 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' };
}
elsif (match_has_tag('yast2-sw_shows_summary')) {
wait_screen_change { send_key 'alt-f' };
assert_screen_change { send_key 'alt-f' };
}
} until (match_has_tag('yast2_console-finished'));

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,20 +29,20 @@ 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';
wait_screen_change { 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 @@ -54,10 +54,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 @@ -69,15 +69,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 @@ -108,7 +108,7 @@ sub post_fail_hook() {
save_memory_dump;

# Reveal what is behind Plymouth splash screen
wait_screen_change {
assert_screen_change {
send_key 'esc';
};
$self->export_logs();
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 @@ -108,7 +108,7 @@ sub run() {
select_console 'installation';
assert_screen 'rebootnow';
}
wait_screen_change {
assert_screen_change {
send_key 'alt-o'; # Reboot
};

Expand Down

0 comments on commit b034e97

Please sign in to comment.