add anaconda text UI test

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D980
This commit is contained in:
Jan Sedlák 2016-09-07 10:34:54 +02:00
parent 1c882f612e
commit db95bccd52
17 changed files with 276 additions and 21 deletions

View File

@ -73,6 +73,7 @@ it also means that `B` conflicts `A` even if not shown in the table).
| `TEST_UPDATES` | boolean | `false`/not set | set to indicate that this test checks updates.img loading, so we should check for the expected effect of the updates image used for this testing |
| `POSTINSTALL` | string | not set | nothing | If set, `tests/(value)_postinstall.pm` will be loaded after install, boot, login, and other postinstall tests
| `UEFI` | boolean | `false`/not set | nothing | whether to use UEFI, this variable isn't usually set in test suites but in machine definition |
| `ANACONDA_TEXT` | boolean | `false`/not set | all | when specified, anaconda will run in text mode |
Run variables
-------------

View File

@ -16,6 +16,9 @@ sub post_fail_hook {
if (check_screen "anaconda_error", 10) {
assert_and_click "anaconda_error_report";
$has_traceback = 1;
} elsif (check_screen "anaconda_text_error", 10) { # also for text install
type_string "1\n";
$has_traceback = 1;
}
$self->root_console(check=>0);

17
lib/main_common.pm Normal file
View File

@ -0,0 +1,17 @@
package main_common;
use strict;
use base 'Exporter';
use Exporter;
use testapi;
our @EXPORT = qw/run_with_error_check/;
sub run_with_error_check {
my ($func, $error_screen) = @_;
die "Error screen appeared" if (check_screen $error_screen, 5);
$func->();
die "Error screen appeared" if (check_screen $error_screen, 5);
}

View File

@ -119,6 +119,12 @@ sub load_install_tests() {
# if this is a kickstart install, that's all folks
return if (get_var("KICKSTART"));
if (get_var('ANACONDA_TEXT')) {
# since it differs much, handle text installation separately
autotest::loadtest "tests/install_text.pm";
return;
}
## Networking
if (get_var('ANACONDA_STATIC')) {
autotest::loadtest "tests/_network_static.pm";

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 255,
"ypos": 738,
"width": 152,
"height": 12,
"type": "match"
}
],
"properties": [],
"tags": [
"anaconda_install_text_done"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -0,0 +1,29 @@
{
"tags": [
"anaconda_main_hub_text"
],
"area": [
{
"type": "match",
"ypos": 338,
"height": 12,
"width": 96,
"xpos": 1
},
{
"type": "match",
"ypos": 498,
"height": 13,
"width": 127,
"xpos": 71
},
{
"xpos": 8,
"ypos": 369,
"width": 119,
"height": 13,
"type": "match"
}
],
"properties": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,15 @@
{
"tags": [
"anaconda_main_hub_text_unfinished"
],
"properties": [],
"area": [
{
"xpos": 361,
"ypos": 369,
"width": 22,
"height": 14,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 1,
"ypos": 319,
"width": 230,
"height": 16,
"type": "match"
}
],
"tags": [
"anaconda_text_error"
],
"properties": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1,15 @@
{
"tags": [
"anaconda_use_text_mode"
],
"properties": [],
"area": [
{
"xpos": 9,
"ypos": 241,
"width": 125,
"height": 14,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -325,6 +325,17 @@
},
test_suite => { name => "install_package_set_minimal" },
},
{
machine => { name => "64bit" },
prio => 30,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "universal",
version => "*",
},
test_suite => { name => "install_anaconda_text" },
},
{
machine => { name => "64bit" },
prio => 10,
@ -1430,6 +1441,12 @@
{ key => "STORE_HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
],
},
{
name => "install_anaconda_text",
settings => [
{ key => "ANACONDA_TEXT", value => "1" },
],
},
{
name => "install_package_set_minimal",
settings => [

View File

@ -14,8 +14,9 @@ sub run {
# Construct inst.repo arg for REPOSITORY_VARIATION
my $repourl = get_var("REPOSITORY_VARIATION");
if ($repourl) {
$params .= "inst.repo=" . $self->get_full_repo($repourl);
$params .= "inst.repo=" . $self->get_full_repo($repourl) . " ";
}
$params .= "inst.text" if get_var("ANACONDA_TEXT");
# ternary: set $params to "" if it contains only spaces
$params = $params =~ /^\s+$/ ? "" : $params;
@ -28,6 +29,14 @@ sub run {
# proceed to installer
unless (get_var("KICKSTART"))
{
if (get_var("ANACONDA_TEXT")) {
# select that we don't want to start VNC; we want to run in text mode
assert_screen "anaconda_use_text_mode", 300;
type_string "2\n";
# wait for text version of Anaconda main hub
assert_screen "anaconda_main_hub_text", 300;
} else {
# on lives, we have to explicitly launch anaconda
if (get_var('LIVE')) {
assert_and_click "live_start_anaconda_icon", '', 300;
@ -51,6 +60,7 @@ sub run {
# wait for Anaconda hub to appear
assert_screen "anaconda_main_hub", 900; #
}
}
}

112
tests/install_text.pm Normal file
View File

@ -0,0 +1,112 @@
use base "anacondatest";
use strict;
use testapi;
use main_common;
sub run {
my $self = shift;
assert_screen "anaconda_main_hub_text";
# IMHO it's better to use sleeps than to have needle for every text screen
wait_still_screen 5;
# prepare for different number of spokes (e. g. as in Atomic DVD)
my %spoke_number = (
"language" => 1,
"timezone" => 2,
"source" => 3,
"swselection" => 4,
"destination" => 5,
"network" => 6,
"rootpwd" => 7,
"user" => 8
);
# Set timezone
run_with_error_check(sub {type_string $spoke_number{"timezone"} . "\n"}, "anaconda_text_error");
wait_still_screen 5;
type_string "1\n"; # Europe
wait_still_screen 5;
type_string "37\n"; # Prague
wait_still_screen 7;
# Select disk
run_with_error_check(sub {type_string $spoke_number{"destination"} . "\n"}, "anaconda_text_error");
wait_still_screen 5;
type_string "c\n"; # first disk selected, continue
wait_still_screen 5;
type_string "c\n"; # use all space selected, continue
wait_still_screen 5;
type_string "c\n"; # LVM selected, continue
wait_still_screen 7;
# Set root password
run_with_error_check(sub {type_string $spoke_number{"rootpwd"} . "\n"}, "anaconda_text_error");
wait_still_screen 5;
type_string get_var("ROOT_PASSWORD", "weakpassword");
send_key "ret";
wait_still_screen 5;
type_string get_var("ROOT_PASSWORD", "weakpassword");
send_key "ret";
wait_still_screen 7;
# Create user
run_with_error_check(sub {type_string $spoke_number{"user"} . "\n"}, "anaconda_text_error");
wait_still_screen 5;
type_string "1\n"; # create new
wait_still_screen 5;
type_string "3\n"; # set username
wait_still_screen 5;
type_string get_var("USER_LOGIN", "test");
send_key "ret";
wait_still_screen 5;
# typing "4\n" on abrt screen causes system to reboot, so be careful
run_with_error_check(sub {type_string "4\n"}, "anaconda_text_error"); # use password
wait_still_screen 5;
type_string "5\n"; # set password
wait_still_screen 5;
type_string get_var("USER_PASSWORD", "weakpassword");
send_key "ret";
wait_still_screen 5;
type_string get_var("USER_PASSWORD", "weakpassword");
send_key "ret";
wait_still_screen 5;
type_string "6\n"; # make him an administrator
wait_still_screen 5;
type_string "c\n";
wait_still_screen 7;
my $counter = 0;
while (check_screen "anaconda_main_hub_text_unfinished", 2) {
if ($counter > 10) {
die "There are unfinished spokes in Anaconda";
}
sleep 10;
$counter++;
type_string "r\n"; # refresh
}
# begin installation
type_string "b\n";
# Wait for install to end. Give Rawhide a bit longer, in case
# we're on a debug kernel, debug kernel installs are really slow.
my $timeout = 1800;
if (lc(get_var('VERSION')) eq "rawhide") {
$timeout = 2400;
}
assert_screen "anaconda_install_text_done", $timeout;
type_string "\n";
}
sub test_flags {
# without anything - rollback to 'lastgood' snapshot if failed
# 'fatal' - whole test suite is in danger if this fails
# 'milestone' - after this test succeeds, update 'lastgood'
# 'important' - if this fails, set the overall state to 'fail'
return { fatal => 1 };
}
1;
# vim: set sw=4 et: