Add tests with no user created during install

Summary:
This adds a new test suite, run for Workstation and KDE live
images, which does not create a user during install. It then
expects initial-setup (KDE) or gnome-initial-setup (Workstation)
to appear after install, creates a user, and proceeds with
normal boot.

Note the ARM image test already covers the initial-setup text
mode, and the ARM minimal image is the only case where that
actually matters (it's not included in Server).

Test Plan:
Run the new tests, check they work. Run all old
tests, check the changes didn't break them.

Reviewers: jsedlak, jskladan

Reviewed By: jsedlak

Subscribers: tflink

Differential Revision: https://phab.qa.fedoraproject.org/D1185
This commit is contained in:
Adam Williamson 2017-04-03 16:23:45 -07:00
parent 638adda97a
commit 1444c5030b
6 changed files with 185 additions and 84 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/;
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/;
sub run_with_error_check {
my ($func, $error_screen) = @_;
@ -365,3 +365,118 @@ sub repo_setup {
assert_script_run "rm -f /etc/yum.repos.d/fedora-cisco-openh264.repo";
}
sub gnome_initial_setup {
# Handle gnome-initial-setup, with variations for the pre-login
# mode (when no user was created during install) and post-login
# mode (when user was created during install)
my %args = (
prelogin => 0,
timeout => 120,
@_
);
my $nexts = 3;
if ($args{prelogin}) {
$nexts = 5;
}
assert_screen "next_button", $args{timeout};
# wait a bit in case of animation
wait_still_screen 3;
for my $n (1..$nexts) {
# click 'Next' $nexts times, moving the mouse to avoid
# highlight problems, sleeping to give it time to get
# to the next screen between clicks
mouse_set(100, 100);
wait_screen_change { assert_and_click "next_button"; };
# for Japanese, we need to workaround a bug on the keyboard
# selection screen
if ($n == 1 && get_var("LANGUAGE") eq 'japanese') {
if (!check_screen 'initial_setup_kana_kanji_selected', 5) {
record_soft_failure 'kana kanji not selected: bgo#776189';
assert_and_click 'initial_setup_kana_kanji';
}
}
}
# click 'Skip' one time
mouse_set(100,100);
wait_screen_change { assert_and_click "skip_button"; };
send_key "ret";
if ($args{prelogin}) {
# create user
my $user_login = get_var("USER_LOGIN") || "test";
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
type_very_safely $user_login;
wait_screen_change { assert_and_click "next_button"; };
type_very_safely $user_password;
send_key "tab";
type_very_safely $user_password;
wait_screen_change { assert_and_click "next_button"; };
send_key "ret";
}
else {
# wait for the stupid 'help' screen to show and kill it
assert_screen "getting_started";
send_key "alt-f4";
wait_still_screen 5;
# don't do it again on second load
}
set_var("_setup_done", 1);
}
sub _type_user_password {
# convenience function used by anaconda_create_user, not meant
# for direct use
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 ASCII and native characters
desktop_switch_layout "ascii", "anaconda";
type_very_safely $user_password;
desktop_switch_layout "native", "anaconda";
type_very_safely $user_password;
}
else {
type_very_safely $user_password;
}
}
sub anaconda_create_user {
# Create a user, in the anaconda interface. This is here because
# the same code works both during install and for initial-setup,
# which runs post-install, so we can share it.
my %args = (
timeout => 90,
@_
);
my $user_login = get_var("USER_LOGIN") || "test";
assert_and_click "anaconda_install_user_creation", '', $args{timeout};
assert_screen "anaconda_install_user_creation_screen";
# wait out animation
wait_still_screen 2;
type_very_safely $user_login;
type_very_safely "\t\t\t\t";
_type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
_type_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.
# But not if we're installing with a switched layout, as those
# will *always* result in a warning bar at this point (see below)
if (!get_var("SWITCHED_LAYOUT") && check_screen "anaconda_warning_bar", 3) {
wait_screen_change { send_key "shift-tab"; };
wait_still_screen 2;
_type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
_type_user_password();
}
assert_and_click "anaconda_install_user_creation_make_admin";
assert_and_click "anaconda_spoke_done";
# since 20170105, we will get a warning here when the password
# contains non-ASCII characters. Assume only switched layouts
# produce non-ASCII characters, though this isn't strictly true
if (get_var('SWITCHED_LAYOUT') && check_screen "anaconda_warning_bar", 3) {
wait_still_screen 1;
assert_and_click "anaconda_spoke_done";
}
}

View File

@ -0,0 +1,15 @@
{
"tags": [
"initialsetup_finish_configuration"
],
"properties": [],
"area": [
{
"xpos": 852,
"ypos": 732,
"width": 148,
"height": 12,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -182,6 +182,28 @@
},
test_suite => { name => "install_default" },
},
{
machine => { name => "64bit" },
prio => 20,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Workstation-live-iso",
version => "*",
},
test_suite => { name => "install_no_user" },
},
{
machine => { name => "64bit" },
prio => 21,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "KDE-live-iso",
version => "*",
},
test_suite => { name => "install_no_user" },
},
{
machine => { name => "64bit" },
prio => 40,
@ -2381,5 +2403,11 @@
{ key => "TEST_TARGET", value => "NONE" },
],
},
{
name => "install_no_user",
settings => [
{ key => "INSTALL_NO_USER", value => "1" },
],
},
],
}

View File

@ -3,22 +3,6 @@ use strict;
use testapi;
use utils;
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 ASCII and native characters
desktop_switch_layout "ascii", "anaconda";
type_very_safely $user_password;
desktop_switch_layout "native", "anaconda";
type_very_safely $user_password;
}
else {
type_very_safely $user_password;
}
}
sub run {
my $self = shift;
# Anaconda hub
@ -56,43 +40,10 @@ sub run {
}
assert_and_click "anaconda_spoke_done";
# Set user details
# wait out animation
# Wait out animation
sleep 3;
my $user_login = get_var("USER_LOGIN") || "test";
unless ($user_login eq 'false') {
assert_and_click "anaconda_install_user_creation";
assert_screen "anaconda_install_user_creation_screen";
# wait out animation
wait_still_screen 2;
type_very_safely $user_login;
type_very_safely "\t\t\t\t";
$self->type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
$self->type_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.
# But not if we're installing with a switched layout, as those
# will *always* result in a warning bar at this point (see below)
if (!get_var("SWITCHED_LAYOUT") && check_screen "anaconda_warning_bar", 3) {
wait_screen_change { send_key "shift-tab"; };
wait_still_screen 2;
$self->type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
$self->type_user_password();
}
assert_and_click "anaconda_install_user_creation_make_admin";
assert_and_click "anaconda_spoke_done";
# since 20170105, we will get a warning here when the password
# contains non-ASCII characters. Assume only switched layouts
# produce non-ASCII characters, though this isn't strictly true
if (get_var('SWITCHED_LAYOUT') && check_screen "anaconda_warning_bar", 3) {
wait_still_screen 1;
assert_and_click "anaconda_spoke_done";
}
}
# Set user details
anaconda_create_user() unless (get_var("USER_LOGIN") eq 'false' || get_var("INSTALL_NO_USER"));
# Check username (and hence keyboard layout) if non-English
if (get_var('LANGUAGE')) {

View File

@ -13,6 +13,18 @@ sub run {
$wait_time = 1800 if (get_var("KICKSTART"));
$wait_time = 6000 if (get_var("UPGRADE") && !get_var("ENCRYPT_PASSWORD"));
# Handle pre-login initial setup if we're doing INSTALL_NO_USER
if (get_var("INSTALL_NO_USER") && !get_var("_setup_done")) {
if (get_var("DESKTOP") eq 'gnome') {
gnome_initial_setup(prelogin=>1, timeout=>$wait_time);
}
else {
anaconda_create_user(timeout=>$wait_time);
assert_and_click "initialsetup_finish_configuration";
set_var("_setup_done", 1);
}
$wait_time = 300;
}
# Wait for the login screen
boot_to_login_screen(timeout => $wait_time);
# do user login unless USER_LOGIN is set to string 'false'
@ -42,39 +54,19 @@ sub run {
# do it if ADVISORY is set, as for the update testing flow,
# START_AFTER_TEST is set but a no-op and this hasn't happened
if (get_var("DESKTOP") eq 'gnome' && (get_var("ADVISORY") || !get_var("START_AFTER_TEST"))) {
# as this test gets loaded twice on the ADVISORY flow,
# keep track of whether this happened already
unless (get_var("_gis_done")) {
assert_screen "next_button", 120;
# wait a bit in case of animation
wait_still_screen 3;
for my $n (1..3) {
# click 'Next' three times, moving the mouse to avoid
# highlight problems, sleeping to give it time to get
# to the next screen between clicks
mouse_set(100, 100);
wait_screen_change { assert_and_click "next_button"; };
# for Japanese, we need to workaround a bug on the keyboard
# selection screen
if ($n == 1 && get_var("LANGUAGE") eq 'japanese') {
if (!check_screen 'initial_setup_kana_kanji_selected', 5) {
record_soft_failure 'kana kanji not selected: bgo#776189';
assert_and_click 'initial_setup_kana_kanji';
}
}
}
# click 'Skip' one time
mouse_set(100,100);
wait_screen_change { assert_and_click "skip_button"; };
send_key "ret";
# wait for the stupid 'help' screen to show and kill it
assert_screen "getting_started";
send_key "alt-f4";
wait_still_screen 5;
# don't do it again on second load
set_var("_gis_done", 1);
# as this test gets loaded twice on the ADVISORY flow, and
# we might be on the INSTALL_NO_USER flow, check whether
# this happened already
unless (get_var("_setup_done")) {
gnome_initial_setup();
}
}
if (get_var("DESKTOP") eq 'gnome' && get_var("INSTALL_NO_USER")) {
# wait for the stupid 'help' screen to show and kill it
assert_screen "getting_started";
send_key "alt-f4";
wait_still_screen 5;
}
# Move the mouse somewhere it won't highlight the match areas
mouse_set(300, 200);