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

Handle java license popup during installation #16346

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions lib/Distribution/Opensuse/Tumbleweed.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use Installation::SystemProbing::EncryptedVolumeActivationController;
use Installation::SystemRole::SystemRoleController;
use Installation::Popups::OKPopupController;
use Installation::Popups::YesNoPopupController;
use Installation::Popups::AcceptPopupController;
use YaST::Bootloader::BootloaderSettingsController;
use YaST::Firstboot::ConfigurationCompletedController;
use YaST::Firstboot::HostNameController;
Expand Down Expand Up @@ -176,6 +177,10 @@ sub get_yes_no_popup_controller {
return Installation::Popups::YesNoPopupController->new();
}

sub get_accept_popup_controller {
return Installation::Popups::AcceptPopupController->new();
}

sub get_encrypted_volume_activation {
return Installation::SystemProbing::EncryptedVolumeActivationController->new();
}
Expand Down
38 changes: 38 additions & 0 deletions lib/Installation/Popups/AcceptPopup.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
# an Accept license popup.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package Installation::Popups::AcceptPopup;
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_accept} = $self->{app}->button({id => 'accept'});
return $self;
}

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

sub press_accept {
my ($self) = @_;
$self->{btn_accept}->click();
}

1;
46 changes: 46 additions & 0 deletions lib/Installation/Popups/AcceptPopupController.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SUSE's openQA tests
#
# Copyright 2021 SUSE LLC
Copy link
Contributor

Choose a reason for hiding this comment

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

2023 and rest of the files.

# SPDX-License-Identifier: FSFAP

# Summary: The class introduces business actions for Popups with Accept option
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

package Installation::Popups::AcceptPopupController;
use strict;
use warnings;
use YuiRestClient;
use YuiRestClient::Wait;
use Installation::Popups::AcceptPopup;

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

sub init {
my ($self) = @_;
$self->{AcceptPopup} = Installation::Popups::AcceptPopup->new({app => YuiRestClient::get_app()});
return $self;
}

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

sub get_accept_popup {
my ($self) = @_;
die 'Accept Popup is not displayed' unless $self->{AcceptPopup}->is_shown();
return $self->{AcceptPopup};
}

sub accept {
my ($self) = @_;
$self->get_accept_popup()->press_accept();
}

1;
24 changes: 24 additions & 0 deletions tests/installation/confirm_package_license.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SUSE's openQA tests
#
# Copyright 2021 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: This test module confirms the popup for Package license.

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

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

sub run {
my $package_license_popup = $testapi::distri->get_accept_popup_controller();
$package_license_popup->wait_accept_popup({
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need to wait for some action in progress to capture this popup, it appears immediately after clicking install, only accept should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't work without the wait

timeout => 3000,
interval => 2,
message => 'Accept license popup did not appear'});

$package_license_popup->accept();
}

1;