Skip to content

Commit

Permalink
Pass timeout/interval when using regex to find UI element
Browse files Browse the repository at this point in the history
  • Loading branch information
hjluo committed Mar 8, 2023
1 parent aee1540 commit 28336cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ sub get_product_selection_page {
return $self->{ProductSelectionPage};
}

sub wait_product_selection_page {
my ($self, $args) = @_;
$args->{timeout} = YuiRestClient::get_timeout() * $args->{timeout_scale};
YuiRestClient::Wait::wait_until(object => sub {
$self->{ProductSelectionPage}->is_shown({timeout => 0});
}, %$args);
}

sub get_access_beta_distribution_popup {
my ($self) = @_;
die "Popup for accessing Beta Distribution is not displayed" unless $self->{AccessBetaDistributionPopup}->is_shown();
Expand Down
6 changes: 6 additions & 0 deletions lib/YuiRestClient.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ sub get_port {
return $port;
}

sub get_timeout {
return $app->{timeout};
}

sub set_host {
my ($yuihost) = @_;
$host = $yuihost;
Expand Down Expand Up @@ -216,6 +220,8 @@ The %args is a boolean $installation (see parameters of C<get_app()> above.)
B<get_port()> - returns port number for the rest server.
B<get_timeout()> - returns the current timeout.
B<init_logger> - Initializes logger instance.
The log path is 'ulogs/yui-log.txt'
Expand Down
6 changes: 5 additions & 1 deletion tests/installation/product_selection/install_SLES.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

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

sub run {
$testapi::distri->get_product_selection()->install_product('SLES');
my $product_selection = $testapi::distri->get_product_selection();

$product_selection->wait_product_selection_page({timeout_scale => get_var('TIMEOUT_SCALE', 1), message => 'Product Selection page is not displayed'});
$product_selection->install_product('SLES');
}

1;

0 comments on commit 28336cb

Please sign in to comment.