Skip to content

Commit

Permalink
Issue #688: no need to override get()
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Dec 29, 2020
1 parent a4613df commit 32878a5
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions Kernel/System/UnitTest/Selenium.pm
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,23 @@ sub new {
# and that an automatic check is not implemented
my $IsWD3 = delete $SeleniumTestsConfig{is_wd3};

my $BaseURL = join '://',
$Kernel::OM->Get('Kernel::Config')->Get('HttpType'),
Kernel::System::UnitTest::Helper->GetTestHTTPHostname();

# TEMPORARY WORKAROUND FOR GECKODRIVER BUG https://github.com/mozilla/geckodriver/issues/1470:
# If marionette handshake fails, wait and try again. Can be removed after the bug is fixed
# in a new geckodriver version.
my $Self = eval {
$Class->SUPER::new(
base_url => $BaseURL,
webelement_class => 'Kernel::System::UnitTest::Selenium::WebElement',
error_handler => sub {
my $Self = shift;

return $Self->SeleniumErrorHandler(@_);
},
%SeleniumTestsConfig
%SeleniumTestsConfig,
);
};
if ($@) {
Expand Down Expand Up @@ -201,10 +206,8 @@ sub new {
$Self->set_window_size( $Height, $Width );
}

$Self->{BaseURL} = $Kernel::OM->Get('Kernel::Config')->Get('HttpType') . '://';
$Self->{BaseURL} .= Kernel::System::UnitTest::Helper->GetTestHTTPHostname();

# Remember the start system time for the selenium test run.
# This is needed for cleaning up OTOBO sessions.
$Self->{TestStartSystemTime} = time; ## no critic

return $Self;
Expand Down Expand Up @@ -318,28 +321,6 @@ sub _execute_command { ## no critic
return $Result;
}

=head2 get()
Override get method of base class to prepend the correct base URL.
$SeleniumObject->get(
$URL,
);
=cut

sub get { ## no critic
my ( $Self, $URL ) = @_;

if ( $URL !~ m{http[s]?://}smx ) {
$URL = "$Self->{BaseURL}/$URL";
}

$Self->SUPER::get($URL);

return;
}

=head2 get_alert_text()
Override get_alert_text() method of base class to return alert text as string.
Expand Down

0 comments on commit 32878a5

Please sign in to comment.