Skip to content

Commit

Permalink
Integrate bug status into the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
asdil12 committed May 31, 2017
1 parent fae9eb3 commit 267c0f8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
10 changes: 8 additions & 2 deletions assets/stylesheets/openqa.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ $color-resborder-unk: $color-module-none;
$color-highlight-parent: #ffe0e0;
$color-highlight-child: #d0f0ff;
$color-labels: gray;
$color-bolt: #ffbf00; /* amber */
$color-bug: #f2b500; /* amber */
$color-bug-closed: #6d6d6d; /* gray */
$color-state-scheduled: #67A2B7;
$color-state-cancelled: $color-module-none;
$color-state-running: #8BDFFF;
Expand Down Expand Up @@ -502,7 +503,12 @@ div.flags {
.fa.result_user_restarted { color: $color-module-none; }

.fa.comment, .fa.bookmark, .fa.bug, .fa.certificate, .fa.tag { color: $color-labels; }
.label_bug.fa-bolt { color: $color-bolt; }
.label_bug.fa-bolt { padding: 0 3px; }
.label_bug { color: $color-bug; }
.label_bug.bug_closed {
color: $color-bug-closed;
transform: rotate(180deg);
}

.step_actions {
.step_action { color: $color-step-actions; }
Expand Down
7 changes: 6 additions & 1 deletion lib/OpenQA/WebAPI/Plugin/Helpers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ sub register {
$app->helper(
bugicon_for => sub {
my ($c, $text) = @_;
return ($text =~ /(poo|gh)#/) ? 'label_bug fa fa-bolt' : 'label_bug fa fa-bug';
my $css_class = ($text =~ /(poo|gh)#/) ? 'label_bug fa fa-bolt' : 'label_bug fa fa-bug';
my $bug = OpenQA::Schema::Result::Bugs->get_bug($text, $c->db);
if ($bug && !$bug->is_open) {
$css_class .= " bug_closed";
}
return $css_class;
});

$app->helper(bug_report_actions => sub { shift->include_branding('external_reporting') });
Expand Down
37 changes: 36 additions & 1 deletion t/ui/10-tests_overview.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,34 @@ use t::ui::PhantomTest;
my $test_case = OpenQA::Test::Case->new;
$test_case->init_data;

my $driver = call_phantom();
sub schema_hook {
my $schema = OpenQA::Test::Database->new->create;
my $comments = $schema->resultset('Comments');
my $bugs = $schema->resultset('Bugs');

$comments->create(
{
text => 'bsc#111111 Python > Perl',
user_id => 1,
job_id => 99937,
});

$comments->create(
{
text => 'bsc#222222 D > Perl',
user_id => 1,
job_id => 99946,
});

$bugs->create(
{
bugid => 'bsc#111111',
is_refreshed => 1,
is_open => 0,
});
}

my $driver = call_phantom(\&schema_hook);

unless ($driver) {
plan skip_all => $t::ui::PhantomTest::phantommissing;
Expand Down Expand Up @@ -73,6 +100,14 @@ is(scalar @descriptions, 1, 'only test suites with description content are shown
$descriptions[0]->click();
is($driver->find_element('.popover-title')->get_text, 'kde', 'description popover shows content');

# Test bug status
my @closed_bugs = $driver->find_elements('#bug-99937 .bug_closed', 'css');
is(scalar @closed_bugs, 1, 'closed bug correctly shown');

my @open_bugs = $driver->find_elements('#bug-99946 .label_bug', 'css');
@closed_bugs = $driver->find_elements('#bug-99946 .bug_closed', 'css');
ok((scalar @open_bugs == 1) && (scalar @closed_bugs == 0), 'open bug correctly shown');

kill_phantom();

done_testing();

0 comments on commit 267c0f8

Please sign in to comment.