Skip to content

Commit

Permalink
Change needle-based installation testing to libyui
Browse files Browse the repository at this point in the history
Perform testing with libyui REST API since the version of the product where it is
available, SP3 and above.

Related ticket: https://progress.opensuse.org/issues/112574
  • Loading branch information
ilmanzo committed Aug 12, 2022
1 parent f3fb759 commit 4d038c4
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Distribution/Sle/15_current.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use Installation::AddOnProduct::AddOnProductController;
use Installation::RepositoryURL::RepositoryURLController;
use Installation::AddOnProductInstallation::AddOnProductInstallationController;
use Installation::SystemRole::Sle::SystemRoleController;
use Installation::ModuleRegistration::ModuleRegCodeController;

=head2 get_license_agreement
Expand Down Expand Up @@ -54,6 +55,10 @@ sub get_module_registration {
return Installation::ModuleRegistration::ModuleRegistrationController->new();
}

sub get_module_regcode {
return Installation::ModuleRegistration::ModuleRegCodeController->new();
}

sub get_module_selection {
return Installation::ModuleSelection::ModuleSelectionController->new();
}
Expand Down
60 changes: 60 additions & 0 deletions lib/Installation/ModuleRegistration/ModuleRegCodeController.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SUSE's openQA tests
#
# Copyright 2022 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: The class introduces business actions for Module Registration Code dialog.
#
# Maintainer: QE YaST <qa-sle-yast@suse.de>

package Installation::ModuleRegistration::ModuleRegCodeController;
use strict;
use warnings;
use Installation::ModuleRegistration::ModuleRegCodePage;
use Installation::Popups::UntrustedGPGPopup;
use YuiRestClient;

sub new {
my ($class, $args) = @_;
my $self = bless {}, $class;
return $self->init($args);
}

sub init {
my ($self, $args) = @_;
$self->{ModuleRegCodePage} = Installation::ModuleRegistration::ModuleRegCodePage->new({app => YuiRestClient::get_app()});
$self->{UntrustedGPGKeyPopup} = Installation::Popups::UntrustedGPGPopup->new({app => YuiRestClient::get_app()});
return $self;
}

sub get_module_regcode_page {
my ($self) = @_;
die "Module Registration Code page is not displayed" unless $self->{ModuleRegCodePage}->is_shown();
return $self->{ModuleRegCodePage};
}

sub get_untrusted_GPG_popup {
my ($self) = @_;
die "Untrusted GPG key popup is not displayed" unless $self->{UntrustedGPGKeyPopup}->is_shown();
return $self->{UntrustedGPGKeyPopup};
}

sub wait_regcode_page {
my ($self, $args) = @_;
YuiRestClient::Wait::wait_until(object => sub {
$self->{ModuleRegCodePage}->is_shown({timeout => 0});
}, %$args);
}

sub license_workstation_ext_module {
my ($self, $regcode) = @_;
$self->get_module_regcode_page()->set_we_code($regcode);
$self->get_module_regcode_page()->press_next();
}

sub handle_untrusted_gpg_key {
my ($self) = @_;
$self->get_untrusted_GPG_popup()->press_trust();
}

1;
40 changes: 40 additions & 0 deletions lib/Installation/ModuleRegistration/ModuleRegCodePage.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SUSE's openQA tests
#
# Copyright 2022 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: The module provides interface to act with page that ask for module extra registration code
#
# Maintainer: QE YaST <qa-sle-yast@suse.de>

package Installation::ModuleRegistration::ModuleRegCodePage;
use parent 'Installation::Navigation::NavigationBase';
use strict;
use warnings;

sub new {
my ($class, $args) = @_;
my $self = bless {
app => $args->{app}
}, $class;
return $self->init();
}

sub init {
my ($self) = @_;
$self->SUPER::init();
$self->{tb_we_code} = $self->{app}->textbox({id => '"sle-we"'});
return $self;
}

sub is_shown {
my ($self) = @_;
return $self->{tb_we_code}->exist();
}

sub set_we_code {
my ($self, $code) = @_;
$self->{tb_we_code}->set($code);
}

1;
3 changes: 3 additions & 0 deletions lib/Installation/ModuleRegistration/ModuleRegistrationPage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ sub init {
$self->SUPER::init();
$self->{chb_hide_dev_versions} = $self->{app}->checkbox({id => 'filter_devel'});
$self->{rct_items} = $self->{app}->richtext({id => 'items'});
$self->{rct_item_workstation} = 'sle-we';
$self->{rct_item_basesystem} = 'sle-module-basesystem';
$self->{rct_item_containers} = 'sle-module-containers';
$self->{rct_item_desktop} = 'sle-module-desktop-applications';
$self->{rct_item_development} = 'sle-module-development-tools';
$self->{rct_item_legacy} = 'sle-module-legacy';
$self->{rct_item_transactional} = 'sle-module-transactional-server';
$self->{rct_item_web} = 'sle-module-web-scripting';
$self->{rct_item_python3} = 'sle-module-python3';
return $self;
}

Expand Down
38 changes: 38 additions & 0 deletions lib/Installation/Popups/UntrustedGPGPopup.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SUSE's openQA tests
#
# Copyright 2022 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: The class introduces methods to handle
# a Trust&Import popup.
# Maintainer: QE YaST <qa-sle-yast@suse.de>

package Installation::Popups::UntrustedGPGPopup;
use strict;
use warnings;

sub new {
my ($class, $args) = @_;
my $self = bless {
app => $args->{app}
}, $class;
return $self->init();
}

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

sub is_shown {
my ($self) = @_;
$self->{btn_trust}->exist();
}

sub press_trust {
my ($self) = @_;
$self->{btn_trust}->click();
}

1;
37 changes: 37 additions & 0 deletions schedule/qam/common/qam-yast_self_update_libyui-rest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: qam-yast_self_update_libyui-rest
description: installation using self_update as boot parameter
vars:
YUI_REST_API: 1
schedule:
- installation/bootloader_start
- installation/setup_libyui
- installation/product_selection/install_SLES
- installation/validate_self_update
- installation/licensing/accept_license
- installation/registration/register_via_scc
- installation/module_registration/register_modules
- installation/add_on_product/skip_install_addons
- installation/system_role
- installation/partitioning
- installation/partitioning_finish
- installation/installer_timezone
- installation/hostname_inst
- installation/user_settings
- installation/user_settings_root
- installation/resolve_dependency_issues
- installation/installation_overview
- installation/disable_grub_timeout
- installation/start_install
- installation/await_install
- installation/logs_from_installation_system
- installation/reboot_after_installation
- installation/grub_test
- installation/first_boot
- '{{efi}}'
conditional_schedule:
efi:
MACHINE:
uefi:
- console/consoletest_setup
- console/verify_efi_mok
33 changes: 33 additions & 0 deletions tests/installation/module_registration/register_modules.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SUSE's openQA tests
#
# Copyright 2021 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Register Application module
# in "Extension and Module Selection" dialog
# Medium: Online (you see the "Hide Development versions" checkbox)
#
# Maintainer: QA SLE YaST team <qa-sle-yast@suse.de>

use base 'y2_installbase';
use strict;
use warnings;
use testapi;

sub run {
$testapi::distri->get_module_registration()->register_modules([qw(workstation basesystem development legacy containers python3 desktop)]);
save_screenshot;
my $timeout = 2400 * get_var('TIMEOUT_SCALE', 1);
$testapi::distri->get_module_regcode()->wait_regcode_page({
timeout => $timeout,
interval => 2,
message => 'Page to insert module registration code did not appear'});
# some modules (e.g. workstation) require registration, provide code
my $regcode = get_var('SCC_REGCODE_WE');
$testapi::distri->get_module_regcode()->license_workstation_ext_module($regcode);
save_screenshot;
# confirm to trust the untrusted GPG key
$testapi::distri->get_module_regcode()->handle_untrusted_gpg_key();
}

1;

0 comments on commit 4d038c4

Please sign in to comment.