From 028fa21c9187908f0facaa70728a809b91ad6c49 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 24 Oct 2023 16:11:10 -0700
Subject: [PATCH] Fix skipping Selenium tests
Not sure what changed, but on current Fedora Rawhide, just
'exit'ing like this now results in a 255 exit code and a failed
test. Before:
Install Selenium::Remote::Driver and Selenium::Chrome to run these tests
./t/ui/27-plugin_obs_rsync_status_details.t ................. ok
Install Selenium::Remote::Driver and Selenium::Chrome to run these tests
./t/ui/28-keys_to_render_as_links.t ......................... ok
All tests successful.
after:
Install Selenium::Remote::Driver and Selenium::Chrome to run these tests
./t/ui/27-plugin_obs_rsync_status_details.t ................. ok
Install Selenium::Remote::Driver and Selenium::Chrome to run these tests
./t/ui/28-keys_to_render_as_links.t ......................... skipped: (no reason given)
...
./t/ui/28-keys_to_render_as_links.t (Wstat: 65280 (exited 255) Tests: 0 Failed: 0)
Non-zero exit status: 255
This uses `plan skip_all` to skip these tests correctly.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
t/lib/OpenQA/SeleniumTest.pm | 4 +---
t/ui/27-plugin_obs_rsync_status_details.t | 3 ++-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/t/lib/OpenQA/SeleniumTest.pm b/t/lib/OpenQA/SeleniumTest.pm
index cad768a52..86d08f53e 100644
--- a/t/lib/OpenQA/SeleniumTest.pm
+++ b/t/lib/OpenQA/SeleniumTest.pm
@@ -352,9 +352,7 @@ sub get_mojoport () { $mojoport }
# uncoverable subroutine
# uncoverable statement
sub driver_missing () {
- diag 'Install Selenium::Remote::Driver and Selenium::Chrome to run these tests'; # uncoverable statement
- done_testing; # uncoverable statement
- exit; # uncoverable statement
+ plan skip_all => 'Install Selenium::Remote::Driver and Selenium::Chrome to run these tests'; # uncoverable statement
}
END {
diff --git a/t/ui/27-plugin_obs_rsync_status_details.t b/t/ui/27-plugin_obs_rsync_status_details.t
index 89efcb4e2..379bed6a7 100644
--- a/t/ui/27-plugin_obs_rsync_status_details.t
+++ b/t/ui/27-plugin_obs_rsync_status_details.t
@@ -11,8 +11,9 @@ use OpenQA::Test::TimeLimit '60';
use OpenQA::SeleniumTest;
use OpenQA::Test::ObsRsync 'setup_obs_rsync_test';
+driver_missing unless check_driver_modules;
my ($t, $tempdir) = setup_obs_rsync_test(fixtures_glob => '01-jobs.pl 03-users.pl');
-driver_missing unless my $driver = call_driver();
+my $driver = call_driver();
$driver->find_element_by_class('navbar-brand')->click;
$driver->find_element_by_link_text('Login')->click;
--
2.41.0