Have non-English tests do graphical install and login

Summary:
The non-English tests so far did not test that graphical login
worked as expected, which is a fairly large hole. With this
change, they should do a Workstation install and test login to
both GNOME and the console works as expected. KDE is not yet
tested.

As part of this we tweak the implementation of keyboard layout
switching in graphical environments to use a generic function
in main_common which can handle both anaconda and desktops
(just GNOME at present, but should extend easily to any desktop
with a known switcher key and a visible layout indicator),
replacing the anacondatest class method. I kinda don't like that
the test has to specifically tell the function when it's in
anaconda, but I don't think I want to start experimenting with
a global 'test phase' openQA variable or anything like that at
present.

Fixes T842.

Test Plan:
Run the French and Russian install tests and check
they work as expected. Also run an English Workstation install
if you like, and make sure that didn't break. This change is
live on staging ATM, seems to work fine.

Reviewers: jskladan, garretraziel

Reviewed By: garretraziel

Subscribers: tflink

Maniphest Tasks: T842

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1071
This commit is contained in:
Adam Williamson 2016-12-16 09:40:29 -08:00
parent 332a955814
commit 0fa6138448
46 changed files with 363 additions and 33 deletions

View File

@ -180,16 +180,6 @@ sub custom_delete_part {
assert_and_click "anaconda_part_delete"; assert_and_click "anaconda_part_delete";
} }
sub switch_layout {
# switch to 'native' or 'us' keyboard layout
my ($self, $layout) = @_;
$layout //= 'us';
# if already selected, we're good
return if (check_screen "anaconda_layout_$layout", 3);
send_key "alt-shift";
assert_screen "anaconda_layout_$layout", 3;
}
sub get_full_repo { sub get_full_repo {
my ($self, $repourl) = @_; my ($self, $repourl) = @_;
# trivial thing we kept repeating: fill out an HTTP or HTTPS # trivial thing we kept repeating: fill out an HTTP or HTTPS

View File

@ -6,7 +6,7 @@ use base 'Exporter';
use Exporter; use Exporter;
use testapi; 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 console_loadkeys_us/; 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/;
sub run_with_error_check { sub run_with_error_check {
my ($func, $error_screen) = @_; my ($func, $error_screen) = @_;
@ -75,6 +75,23 @@ sub console_switch_layout {
} }
} }
# switch to 'native' or 'us' keyboard layout in a graphical desktop
# 'environment' can be a desktop name or 'anaconda' for anaconda
# if not set, will use get_var('DESKTOP') or default 'anaconda'
sub desktop_switch_layout {
my ($layout, $environment) = @_;
$layout //= 'us';
$environment //= get_var("DESKTOP", "anaconda");
# if already selected, we're good
return if (check_screen "${environment}_layout_${layout}", 3);
# otherwise we need to switch
my $switcher = "alt-shift"; # anaconda
$switcher = "super-spc" if $environment eq 'gnome';
# KDE? not used yet
send_key $switcher;
assert_screen "${environment}_layout_${layout}", 3;
}
# this subroutine handles logging in as a root/specified user into console # this subroutine handles logging in as a root/specified user into console
# it requires TTY to be already displayed (handled by the root_console() # it requires TTY to be already displayed (handled by the root_console()
# method of distribution classes) # method of distribution classes)

View File

@ -0,0 +1,14 @@
{
"area": [
{
"height": 13,
"type": "match",
"width": 125,
"xpos": 48,
"ypos": 254
}
],
"tags": [
"anaconda_workstation_highlighted"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -0,0 +1,14 @@
{
"area": [
{
"height": 13,
"type": "match",
"width": 145,
"xpos": 28,
"ypos": 254
}
],
"tags": [
"anaconda_workstation_selected"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -0,0 +1,24 @@
{
"area": [
{
"type": "match",
"ypos": 6,
"width": 62,
"xpos": 10,
"height": 15
},
{
"ypos": 4,
"width": 43,
"type": "match",
"xpos": 968,
"height": 18
}
],
"tags": [
"DESKTOP-gnome",
"LANGUAGE-french",
"graphical_desktop_clean"
],
"properties": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

View File

@ -0,0 +1,16 @@
{
"tags": [
"LANGUAGE-french",
"getting_started"
],
"properties": [],
"area": [
{
"xpos": 467,
"ypos": 36,
"width": 88,
"height": 16,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,17 @@
{
"area": [
{
"xpos": 343,
"ypos": 375,
"width": 338,
"height": 58,
"type": "match"
}
],
"tags": [
"DESKTOP-gnome",
"LANGUAGE-french",
"graphical_login_input"
],
"properties": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

View File

@ -0,0 +1,16 @@
{
"properties": [],
"tags": [
"LANGUAGE-french",
"next_button"
],
"area": [
{
"xpos": 955,
"ypos": 43,
"width": 47,
"height": 14,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,16 @@
{
"tags": [
"LANGUAGE-french",
"skip_button"
],
"properties": [],
"area": [
{
"xpos": 960,
"ypos": 43,
"width": 43,
"height": 14,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -10,6 +10,7 @@
], ],
"properties": [], "properties": [],
"tags": [ "tags": [
"getting_started" "getting_started",
"LANGUAGE-english"
] ]
} }

View File

@ -10,6 +10,7 @@
], ],
"properties": [], "properties": [],
"tags": [ "tags": [
"getting_started" "getting_started",
"LANGUAGE-english"
] ]
} }

View File

@ -0,0 +1,15 @@
{
"area": [
{
"height": 13,
"width": 33,
"ypos": 7,
"type": "match",
"xpos": 854
}
],
"properties": [],
"tags": [
"gnome_layout_us"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

View File

@ -0,0 +1,14 @@
{
"area": [
{
"height": 13,
"type": "match",
"width": 33,
"xpos": 853,
"ypos": 7
}
],
"tags": [
"gnome_layout_us"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

View File

@ -2,10 +2,7 @@
"tags": [ "tags": [
"graphical_login", "graphical_login",
"login_screen", "login_screen",
"DESKTOP-gnome", "DESKTOP-gnome"
"ENV-DISTRI-fedora",
"LANGUAGE-english",
"ENV-FLAVOR-develop"
], ],
"properties": [], "properties": [],
"area": [ "area": [

View File

@ -10,6 +10,7 @@
], ],
"properties": [], "properties": [],
"tags": [ "tags": [
"next_button" "next_button",
"LANGUAGE-english"
] ]
} }

View File

@ -1,6 +1,7 @@
{ {
"tags": [ "tags": [
"next_button" "next_button",
"LANGUAGE-english"
], ],
"area": [ "area": [
{ {
@ -12,4 +13,4 @@
} }
], ],
"properties": [] "properties": []
} }

View File

@ -10,6 +10,7 @@
], ],
"properties": [], "properties": [],
"tags": [ "tags": [
"next_button" "next_button",
"LANGUAGE-english"
] ]
} }

View File

@ -0,0 +1,25 @@
{
"area": [
{
"height": 15,
"type": "match",
"width": 44,
"ypos": 7,
"xpos": 12
},
{
"height": 18,
"width": 43,
"ypos": 4,
"type": "match",
"xpos": 968
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"ENV-DISTRI-fedora",
"LANGUAGE-russian",
"graphical_desktop_clean"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

View File

@ -0,0 +1,16 @@
{
"tags": [
"LANGUAGE-russian",
"getting_started"
],
"properties": [],
"area": [
{
"height": 17,
"type": "match",
"width": 104,
"ypos": 34,
"xpos": 460
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"height": 13,
"type": "match",
"width": 33,
"xpos": 853,
"ypos": 7
}
],
"tags": [
"gnome_layout_native",
"LANGUAGE-russian"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"height": 13,
"type": "match",
"width": 33,
"xpos": 853,
"ypos": 7
}
],
"tags": [
"gnome_layout_native",
"LANGUAGE-russian"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

View File

@ -0,0 +1,17 @@
{
"tags": [
"DESKTOP-gnome",
"LANGUAGE-russian",
"graphical_login_input"
],
"properties": [],
"area": [
{
"type": "match",
"width": 341,
"ypos": 374,
"xpos": 341,
"height": 59
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

View File

@ -0,0 +1,16 @@
{
"tags": [
"LANGUAGE-russian",
"next_button"
],
"properties": [],
"area": [
{
"xpos": 952,
"type": "match",
"ypos": 37,
"width": 55,
"height": 25
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"xpos": 921,
"type": "match",
"ypos": 41,
"width": 82,
"height": 20
}
],
"properties": [],
"tags": [
"LANGUAGE-russian",
"skip_button"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -10,6 +10,7 @@
], ],
"properties": [], "properties": [],
"tags": [ "tags": [
"skip_button" "skip_button",
"LANGUAGE-english"
] ]
} }

View File

@ -1933,19 +1933,27 @@
name => "install_european_language", name => "install_european_language",
settings => [ settings => [
{ key => "LANGUAGE", value => "french" }, { key => "LANGUAGE", value => "french" },
{ key => "DESKTOP", value => "gnome" },
{ key => "PACKAGE_SET", value => "workstation" },
{ key => "USER_LOGIN", value => "qwerty" }, { key => "USER_LOGIN", value => "qwerty" },
{ key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "ROOT_PASSWORD", value => "weakpassword" },
{ key => "ENCRYPT_PASSWORD", value => "weakpassword" }, { key => "ENCRYPT_PASSWORD", value => "weakpassword" },
{ key => "POSTINSTALL", value => "_console_login" },
{ key => "REPOSITORY_VARIATION", value => "%LOCATION%" },
], ],
}, },
{ {
name => "install_cyrillic_language", name => "install_cyrillic_language",
settings => [ settings => [
{ key => "LANGUAGE", value => "russian" }, { key => "LANGUAGE", value => "russian" },
{ key => "DESKTOP", value => "gnome" },
{ key => "PACKAGE_SET", value => "workstation" },
{ key => "SWITCHED_LAYOUT", value => "1" }, { key => "SWITCHED_LAYOUT", value => "1" },
{ key => "USER_LOGIN", value => "qwerty" }, { key => "USER_LOGIN", value => "qwerty" },
{ key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "ROOT_PASSWORD", value => "weakpassword" },
{ key => "ENCRYPT_PASSWORD", value => "weakpassword" }, { key => "ENCRYPT_PASSWORD", value => "weakpassword" },
{ key => "POSTINSTALL", value => "_console_login" },
{ key => "REPOSITORY_VARIATION", value => "%LOCATION%" },
], ],
}, },
{ {

29
tests/_console_login.pm Normal file
View File

@ -0,0 +1,29 @@
use base "fedorabase";
use strict;
use testapi;
use main_common;
sub run {
my $self = shift;
send_key "ctrl-alt-f3";
# do user login unless USER_LOGIN is set to string 'false'
unless (get_var("USER_LOGIN") eq "false") {
console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword"));
}
if (get_var("ROOT_PASSWORD")) {
console_login(user=>"root", password=>get_var("ROOT_PASSWORD"));
}
}
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, milestone => 1 };
}
1;
# vim: set sw=4 et:

View File

@ -9,9 +9,9 @@ sub type_user_password {
if (get_var("SWITCHED_LAYOUT")) { if (get_var("SWITCHED_LAYOUT")) {
# we double the password, the second time using the native # we double the password, the second time using the native
# layout, so the password has both US and native characters # layout, so the password has both US and native characters
$self->switch_layout("us"); desktop_switch_layout "us", "anaconda";
type_very_safely $user_password; type_very_safely $user_password;
$self->switch_layout("native"); desktop_switch_layout "native", "anaconda";
type_very_safely $user_password; type_very_safely $user_password;
} }
else { else {
@ -37,7 +37,7 @@ sub run {
assert_screen "anaconda_install_root_password_screen"; assert_screen "anaconda_install_root_password_screen";
# wait out animation # wait out animation
wait_still_screen 2; wait_still_screen 2;
$self->switch_layout("us") if (get_var("SWITCHED_LAYOUT")); desktop_switch_layout("us", "anaconda") if (get_var("SWITCHED_LAYOUT"));
if (get_var("IMAGETYPE") eq 'dvd-ostree') { if (get_var("IMAGETYPE") eq 'dvd-ostree') {
# we can't type SUPER safely for ostree installer tests, as # we can't type SUPER safely for ostree installer tests, as
# the install completes quite fast and if we type too slow # the install completes quite fast and if we type too slow

View File

@ -22,7 +22,19 @@ sub run {
send_key "ret"; send_key "ret";
} }
assert_screen "graphical_login_input"; assert_screen "graphical_login_input";
type_very_safely get_var("USER_PASSWORD", "weakpassword"); my $password = get_var("USER_PASSWORD", "weakpassword");
if (get_var("SWITCHED_LAYOUT")) {
# see _do_install_and_reboot; when layout is switched
# user password is doubled to contain both US and native
# chars
desktop_switch_layout 'us';
type_very_safely $password;
desktop_switch_layout 'native';
type_very_safely $password;
}
else {
type_very_safely $password;
}
send_key "ret"; send_key "ret";
# Handle initial-setup, for GNOME, unless START_AFTER_TEST # Handle initial-setup, for GNOME, unless START_AFTER_TEST
@ -52,6 +64,11 @@ sub run {
mouse_set(300, 200); mouse_set(300, 200);
# KDE can take ages to start up # KDE can take ages to start up
assert_screen "graphical_desktop_clean", 120; assert_screen "graphical_desktop_clean", 120;
if (get_var("SWITCHED_LAYOUT")) {
# check both layouts are available at the desktop
desktop_switch_layout 'us';
desktop_switch_layout 'native';
}
} }
} }

View File

@ -16,14 +16,14 @@ sub run {
# type password for disk encryption # type password for disk encryption
wait_idle 5; wait_idle 5;
if (get_var("SWITCHED_LAYOUT")) { if (get_var("SWITCHED_LAYOUT")) {
$self->switch_layout("us"); desktop_switch_layout "us", "anaconda";
} }
type_safely get_var("ENCRYPT_PASSWORD"); type_safely get_var("ENCRYPT_PASSWORD");
wait_screen_change { send_key "tab"; }; wait_screen_change { send_key "tab"; };
type_safely 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"); desktop_switch_layout "native", "anaconda";
} }
assert_and_click "anaconda_install_destination_save_passphrase"; assert_and_click "anaconda_install_destination_save_passphrase";