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

Create libyui module for yast2 kdump #16072

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/Distribution/Opensuse/Tumbleweed.pm
Expand Up @@ -52,6 +52,9 @@ use YaST::SystemSettings::SystemSettingsController;
use YaST::Firewall::FirewallController;
use YaST::DNSServer::DNSServerController;
use YaST::DNSServer::DNSServerSetupController;
use YaST::Kdump::StartUpPage;
use YaST::Kdump::FADumpStartUpPage;
use YaST::RestartInfoPage;

sub get_language_keyboard {
return Installation::LanguageKeyboard::LanguageKeyboardController->new();
Expand Down Expand Up @@ -213,4 +216,18 @@ sub get_dns_server_setup {
return YaST::DNSServer::DNSServerSetupController->new();
}

ge0r marked this conversation as resolved.
Show resolved Hide resolved
# Page Object Design only with Pages, not using Controllers

sub get_kdump_startup {
return YaST::Kdump::StartUpPage->new({app => YuiRestClient::get_app()});
}

sub get_kdump_fadump_startup {
return YaST::Kdump::FADumpStartUpPage->new({app => YuiRestClient::get_app()});
}

sub get_restart_info {
return YaST::RestartInfoPage->new({app => YuiRestClient::get_app()});
}

1;
34 changes: 34 additions & 0 deletions lib/YaST/Kdump/FADumpStartUpPage.pm
@@ -0,0 +1,34 @@
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Handles Kdump Firmware Assisted Dump Main Page.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package YaST::Kdump::FADumpStartUpPage;
use parent 'YaST::Kdump::StartUpPage';
use strict;
use warnings;

sub init {
my $self = shift;
$self->SUPER::init();
$self->{cbox_fadump} = $self->{app}->checkbox({id => "\"use_fadump\""});
jknphy marked this conversation as resolved.
Show resolved Hide resolved
$self->{sect_navigation} = YaST::Kdump::NavigationPage->new();
return $self;
}

sub get_firmware_assisted_dump_page {
my ($self) = @_;
die 'Firmware-Assisted Dump Page is not displayed' unless $self->{cbox_fadump}->exist();
return $self;
}

sub use_firmware_assisted_dump {
my ($self) = @_;
$self->get_firmware_assisted_dump_page()->{cbox_fadump}->check();
return $self;
}

1;
46 changes: 46 additions & 0 deletions lib/YaST/Kdump/NavigationPage.pm
@@ -0,0 +1,46 @@
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Handles Kdump Navigation Page.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package YaST::Kdump::NavigationPage;
use parent 'YaST::PageBase';
use strict;
use warnings;

sub init {
my ($self, $args) = @_;
$self->{btn_help} = $self->{app}->button({id => 'help'});
$self->{btn_cancel} = $self->{app}->button({id => 'abort'});
$self->{btn_ok} = $self->{app}->button({id => 'next'});
return $self;
}

sub get_navigation_page {
my ($self) = @_;
die 'Navigation Page is not displayed' unless $self->{btn_ok}->exist();
return $self;
}

sub help {
my ($self) = @_;
$self->get_navigation_page()->{btn_help}->click();
return $self;
}

sub cancel {
my ($self) = @_;
$self->get_navigation_page()->{btn_cancel}->click();
return $self;
}

sub ok {
my ($self) = @_;
$self->get_navigation_page()->{btn_ok}->click();
return $self;
}

1;
41 changes: 41 additions & 0 deletions lib/YaST/Kdump/StartUpPage.pm
@@ -0,0 +1,41 @@
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Handles Kdump StartUp Page.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package YaST::Kdump::StartUpPage;
use parent 'YaST::PageBase';
use strict;
use warnings;
use YaST::Kdump::NavigationPage;

sub init {
my $self = shift;
$self->{rbtn_shown} = $self->{app}->radiobutton({id => "\"EnableDisalbeKdump\""});
$self->{rbtn_enable} = $self->{app}->radiobutton({id => "\"enable_kdump\""});
$self->{rbtn_firmware} = $self->{app}->radiobutton({id => "\"enable_kdump\""});
jknphy marked this conversation as resolved.
Show resolved Hide resolved
$self->{sect_navigation} = YaST::Kdump::NavigationPage->new();
return $self;
}

sub get_startup_page {
my ($self) = @_;
die 'StartUp Page is not displayed' unless $self->{rbtn_shown}->exist();
return $self;
}

sub get_navigation {
my ($self) = @_;
return $self->get_startup_page()->{sect_navigation};
}

sub enable_kdump {
my ($self) = @_;
$self->get_startup_page()->{rbtn_enable}->select('true');
return $self;
}

1;
2 changes: 1 addition & 1 deletion lib/YaST/Module.pm
Expand Up @@ -47,7 +47,7 @@ sub open {
else {
die "Unknown user interface: $ui";
}
YuiRestClient::get_app()->check_connection();
YuiRestClient::get_app()->check_connection(timeout => $args{timeout});
jknphy marked this conversation as resolved.
Show resolved Hide resolved
}

=head2 close
Expand Down
24 changes: 24 additions & 0 deletions lib/YaST/PageBase.pm
@@ -0,0 +1,24 @@
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Handles Page base
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package YaST::PageBase;
use strict;
use warnings;

sub new {
my ($class, $args) = @_;
$args->{app} = YuiRestClient::get_app();
jknphy marked this conversation as resolved.
Show resolved Hide resolved
my $self = bless {
app => $args->{app}
}, $class;
return $self->init($args);
}

sub init ();

1;
31 changes: 31 additions & 0 deletions lib/YaST/RestartInfoPage.pm
@@ -0,0 +1,31 @@
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Handles Restart Info Page.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package YaST::RestartInfoPage;
use parent 'YaST::PageBase';
use strict;
use warnings;

sub init {
my $self = shift;
$self->{btn_ok} = $self->{app}->button({id => 'ok_msg'});
return $self;
}

sub get_restart_info_page {
my ($self) = @_;
die 'Restart Info Page is not displayed' unless $self->{btn_ok}->exist();
return $self;
}

sub confirm_reboot_needed {
my ($self) = @_;
$self->get_restart_info_page()->{btn_ok}->click();
}

1;
19 changes: 18 additions & 1 deletion schedule/yast/yast2_ncurses/yast2_ncurses_textmode.yaml
Expand Up @@ -2,18 +2,24 @@
name: yast2_ncurses_textmode
description: >
Test for yast2 UI, ncurses only. Running on created textmode image.
vars:
YUI_REST_API: 1
SCC_ADDONS: desktop,sdk
schedule:
- "{{bootloader_start}}"
- boot/boot_to_desktop
- console/prepare_test_data
- console/consoletest_setup
- console/scc_cleanup_reregister
- console/install_packages_simple
- console/firewalld_add_port
- console/setup_libyui_running_system
- console/yast2_lan
- console/yast2_i
- console/yast2_bootloader
- console/yast2_lan_device_settings
- "{{yast_nfs_server}}"
- console/yast2_kdump
- "{{yast2_kdump}}"
conditional_schedule:
bootloader_start:
BACKEND:
Expand All @@ -23,3 +29,14 @@ conditional_schedule:
BACKEND:
qemu:
- console/yast2_nfs_server
yast2_kdump:
BACKEND:
qemu:
- console/yast2_kdump_enable_kdump
svirt:
- console/yast2_kdump_accept_kdump_options
test_data:
install_packages:
- libyui-rest-api
port: 30000-50000
zone: public
35 changes: 35 additions & 0 deletions schedule/yast/yast2_ncurses/yast2_ncurses_textmode@spvm.yaml
@@ -0,0 +1,35 @@
---
name: yast2_ncurses_textmode_pvm
description: >
Test for yast2 UI, ncurses only. Running on created textmode image.
vars:
FADUMP: 1
YUI_REST_API: 1
SCC_ADDONS: desktop,sdk
schedule:
- installation/bootloader_start
- boot/boot_to_desktop
- console/system_prepare
- console/prepare_test_data
- console/consoletest_setup
- console/scc_cleanup_reregister
- console/install_packages_simple
- console/firewalld_add_port
- console/setup_libyui_running_system
- console/yast2_lan
- console/yast2_i
- console/yast2_bootloader
- console/yast2_kdump_use_fadump
test_data:
software:
patterns:
- apparmor
- base
- enhanced_base
- x11
- x11_yast
- yast2_basis
install_packages:
- libyui-rest-api
port: 30000-50000
zone: public
15 changes: 0 additions & 15 deletions schedule/yast/yast2_ncurses/yast2_ncurses_textmode_pvm.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions tests/console/yast2_kdump_accept_kdump_options.pm
@@ -0,0 +1,35 @@
# SUSE's openQA tests
jknphy marked this conversation as resolved.
Show resolved Hide resolved
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Nothing change and accept kdump options.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

use base "y2_module_consoletest";
use strict;
use warnings;

use cfg_files_utils qw(validate_cfg_file);
use scheduler qw(get_test_suite_data);
use testapi qw(save_screenshot select_console);
use utils qw(systemctl zypper_call);
use YaST::Module;

sub run {
my $startup = $testapi::distri->get_kdump_startup();

select_console('root-console');
zypper_call('in kdump');

YaST::Module::open(module => 'kdump', ui => 'ncurses');

$startup->get_navigation->ok();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_navigation() more or less our convention to be explicit with the function call parentheses.

save_screenshot;

select_console('root-console');
systemctl('is-enabled kdump');
validate_cfg_file(get_test_suite_data()->{config_files});
}

1;
40 changes: 40 additions & 0 deletions tests/console/yast2_kdump_enable_kdump.pm
@@ -0,0 +1,40 @@
# SUSE's openQA tests
#
# Copyright 2023 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Enable kdump and accept kdump options.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

use base "y2_module_consoletest";
use strict;
use warnings;

use cfg_files_utils qw(validate_cfg_file);
use scheduler qw(get_test_suite_data);
use testapi qw(save_screenshot select_console);
use utils qw(systemctl zypper_call);
use YaST::Module;

sub run {
my $startup = $testapi::distri->get_kdump_startup();
my $restartinfo = $testapi::distri->get_restart_info();

select_console('root-console');
zypper_call('in kdump');

YaST::Module::open(module => 'kdump', ui => 'ncurses', timeout => 120);

$startup->enable_kdump();
save_screenshot;
$startup->get_navigation->ok();
save_screenshot;
$restartinfo->confirm_reboot_needed();
save_screenshot;

select_console('root-console');
systemctl('is-enabled kdump');
validate_cfg_file(get_test_suite_data()->{config_files});
}

1;