Skip to content

Commit

Permalink
Merge pull request os-autoinst#5713 from Martchus/bootstrap-fixes
Browse files Browse the repository at this point in the history
Fix highlighting of parent/child jobs after Bootstrap 5 migration
  • Loading branch information
mergify[bot] authored Jun 19, 2024
2 parents 8adc1af + 5fa666c commit 5e0ae05
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions assets/stylesheets/dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ h2 .fa {
}

// highlighting on running table under 'All tests'
.highlight_parent {
.highlight_parent td {
background-color: $color-highlight-parent !important;
}
.highlight_child {
.highlight_child td {
background-color: $color-highlight-child !important;
}

Expand Down
27 changes: 19 additions & 8 deletions t/ui/01-list.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use Test::Most;

use FindBin;
use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../external/os-autoinst-common/lib";
use Mojo::Base -signatures;

use Date::Format 'time2str';
use Test::Mojo;
use Mojo::File qw(tempdir);
Expand Down Expand Up @@ -346,20 +348,29 @@ is($parent_e->get_attribute('title'), "1 chained child", "dep info");
is($parent_e->get_attribute('data-children'), "[99938]", "child");
is($parent_e->get_attribute('data-parents'), "[]", "no parents");

# no highlighting in first place
sub no_highlighting {
is(scalar @{$driver->find_elements('#results #job_99937.highlight_parent')}, 0, 'parent not highlighted');
is(scalar @{$driver->find_elements('#results #job_99938.highlight_child')}, 0, 'child not highlighted');
sub get_effective_cell_background ($row_id) {
$driver->execute_script(
"return Array.from(new Set(Array.from(document.getElementById('$row_id').getElementsByTagName('td'))
.map(e => getComputedStyle(e).backgroundColor)))"
);
}
no_highlighting;
sub check_no_highlighting {
is scalar @{$driver->find_elements('#job_99937.highlight_parent')}, 0, 'parent not highlighted';
is scalar @{$driver->find_elements('#job_99938.highlight_child')}, 0, 'child not highlighted';
}

# no highlighting in first place
check_no_highlighting;

# job dependencies highlighted on hover
$driver->move_to(element => $child_e);
is(scalar @{$driver->find_elements('#results #job_99937.highlight_parent')}, 1, 'parent highlighted');
is scalar(@{$driver->find_elements('#job_99937.highlight_parent')}), 1, 'parent highlighted';
is_deeply get_effective_cell_background('job_99937'), ['rgb(255, 224, 224)'], 'parent highlighting effective';
$driver->move_to(element => $parent_e);
is(scalar @{$driver->find_elements('#results #job_99938.highlight_child')}, 1, 'child highlighted');
is scalar(@{$driver->find_elements('#job_99938.highlight_child')}), 1, 'child highlighted';
is_deeply get_effective_cell_background('job_99938'), ['rgb(208, 240, 255)'], 'child highlighting effective';
$driver->move_to(xoffset => 200, yoffset => 500);
no_highlighting;
check_no_highlighting;

# first check the relevant jobs
my @jobs = map { $_->get_attribute('id') } @{$driver->find_elements('#results tbody tr', 'css')};
Expand Down

0 comments on commit 5e0ae05

Please sign in to comment.