Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard layout test to Installer #4308

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions products/opensuse/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ sub load_boot_tests {

sub load_inst_tests {
loadtest "installation/welcome";
loadtest "installation/keyboard_selection";
if (check_var('ARCH', 's390x')) {
loadtest "installation/disk_activation";
}
Expand Down
1 change: 1 addition & 0 deletions products/sle/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ sub install_this_version {

sub load_inst_tests {
loadtest "installation/welcome";
loadtest "installation/keyboard_selection";
if (get_var('DUD_ADDONS')) {
loadtest "installation/dud_addon";
}
Expand Down
64 changes: 64 additions & 0 deletions tests/installation/keyboard_selection.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# SUSE's openQA tests
#
# Copyright © 2009-2013 Bernhard M. Wiedemann
# Copyright © 2012-2018 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: Switch keyboard layout to a different language and switch back to default
# Maintainer: Joaquín Rivera <jeriveramoya@suse.de>

use strict;
use warnings;
use base "y2logsstep";
use testapi;
use version_utils qw(is_sle sle_version_at_least);

sub switch_keyboard_layout {
return unless get_var('INSTALL_KEYBOARD_LAYOUT');
my $keyboard_layout = get_var('INSTALL_KEYBOARD_LAYOUT');
# for instance, select france and test "querty"
send_key 'alt-k'; # Keyboard Layout
send_key_until_needlematch("keyboard-layout-$keyboard_layout", 'down', 60);
if (check_var('DESKTOP', 'textmode')) {
send_key 'ret';
send_key 'alt-e'; # Keyboard Test in text mode
}
else {
send_key 'alt-y'; # Keyboard Test in graphic mode
}
type_string "azerty";
assert_screen "keyboard-test-$keyboard_layout";
# Select back default keyboard layout
send_key 'alt-k';
send_key_until_needlematch("keyboard-layout", 'up', 60);
send_key 'ret' if (check_var('DESKTOP', 'textmode'));
}

sub run {
switch_keyboard_layout;

send_key $cmd{next} unless (is_sle && sle_version_at_least('15') && get_var('UPGRADE'));
if (!check_var('INSTLANG', 'en_US') && check_screen 'langincomplete', 1) {
send_key 'alt-f';
}
}

sub post_fail_hook {
my ($self) = @_;
# system might be stuck on bootup showing only splash screen so we press
# esc to show console logs
send_key 'esc';
select_console('install-shell');
# in case we could not even reach the installer welcome screen and logs
# could not be collected on the serial output:
$self->save_upload_y2logs;
$self->get_ip_address;
upload_logs '/var/log/linuxrc.log';
}

1;
# vim: set sw=4 et:
6 changes: 1 addition & 5 deletions tests/installation/welcome.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SUSE's openQA tests
#
# Copyright © 2009-2013 Bernhard M. Wiedemann
# Copyright © 2012-2017 SUSE LLC
# Copyright © 2012-2018 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
Expand Down Expand Up @@ -113,10 +113,6 @@ sub run {
}

assert_screen 'languagepicked';
send_key $cmd{next} unless (is_sle && sle_version_at_least('15') && get_var('UPGRADE'));
if (!check_var('INSTLANG', 'en_US') && check_screen 'langincomplete', 1) {
send_key 'alt-f';
}
}

sub post_fail_hook {
Expand Down