Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #538 from okurz/feature/label_and_previous_results
Show previous results in test results page
- Loading branch information
Showing
8 changed files
with
224 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (C) 2016 SUSE Linux GmbH | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
BEGIN { | ||
unshift @INC, 'lib'; | ||
} | ||
|
||
use Mojo::Base -strict; | ||
use Test::More; | ||
use Test::Mojo; | ||
use OpenQA::Test::Case; | ||
|
||
OpenQA::Test::Case->new->init_data; | ||
|
||
use t::ui::PhantomTest; | ||
|
||
my $t = Test::Mojo->new('OpenQA::WebAPI'); | ||
|
||
my $get = $t->get_ok('/tests/99946#previous')->status_is(200); | ||
my $tab_label = $t->tx->res->dom->at('li a[href=#previous]')->all_text; | ||
is($tab_label, q/Previous results (1)/, 'previous results with number is shown'); | ||
my $previous_results_header = $t->tx->res->dom->at('#previous #scenario')->all_text; | ||
is($previous_results_header, q/Results for opensuse-13.1-DVD-i586-textmode, limited to 10/, 'header for previous results with scenario'); | ||
$get->element_exists('#res_99945', 'result from previous job'); | ||
$get->element_exists('#res_99945 .result_passed', 'previous job was passed'); | ||
my $build = $t->tx->res->dom->at('#previous #results .build')->all_text; | ||
is($build, '0091', 'build of previous job is shown'); | ||
$get = $t->get_ok('/tests/99946?limit_previous=1#previous')->status_is(200); | ||
$previous_results_header = $t->tx->res->dom->at('#previous #scenario')->all_text; | ||
is($previous_results_header, q/Results for opensuse-13.1-DVD-i586-textmode, limited to 1/, 'can be limited with query parameter'); | ||
|
||
done_testing(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<div id="scenario"> | ||
Results for <i><%= $scenario %></i>, limited to <%= $limit_previous %> | ||
</div> | ||
<div id="results"> | ||
<table id="results" class="overview table table-striped no-wrap" style="width: 100%"> | ||
<thead> | ||
<tr> | ||
<th class="job">Result</th> | ||
<th>Build</th> | ||
<th>Finished</th> | ||
</tr> | ||
</thead> | ||
% for my $prev (@$previous) { | ||
<tr> | ||
% my $res = $prev->result; | ||
%# partially recreate the 'res' hash as used in 'overview' route | ||
<td id="res_<%= $prev->id %>"> | ||
% my $css = ""; | ||
% next unless ($prev->state eq "done"); | ||
% $css .= " result_" . $res; | ||
<span id="res-<%= $prev->id %>"> | ||
<a href="<%= url_for('test', 'testid' => $prev->id) %>"> | ||
<i class="status fa fa-circle<%= $css %>" title="Done: <%= $res %>"></i> | ||
</a> | ||
</span> | ||
%= include 'test/tr_job_result_failedmodules', jobid => $prev->id, failedmodules => $prev->failed_modules_with_needles() | ||
%= include 'test/tr_job_result_details', jobid => $prev->id, res => $previous_labels->{$prev->id} | ||
</td> | ||
<td class="build"><%= $prev->settings_hash->{BUILD} %></td> | ||
<td class="t_finished"> | ||
<abbr class="timeago" title="<%= $prev->t_finished->datetime() %>Z"><%= format_time($prev->t_finished) %></abbr> | ||
( | ||
<%= format_time_duration($prev->t_finished - $prev->t_started) %> | ||
) | ||
</td> | ||
</tr> | ||
% } | ||
<tbody> | ||
</tbody> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<td id="res_<%= $resultid %>"> | ||
% if ($res) { | ||
% if (is_operator) { | ||
% if ($state eq "done" || $state eq "cancelled") { | ||
%= link_post url_for('apiv1_restart', 'name' => $jobid) => ('data-remote' => 'true', class => 'restart', 'data-jobid' => $jobid) => begin | ||
<i class="action fa fa-repeat" title="Restart the job"></i> | ||
% end | ||
% } elsif ($state eq "running" || $state eq "scheduled") | ||
% { | ||
%= link_post url_for('apiv1_cancel', 'name' => $jobid) => ('data-remote' => 'true', class => 'cancel', 'data-jobid' => $jobid) => begin | ||
<i class="action fa fa-times-circle-o" title="Cancel the job"></i> | ||
% end | ||
% } | ||
% } | ||
|
||
% my $css = ""; | ||
% $css .= " result_".$res->{overall} if ($state eq "done"); | ||
% if ($state eq "done") { | ||
<span id="res-<%= $jobid %>"> | ||
<a href="<%= url_for('test', 'testid' => $jobid) %>"> | ||
<i class="status fa fa-circle<%= $css %>" title="Done: <%= $res->{overall} %>"></i> | ||
</a> | ||
</span> | ||
% } elsif ($state eq "scheduled") | ||
% { | ||
<a href="<%= url_for('test', 'testid' => $jobid) %>"> | ||
<i class="status state_scheduled fa fa-circle" title="scheduled@<%= $res->{priority} %>"></i> | ||
</a> | ||
% } else | ||
% { | ||
<a href="<%= url_for('test', 'testid' => $jobid) %>"> | ||
<i class="status state_<%= $state %> fa fa-circle" title="<%= $state %>"></i> | ||
</a> | ||
% } | ||
% if ($res->{failures}) { | ||
%= include 'test/tr_job_result_failedmodules', jobid => $jobid, failedmodules => $res->{failures} | ||
% } | ||
%= include 'test/tr_job_result_details', jobid => $jobid, res => $res | ||
% } | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
%# 'bentostrap' has an item 'label' which | ||
%# we do not want to use so we use 'test-label' | ||
% my $bug = $res->{bug}; | ||
% if ($bug) { | ||
<span id="bug-<%= $jobid %>"> | ||
<a href="<%= bugurl_for $bug %>"> | ||
<i class="test-label label_bug fa fa-bug" title="Bug(s) referenced: <%= $bug %>"></i> | ||
</a> | ||
</span> | ||
% } | ||
% elsif ($res->{label}) { | ||
% my $label = $res->{label}; | ||
<span id="test-label-<%= $jobid %>"> | ||
<i class="test-label label_<%= $label %> fa fa-bookmark" title="<%= $label %>"></i> | ||
</span> | ||
% } | ||
% elsif ($res->{comments}) { | ||
<span id="comment-<%= $jobid %>"> | ||
<a href="<%= url_for('test', 'testid' => $jobid).'#comments' %>"> | ||
<i class="test-label label_comment fa fa-comment" title="<%= $res->{comments} %> <%= $res->{comments} > 1 ? "comments" : "comment" %> available"></i> | ||
</a> | ||
</span> | ||
% } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
% my $count = 0; | ||
% for my $failedmodule (sort keys %$failedmodules) { | ||
% if (++$count > 2) { | ||
% my $more = (scalar(keys %$failedmodules)) - $count + 1; | ||
% if ($more > 1) { | ||
<%= $more %> more | ||
% last; | ||
% } | ||
% } | ||
% my $failedneedles = $failedmodules->{$failedmodule}; | ||
% my $step = 1; | ||
% my $tooltip = ''; | ||
% if (@$failedneedles) { | ||
% $step = $failedneedles->[0]->[1]; | ||
% if ($failedneedles->[0]->[0]) { | ||
% $tooltip = "title='<p>Failed needles:</p><ul><li>" . join('</li><li>', | ||
% sort map { $_->[0] } @$failedneedles) . "</li></ul>' data-toggle='tooltip'"; | ||
% } | ||
% } | ||
|
||
<span <%= Mojo::ByteStream->new($tooltip) %> class="failedmodule" > | ||
<a href="<%= url_for('step', 'testid' => $jobid, | ||
'moduleid' => $failedmodule, 'stepid' => $step) %>"> | ||
<%= $failedmodule %> | ||
</a> | ||
</span> | ||
% } |