Skip to content

Commit

Permalink
Fix skipping Selenium tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
AdamWill committed Oct 31, 2023
1 parent c944acc commit 028fa21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions t/lib/OpenQA/SeleniumTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion t/ui/27-plugin_obs_rsync_status_details.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 028fa21

Please sign in to comment.