From 6df945da5900da86203e0527816690cb1d52c574 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 3 Apr 2018 23:05:04 -0400 Subject: Bug 1455495 - Replace apache with Mojolicious --- qa/t/lib/QA/Util.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'qa/t/lib') diff --git a/qa/t/lib/QA/Util.pm b/qa/t/lib/QA/Util.pm index 5d041d560..bf9151fee 100644 --- a/qa/t/lib/QA/Util.pm +++ b/qa/t/lib/QA/Util.pm @@ -18,6 +18,7 @@ use Sys::Hostname qw(hostname); use Socket qw(inet_ntoa); use WWW::Selenium::Util qw(server_is_running); use URI; +use URI::QueryParam; # Fixes wide character warnings BEGIN { @@ -50,6 +51,7 @@ use base qw(Exporter); get_selenium get_rpc_clients + check_page_load WAIT_TIME CHROME_MODE @@ -396,6 +398,32 @@ sub set_parameters { } } +my @ANY_KEYS = qw( t token ); + +sub check_page_load { + my ($sel, $wait, $expected) = @_; + my $expected_uri = URI->new($expected); + $sel->wait_for_page_to_load_ok($wait); + my $uri = URI->new($sel->get_location); + + foreach my $u ($expected_uri, $uri) { + $u->host('HOSTNAME'); + foreach my $any_key (@ANY_KEYS) { + if ($u->query_param($any_key)) { + $u->query_param($any_key => '__ANYTHING__'); + } + } + } + + if ($expected_uri->query_param('id')) { + if ($expected_uri->query_param('id') eq '__BUG_ID__') { + $uri->query_param('id' => '__BUG_ID__'); + } + } + my ($pkg, $file, $line) = caller; + is($uri, $expected_uri, "checking location on $file line $line"); +} + 1; __END__ -- cgit v1.2.3-24-g4f1b