try to be safer when typing in X: slower, more checks

Summary:
the main thing this does is try and type slower in X - this
should cover nearly everywhere we type anything in X, and make
it type slower. We also add a bit more safety checking to some
old tests which didn't have it (mainly _do_install_and_reboot)
- wait_still_screen after typing to make sure all the keypresses
were registered before continuing.

This is an attempt to mitigate the problems we've seen where
the wrong text gets typed into the wrong places and the tests
break.

This branch is live on staging atm. It still has *some* issues,
but I do think it's an improvement.

Test Plan:
run the tests (probably several times), compare to
runs without the change, see if it's better or worse...

Reviewers: jskladan, garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D993
This commit is contained in:
Adam Williamson 2016-09-12 10:24:30 -07:00
parent 276e38b561
commit e1ec1997af
25 changed files with 277 additions and 168 deletions

View File

@ -7,6 +7,7 @@ use base 'fedorabase';
# to upload Anaconda logs when something fails # to upload Anaconda logs when something fails
use testapi; use testapi;
use main_common;
sub post_fail_hook { sub post_fail_hook {
my $self = shift; my $self = shift;
@ -113,16 +114,12 @@ sub select_disks {
foreach my $target (keys %iscsi) { foreach my $target (keys %iscsi) {
my $ip = $iscsi{$target}; my $ip = $iscsi{$target};
assert_and_click "anaconda_install_destination_add_iscsi_target"; assert_and_click "anaconda_install_destination_add_iscsi_target";
type_string $ip;
wait_still_screen 2; wait_still_screen 2;
send_key "tab"; type_safely $ip;
type_string $target; wait_screen_change { send_key "tab"; };
wait_still_screen 2; type_safely $target;
# start discovery # start discovery - three tabs, enter
send_key "tab"; type_safely "\t\t\t\n";
send_key "tab";
send_key "tab";
send_key "ret";
assert_and_click "anaconda_install_destination_target_login"; assert_and_click "anaconda_install_destination_target_login";
assert_and_click "anaconda_install_destination_select_target"; assert_and_click "anaconda_install_destination_select_target";
} }

View File

@ -28,7 +28,7 @@ sub x11_start_program {
my ($self, $program, $timeout, $options) = @_; my ($self, $program, $timeout, $options) = @_;
send_key "alt-f2"; send_key "alt-f2";
assert_screen "desktop_runner"; assert_screen "desktop_runner";
type_string $program; type_string $program, 20;
wait_idle 5; # because of KDE dialog - SUSE guys are doing the same! wait_idle 5; # because of KDE dialog - SUSE guys are doing the same!
send_key "ret", 1; send_key "ret", 1;
} }

View File

@ -6,6 +6,7 @@ use base 'Exporter';
use Exporter; use Exporter;
use testapi; use testapi;
use main_common;
our @EXPORT = qw/add_user start_webui/; our @EXPORT = qw/add_user start_webui/;
@ -17,44 +18,31 @@ sub add_user {
assert_and_click "freeipa_webui_add_button"; assert_and_click "freeipa_webui_add_button";
assert_screen "freeipa_webui_add_user"; assert_screen "freeipa_webui_add_user";
wait_still_screen 1; wait_still_screen 1;
type_string $user; type_safely $user;
wait_still_screen 1; wait_screen_change { send_key "tab"; };
send_key "tab";
# we don't need to be too careful here as the names don't matter # we don't need to be too careful here as the names don't matter
type_string "Test"; type_safely "Test";
send_key "tab"; wait_screen_change { send_key "tab"; };
type_string $surname; type_safely $surname;
send_key "tab"; type_safely "\t\t\t\t";
send_key "tab"; type_safely "correcthorse";
send_key "tab"; wait_screen_change { send_key "tab"; };
send_key "tab"; type_safely "correcthorse\n";
type_string "correcthorse";
wait_still_screen 1;
send_key "tab";
wait_still_screen 1;
type_string "correcthorse\n";
} }
# access the FreeIPA web UI and log in as a given user. Assumes # access the FreeIPA web UI and log in as a given user. Assumes
# Firefox is running. # it's at a console ready to start Firefox.
sub start_webui { sub start_webui {
my ($user, $password) = @_; my ($user, $password) = @_;
# new tab type_string "startx /usr/bin/firefox -width 1024 -height 768 https://ipa001.domain.local\n";
send_key "ctrl-t"; wait_still_screen 5;
wait_still_screen 2;
type_string "https://ipa001.domain.local";
# firefox's stupid 'smart' url bar is a pain. wait for things to settle.
wait_still_screen 3;
send_key "ret";
assert_screen "freeipa_webui_login"; assert_screen "freeipa_webui_login";
type_string $user; type_safely $user;
wait_still_screen 1; wait_screen_change { send_key "tab"; };
send_key "tab"; type_safely $password;
wait_still_screen 1;
type_string $password;
wait_still_screen 1;
send_key "ret"; send_key "ret";
# if we logged in as 'admin' we should land on the admin 'Active # if we logged in as 'admin' we should land on the admin 'Active
# users' screen, otherwise we should land on the user's own page # users' screen, otherwise we should land on the user's own page
$user eq 'admin' ? assert_screen "freeipa_webui_users" : assert_screen "freeipa_webui_user"; $user eq 'admin' ? assert_screen "freeipa_webui_users" : assert_screen "freeipa_webui_user";
wait_still_screen 3;
} }

View File

@ -7,6 +7,7 @@ use base 'fedorabase';
# of upgrade tests, postinstall phases... # of upgrade tests, postinstall phases...
use testapi; use testapi;
use main_common;
sub root_console { sub root_console {
my $self = shift; my $self = shift;
@ -58,8 +59,7 @@ sub menu_launch_type {
send_key 'alt-f1'; send_key 'alt-f1';
# srsly KDE y u so slo # srsly KDE y u so slo
wait_still_screen 3; wait_still_screen 3;
type_string "$app"; type_very_safely $app;
wait_still_screen 3;
send_key 'ret'; send_key 'ret';
} }
@ -67,17 +67,9 @@ sub start_cockpit {
my $self = shift; my $self = shift;
my $login = shift || 0; my $login = shift || 0;
# run firefox directly in X as root. never do this, kids! # run firefox directly in X as root. never do this, kids!
type_string "startx /usr/bin/firefox -width 1024 -height 768\n"; type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n";
assert_screen "firefox";
# open a new tab so we don't race with the default page load
# (also focuses the location bar for us)
send_key "ctrl-t";
wait_still_screen 2;
type_string "http://localhost:9090";
# firefox's stupid 'smart' url bar is a pain. wait for things to settle.
wait_still_screen 3;
send_key "ret";
assert_screen "cockpit_login"; assert_screen "cockpit_login";
wait_still_screen 5;
if ($login) { if ($login) {
# with cockpit 118, user name field is not highlighted by # with cockpit 118, user name field is not highlighted by
# default. for right now 118 is only in Rawhide, we'll have # default. for right now 118 is only in Rawhide, we'll have
@ -85,11 +77,14 @@ sub start_cockpit {
if (lc(get_var('VERSION')) eq "rawhide") { if (lc(get_var('VERSION')) eq "rawhide") {
wait_screen_change { send_key "tab"; }; wait_screen_change { send_key "tab"; };
} }
type_string "root"; type_safely "root";
send_key "tab"; wait_screen_change { send_key "tab"; };
type_string get_var("ROOT_PASSWORD", "weakpassword"); type_safely get_var("ROOT_PASSWORD", "weakpassword");
send_key "ret"; send_key "ret";
assert_screen "cockpit_main"; assert_screen "cockpit_main";
# wait for any animation or other weirdness
# can't use wait_still_screen because of that damn graph
sleep 3;
} }
} }

View File

@ -6,8 +6,7 @@ use base 'Exporter';
use Exporter; use Exporter;
use testapi; use testapi;
our @EXPORT = qw/run_with_error_check check_type_string type_safely type_very_safely/;
our @EXPORT = qw/run_with_error_check/;
sub run_with_error_check { sub run_with_error_check {
my ($func, $error_screen) = @_; my ($func, $error_screen) = @_;
@ -15,3 +14,37 @@ sub run_with_error_check {
$func->(); $func->();
die "Error screen appeared" if (check_screen $error_screen, 5); die "Error screen appeared" if (check_screen $error_screen, 5);
} }
# type the string in sets of characters at a time (default 3), waiting
# for a screen change after each set. Intended to be safer when the VM
# is busy and regular type_string may overload the input buffer. Args
# passed along to `type_string`. Accepts additional args:
# `size` - size of character groups (default 3) - set to 1 for extreme
# safety (but slower and more screenshotting)
sub check_type_string {
my ($string, %args) = @_;
$args{size} //= 3;
# split string into an array of pieces of specified size
# https://stackoverflow.com/questions/372370
my @pieces = unpack("(a$args{size})*", $string);
for my $piece (@pieces) {
wait_screen_change { type_string($piece, %args); };
}
}
# high-level 'type this string quite safely but reasonably fast'
# function whose specific implementation may vary
sub type_safely {
my $string = shift;
check_type_string($string, max_interval => 20);
wait_still_screen 2;
}
# high-level 'type this string extremely safely and rather slow'
# function whose specific implementation may vary
sub type_very_safely {
my $string = shift;
check_type_string($string, size => 1, still => 5, max_interval => 1);
wait_still_screen 5;
}

View File

@ -0,0 +1,17 @@
{
"area": [
{
"height": 16,
"type": "match",
"width": 149,
"xpos": 852,
"ypos": 684
}
],
"properties": [],
"tags": [
"ENV-DISTRI-fedora",
"LANGUAGE-french",
"anaconda_install_finish_configuration"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"height": 17,
"type": "match",
"width": 115,
"xpos": 886,
"ypos": 684
}
],
"tags": [
"anaconda_install_finish_configuration",
"ENV-DISTRI-fedora",
"LANGUAGE-english"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@ -0,0 +1,17 @@
{
"properties": [],
"area": [
{
"xpos": 874,
"ypos": 686,
"width": 128,
"height": 14,
"type": "match"
}
],
"tags": [
"ENV-DISTRI-fedora",
"LANGUAGE-russian",
"anaconda_install_finish_configuration"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,17 @@
{
"area": [
{
"height": 20,
"type": "match",
"width": 414,
"xpos": 283,
"ypos": 741
}
],
"properties": [],
"tags": [
"ENV-DISTRI-fedora",
"LANGUAGE-english",
"anaconda_warning_bar"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -1,6 +1,7 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use main_common;
sub run { sub run {
my $self = shift; my $self = shift;
@ -33,7 +34,6 @@ sub run {
# select that we don't want to start VNC; we want to run in text mode # select that we don't want to start VNC; we want to run in text mode
assert_screen "anaconda_use_text_mode", 300; assert_screen "anaconda_use_text_mode", 300;
type_string "2\n"; type_string "2\n";
# wait for text version of Anaconda main hub # wait for text version of Anaconda main hub
assert_screen "anaconda_main_hub_text", 300; assert_screen "anaconda_main_hub_text", 300;
} else { } else {
@ -45,8 +45,8 @@ sub run {
# wait for anaconda to appear # wait for anaconda to appear
assert_screen "anaconda_select_install_lang", 300; assert_screen "anaconda_select_install_lang", 300;
# Select install language # Select install language
assert_and_click "anaconda_select_install_lang_input"; wait_screen_change { assert_and_click "anaconda_select_install_lang_input"; };
type_string "${language}"; type_safely $language;
# Needle filtering in main.pm ensures we will only look for the # Needle filtering in main.pm ensures we will only look for the
# appropriate language, here # appropriate language, here
assert_and_click "anaconda_select_install_lang_filtered"; assert_and_click "anaconda_select_install_lang_filtered";

View File

@ -1,6 +1,23 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use main_common;
sub type_user_password {
my $self = shift;
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
if (get_var("SWITCHED_LAYOUT")) {
# we double the password, the second time using the native
# layout, so the password has both US and native characters
$self->switch_layout("us");
type_very_safely $user_password;
$self->switch_layout("native");
type_very_safely $user_password;
}
else {
type_very_safely $user_password;
}
}
sub run { sub run {
my $self = shift; my $self = shift;
@ -18,40 +35,40 @@ sub run {
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword"; my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
assert_and_click "anaconda_install_root_password"; assert_and_click "anaconda_install_root_password";
assert_screen "anaconda_install_root_password_screen"; assert_screen "anaconda_install_root_password_screen";
# wait out animation
wait_still_screen 2;
$self->switch_layout("us") if (get_var("SWITCHED_LAYOUT")); $self->switch_layout("us") if (get_var("SWITCHED_LAYOUT"));
type_string $root_password; # these screens seems insanely subject to typing errors, so let's
send_key "tab"; # type super safely. Note this doesn't really slow the test down
type_string $root_password; # as we still get done before the install process is complete.
type_very_safely $root_password;
wait_screen_change { send_key "tab"; };
type_very_safely $root_password;
assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_spoke_done";
# Set user details # Set user details
sleep 1; # wait out animation
sleep 3;
my $user_login = get_var("USER_LOGIN") || "test"; my $user_login = get_var("USER_LOGIN") || "test";
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
assert_and_click "anaconda_install_user_creation"; assert_and_click "anaconda_install_user_creation";
assert_screen "anaconda_install_user_creation_screen"; assert_screen "anaconda_install_user_creation_screen";
type_string $user_login; # wait out animation
assert_and_click "anaconda_user_creation_password_input"; wait_still_screen 2;
if (get_var("SWITCHED_LAYOUT")) { type_very_safely $user_login;
# we double the password, the second time using the native type_very_safely "\t\t\t\t";
# layout, so the password has both US and native characters $self->type_user_password();
$self->switch_layout("us"); wait_screen_change { send_key "tab"; };
type_string $user_password; wait_still_screen 2;
$self->switch_layout("native"); $self->type_user_password();
type_string $user_password; # even with all our slow typing this still *sometimes* seems to
} # miss a character, so let's try again if we have a warning bar
else { if (check_screen "anaconda_warning_bar", 3) {
type_string $user_password; wait_screen_change { send_key "shift-tab"; };
} wait_still_screen 2;
send_key "tab"; $self->type_user_password();
if (get_var("SWITCHED_LAYOUT")) { wait_screen_change { send_key "tab"; };
$self->switch_layout("us"); wait_still_screen 2;
type_string $user_password; $self->type_user_password();
$self->switch_layout("native");
type_string $user_password;
}
else {
type_string $user_password;
} }
assert_and_click "anaconda_install_user_creation_make_admin"; assert_and_click "anaconda_install_user_creation_make_admin";
assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_spoke_done";
@ -61,6 +78,13 @@ sub run {
assert_screen "anaconda_install_user_created"; assert_screen "anaconda_install_user_created";
} }
# With the slow typing - especially with SWITCHED_LAYOUT - we
# may not complete user creation until anaconda reaches post-install,
# which causes a 'Finish configuration' button
if (check_screen "anaconda_install_finish_configuration", 5) {
assert_and_click "anaconda_install_finish_configuration";
}
# Wait for install to end. Give Rawhide a bit longer, in case # Wait for install to end. Give Rawhide a bit longer, in case
# we're on a debug kernel, debug kernel installs are really slow. # we're on a debug kernel, debug kernel installs are really slow.
my $timeout = 1800; my $timeout = 1800;
@ -72,7 +96,10 @@ sub run {
wait_still_screen 3; wait_still_screen 3;
assert_and_click "anaconda_install_done"; assert_and_click "anaconda_install_done";
if (get_var('LIVE')) { if (get_var('LIVE')) {
x11_start_program("sudo reboot"); # reboot from a console, it's more reliable than the desktop
# runners
$self->root_console;
type_string "reboot\n";
} }
} }

View File

@ -1,8 +1,10 @@
use base "installedtest"; use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use main_common;
sub run { sub run {
my $self = shift;
# If KICKSTART is set, then the wait_time needs to consider the # If KICKSTART is set, then the wait_time needs to consider the
# install time. if UPGRADE, we have to wait for the entire upgrade # install time. if UPGRADE, we have to wait for the entire upgrade
# unless ENCRYPT_PASSWORD is set (in which case the postinstall # unless ENCRYPT_PASSWORD is set (in which case the postinstall
@ -24,13 +26,13 @@ sub run {
send_key "ret"; send_key "ret";
} }
assert_screen "graphical_login_input"; assert_screen "graphical_login_input";
type_string get_var("USER_PASSWORD", "weakpassword"); type_very_safely get_var("USER_PASSWORD", "weakpassword");
send_key "ret"; send_key "ret";
# Handle initial-setup, for GNOME, unless START_AFTER_TEST # Handle initial-setup, for GNOME, unless START_AFTER_TEST
# is set in which case it will have been done already # is set in which case it will have been done already
if (get_var("DESKTOP") eq 'gnome' && !get_var("START_AFTER_TEST")) { if (get_var("DESKTOP") eq 'gnome' && !get_var("START_AFTER_TEST")) {
assert_screen "next_button", 60; assert_screen "next_button", 120;
# wait a bit in case of animation # wait a bit in case of animation
wait_still_screen 3; wait_still_screen 3;
for my $n (1..3) { for my $n (1..3) {

View File

@ -1,6 +1,7 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use main_common;
sub run { sub run {
my $self = shift; my $self = shift;
@ -10,29 +11,16 @@ sub run {
assert_and_click "anaconda_network_method"; assert_and_click "anaconda_network_method";
assert_and_click "anaconda_network_method_manual"; assert_and_click "anaconda_network_method_manual";
assert_and_click "anaconda_network_address_add"; assert_and_click "anaconda_network_address_add";
type_string get_var('ANACONDA_STATIC'); type_safely get_var('ANACONDA_STATIC');
wait_still_screen 2;
send_key "tab";
# netmask is automatically set # netmask is automatically set
send_key "tab"; type_safely "\t\t";
# assume gateway # assume gateway
wait_still_screen 2; type_safely "10.0.2.2";
type_string "10.0.2.2";
wait_still_screen 2;
send_key "ret";
# move to DNS servers # move to DNS servers
send_key "tab"; type_safely "\n\t\t\t";
send_key "tab";
send_key "tab";
wait_still_screen 2;
# set DNS from host # set DNS from host
type_string join(',', $self->get_host_dns()); type_safely join(',', $self->get_host_dns());
send_key "tab"; type_safely "\t\t\t\t\t\n";
send_key "tab";
send_key "tab";
send_key "tab";
send_key "tab";
send_key "ret";
# can take a bit of time as it seems to wait for all the pending # can take a bit of time as it seems to wait for all the pending
# DHCP requests to time out before applying the static config # DHCP requests to time out before applying the static config
assert_screen "anaconda_network_connected", 90; assert_screen "anaconda_network_connected", 90;

View File

@ -16,8 +16,9 @@ sub run {
# Focus on "base environment" list # Focus on "base environment" list
send_key "tab"; send_key "tab";
sleep 1; wait_still_screen 1;
send_key "tab"; send_key "tab";
wait_still_screen 1;
# select desired environment # select desired environment
# go through the list 20 times at max (to prevent infinite loop when it's missing) # go through the list 20 times at max (to prevent infinite loop when it's missing)

View File

@ -1,6 +1,16 @@
use base "installedtest"; use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use main_common;
# we are very paranoid with waits and typing speed in this test
# because the system can be very busy; it's effectively first boot of
# a freshly installed system and we're running Firefox for the first
# time, which causes an awful lot of system load, and there's lots of
# screen change potentially going on. This makes the test quite slow,
# but it's best to be safe. If you're working on the test you might
# want to tweak the waits down a bit and use type_safely instead of
# type_very_safely for your test runs, just to save your time.
sub run { sub run {
my $self = shift; my $self = shift;
@ -10,16 +20,19 @@ sub run {
wait_still_screen 2; wait_still_screen 2;
assert_and_click 'browser_launcher'; assert_and_click 'browser_launcher';
assert_screen 'browser'; assert_screen 'browser';
wait_idle 5;
# open a new tab so we don't race with the default page load # open a new tab so we don't race with the default page load
# (also focuses the location bar for us) # (also focuses the location bar for us)
send_key 'ctrl-t'; send_key 'ctrl-t';
wait_still_screen 2; wait_still_screen 2;
# check FAS wait_idle 3;
type_string "https://admin.fedoraproject.org/accounts/\n"; # check FAS, typing slowly to avoid errors
type_very_safely "https://admin.fedoraproject.org/accounts/\n";
assert_screen "browser_fas_home"; assert_screen "browser_fas_home";
send_key 'ctrl-t'; send_key 'ctrl-t';
wait_still_screen 2; wait_still_screen 2;
type_string "https://kernel.org\n"; wait_idle 2;
type_very_safely "https://kernel.org\n";
assert_and_click "browser_kernelorg_patch"; assert_and_click "browser_kernelorg_patch";
assert_and_click "browser_download_save"; assert_and_click "browser_download_save";
send_key 'ret'; send_key 'ret';
@ -34,7 +47,8 @@ sub run {
# default browser doesn't support add-ons or uses different ones # default browser doesn't support add-ons or uses different ones
send_key 'ctrl-t'; send_key 'ctrl-t';
wait_still_screen 2; wait_still_screen 2;
type_string "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/\n"; wait_idle 2;
type_very_safely "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/\n";
assert_and_click "firefox_addon_add"; assert_and_click "firefox_addon_add";
assert_and_click "firefox_addon_install"; assert_and_click "firefox_addon_install";
assert_and_click "firefox_addon_success"; assert_and_click "firefox_addon_success";

View File

@ -1,6 +1,7 @@
use base "installedtest"; use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use main_common;
sub run { sub run {
my $self=shift; my $self=shift;
@ -9,12 +10,17 @@ sub run {
wait_still_screen 5; wait_still_screen 5;
# need to be root # need to be root
my $rootpass = get_var("ROOT_PASSWORD", "weakpassword"); my $rootpass = get_var("ROOT_PASSWORD", "weakpassword");
type_string "su\n"; type_string "su\n", 20;
wait_still_screen 3; wait_still_screen 3;
type_string "$rootpass\n"; # can't use type_safely for now as current implementation relies
# on screen change checks, and there is no screen change here
type_string "$rootpass\n", 1;
wait_still_screen 3; wait_still_screen 3;
# if we can do an assert_script_run, we're at a console # if we can run something successfully, we're at a console;
assert_script_run 'ls'; # we're reinventing assert_script_run instead of using it so
# we can type safely
type_very_safely "ls && echo 'ls OK' > /dev/ttyS0\n";
wait_serial "ls OK" || die "terminal command failed";
} }
sub test_flags { sub test_flags {

View File

@ -1,6 +1,7 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use main_common;
sub run { sub run {
my $self = shift; my $self = shift;
@ -17,9 +18,9 @@ sub run {
if (get_var("SWITCHED_LAYOUT")) { if (get_var("SWITCHED_LAYOUT")) {
$self->switch_layout("us"); $self->switch_layout("us");
} }
type_string get_var("ENCRYPT_PASSWORD"); type_safely get_var("ENCRYPT_PASSWORD");
send_key "tab"; wait_screen_change { send_key "tab"; };
type_string get_var("ENCRYPT_PASSWORD"); type_safely get_var("ENCRYPT_PASSWORD");
if (get_var("SWITCHED_LAYOUT")) { if (get_var("SWITCHED_LAYOUT")) {
# work around RHBZ #1333984 # work around RHBZ #1333984
$self->switch_layout("native"); $self->switch_layout("native");

View File

@ -1,6 +1,7 @@
use base "installedtest"; use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use main_common;
use freeipa; use freeipa;
sub run { sub run {
@ -10,27 +11,20 @@ sub run {
assert_script_run 'rm -rf /root/.mozilla'; assert_script_run 'rm -rf /root/.mozilla';
# clear kerberos ticket so we don't auto-auth as 'test4' # clear kerberos ticket so we don't auto-auth as 'test4'
assert_script_run 'kdestroy -A'; assert_script_run 'kdestroy -A';
type_string "startx /usr/bin/firefox -width 1024 -height 768\n";
assert_screen "firefox";
start_webui("test1", "batterystaple"); start_webui("test1", "batterystaple");
assert_and_click "freeipa_webui_actions"; assert_and_click "freeipa_webui_actions";
assert_and_click "freeipa_webui_reset_password_link"; assert_and_click "freeipa_webui_reset_password_link";
wait_still_screen 3; wait_still_screen 3;
type_string "batterystaple"; type_safely "batterystaple";
wait_still_screen 1; type_safely "\t\t";
send_key "tab"; type_safely "loremipsum";
send_key "tab"; wait_screen_change { send_key "tab"; };
wait_still_screen 1; type_safely "loremipsum";
type_string "loremipsum";
wait_still_screen 1;
send_key "tab";
wait_still_screen 1;
type_string "loremipsum";
wait_still_screen 1;
assert_and_click "freeipa_webui_reset_password_button"; assert_and_click "freeipa_webui_reset_password_button";
wait_still_screen 2; wait_still_screen 2;
# log out # log out
assert_and_click "freeipa_webui_user_menu"; assert_and_click "freeipa_webui_user_menu";
wait_still_screen 2;
assert_and_click "freeipa_webui_logout"; assert_and_click "freeipa_webui_logout";
wait_still_screen 3; wait_still_screen 3;
# close browser, back to console # close browser, back to console

View File

@ -1,44 +1,35 @@
use base "installedtest"; use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use main_common;
use freeipa; use freeipa;
sub run { sub run {
my $self = shift; my $self = shift;
# we're restarting firefox (instead of using the same one from # we're restarting firefox (instead of using the same one from
# freeipa_client_postinstall) so Firefox's trusted CA store # realmd_join_cockpit) so Firefox's trusted CA store refreshes and
# refreshes and it trusts the web server cert # it trusts the web server cert
type_string "startx /usr/bin/firefox -width 1024 -height 768\n";
assert_screen "firefox";
start_webui("admin", "monkeys123"); start_webui("admin", "monkeys123");
add_user("test3", "Three"); add_user("test3", "Three");
add_user("test4", "Four"); add_user("test4", "Four");
assert_screen "freeipa_webui_users_added"; assert_screen "freeipa_webui_users_added";
assert_and_click "freeipa_webui_policy"; assert_and_click "freeipa_webui_policy";
wait_still_screen 2;
assert_screen "freeipa_webui_hbac"; assert_screen "freeipa_webui_hbac";
assert_and_click "freeipa_webui_add_button"; assert_and_click "freeipa_webui_add_button";
wait_still_screen 2;
assert_screen "freeipa_webui_add_policy"; assert_screen "freeipa_webui_add_policy";
type_string "allow-test3"; type_safely "allow-test3";
wait_still_screen 1; type_safely "\t\t\t";
send_key "tab";
send_key "tab";
send_key "tab";
wait_still_screen 1;
send_key "ret"; send_key "ret";
assert_and_click "freeipa_webui_policy_add_user"; assert_and_click "freeipa_webui_policy_add_user";
wait_still_screen 2;
# filter users # filter users
type_string "test3\n"; type_safely "test3\n";
# go to the correct checkbox (assert_and_click is tricky as # go to the correct checkbox (assert_and_click is tricky as
# we can't make sure we click the right checkbox) # we can't make sure we click the right checkbox), check it,
send_key "tab"; # select right arrow, click it - tab tab tab, space, tab, enter
send_key "tab"; type_safely "\t\t\t \t\n";
send_key "tab";
# check it
send_key "spc";
# select the right arrow
send_key "tab";
# click it
send_key "ret";
assert_and_click "freeipa_webui_add_button"; assert_and_click "freeipa_webui_add_button";
wait_still_screen 2; wait_still_screen 2;
send_key "pgdn"; send_key "pgdn";

View File

@ -1,6 +1,8 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use main_common;
use Time::HiRes qw( usleep );
sub run { sub run {
my $self = shift; my $self = shift;
@ -13,6 +15,7 @@ sub run {
# select appropriate protocol on the network # select appropriate protocol on the network
assert_and_click "anaconda_install_source_on_the_network"; assert_and_click "anaconda_install_source_on_the_network";
send_key "tab"; send_key "tab";
wait_still_screen 2;
# select appropriate repo type for the URL by pressing 'up' a given # select appropriate repo type for the URL by pressing 'up' a given
# number of times. default - 3 - is https # number of times. default - 3 - is https
my $num = 3; my $num = 3;
@ -24,20 +27,21 @@ sub run {
} }
for (my $i=0; $i<$num; $i++) { for (my $i=0; $i<$num; $i++) {
send_key "up"; send_key "up";
usleep 100;
} }
# we accept any of the protocol needles here, if we happened to # we accept any of the protocol needles here, if we happened to
# choose wrong the test will fail soon anyhow # choose wrong the test will fail soon anyhow
assert_screen "anaconda_install_source_selected"; assert_screen "anaconda_install_source_selected";
# insert the url # insert the url
send_key "tab"; wait_screen_change { send_key "tab"; };
my $repourl = ""; my $repourl = "";
# if either MIRRORLIST_GRAPHICAL or REPOSITORY_GRAPHICAL is set, type this into # if either MIRRORLIST_GRAPHICAL or REPOSITORY_GRAPHICAL is set, type this into
# the repository url input # the repository url input
if (get_var("MIRRORLIST_GRAPHICAL")) { if (get_var("MIRRORLIST_GRAPHICAL")) {
$repourl = $self->get_mirrorlist_url(); $repourl = $self->get_mirrorlist_url();
type_string $repourl; type_safely $repourl;
# select as mirror list # select as mirror list
assert_and_click "anaconda_install_source_repo_select_mirrorlist"; assert_and_click "anaconda_install_source_repo_select_mirrorlist";
@ -46,7 +50,7 @@ sub run {
$repourl = $self->get_full_repo(get_var("REPOSITORY_GRAPHICAL")); $repourl = $self->get_full_repo(get_var("REPOSITORY_GRAPHICAL"));
# strip the 'nfs:' for typing here # strip the 'nfs:' for typing here
$repourl =~ s/^nfs://; $repourl =~ s/^nfs://;
type_string $repourl; type_safely $repourl;
} }
assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_spoke_done";

View File

@ -2,6 +2,7 @@ use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use lockapi; use lockapi;
use main_common;
sub run { sub run {
my $self = shift; my $self = shift;
@ -18,21 +19,21 @@ sub run {
mutex_lock "freeipa_ready"; mutex_lock "freeipa_ready";
mutex_unlock "freeipa_ready"; mutex_unlock "freeipa_ready";
# run firefox and login to cockpit # run firefox and login to cockpit
# note: we can't use wait_screen_change, wait_still_screen or
# check_type_string in cockpit because of that fucking constantly
# scrolling graph
$self->start_cockpit(1); $self->start_cockpit(1);
assert_and_click "cockpit_join_domain_button"; assert_and_click "cockpit_join_domain_button";
assert_screen "cockpit_join_domain"; assert_screen "cockpit_join_domain";
send_key "tab"; send_key "tab";
wait_still_screen 1; sleep 3;
type_string "ipa001.domain.local"; type_string("ipa001.domain.local", 4);
wait_still_screen 1; type_string("\t\t", 4);
type_string("admin", 4);
send_key "tab"; send_key "tab";
send_key "tab"; sleep 3;
wait_still_screen 1; type_string("monkeys123", 4);
type_string "admin"; sleep 3;
wait_still_screen 1;
send_key "tab";
type_string "monkeys123";
wait_still_screen 1;
assert_and_click "cockpit_join_button"; assert_and_click "cockpit_join_button";
# check we hit the progress screen, so we fail faster if it's # check we hit the progress screen, so we fail faster if it's
# broken # broken