From 35beddd8cc71a4f34b0d761a6fe23407300cf6a5 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sun, 1 Apr 2018 14:42:16 +0000 Subject: [PATCH] Bug 20505: Patch selenium tests to skip gracefully TEST PLAN --------- 1) In a koha shell on kohadevbox, run prove -v t/db_dependent/selenium until it doesn't skip because of missing dependencies, but rather because of not running a selenium server. 2) apply this patch and restart_all 3) rerun the tests -- they will skip gracefully and informatively. 4) run koha qa test tools --- t/db_dependent/selenium/administration_tasks.t | 9 ++++++++- t/db_dependent/selenium/basic_workflow.t | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/selenium/administration_tasks.t b/t/db_dependent/selenium/administration_tasks.t index 4e4f518..5f65b59 100644 --- a/t/db_dependent/selenium/administration_tasks.t +++ b/t/db_dependent/selenium/administration_tasks.t @@ -24,6 +24,7 @@ use Modern::Perl; use C4::Context; use Test::More tests => 1; +use Try::Tiny; use t::lib::Selenium; @@ -42,7 +43,13 @@ SKIP: { $cleanup_needed = 1; - my $s = t::lib::Selenium->new; + my $s; + try { + $s = t::lib::Selenium->new; + } catch { + skip "Unable to create selenium driver link. Please review https://wiki.koha-community.org/wiki/Using_Selenium_with_Koha", 1; + }; + my $driver = $s->driver; my $mainpage = $s->base_url . q|mainpage.pl|; $driver->get($mainpage); diff --git a/t/db_dependent/selenium/basic_workflow.t b/t/db_dependent/selenium/basic_workflow.t index 420ca3c..325710a 100644 --- a/t/db_dependent/selenium/basic_workflow.t +++ b/t/db_dependent/selenium/basic_workflow.t @@ -41,6 +41,7 @@ use C4::Biblio qw( AddBiblio ); # We shouldn't use it use Test::More tests => 20; use MARC::Record; use MARC::Field; +use Try::Tiny; use t::lib::Selenium; @@ -85,9 +86,14 @@ SKIP: { $cleanup_needed = 1; - open my $fh, '>>', '/tmp/output.txt'; + my $s; + try { + $s = t::lib::Selenium->new; + } catch { + skip "Unable to create selenium driver link. Please review https://wiki.koha-community.org/wiki/Using_Selenium_with_Koha", 20; + }; - my $s = t::lib::Selenium->new; + open my $fh, '>>', '/tmp/output.txt'; my $driver = $s->driver; my $base_url = $s->base_url; -- 2.1.4