-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test results: Add tab with "previous results" in same scenario
Querying the database for former test runs of the same scenario is a rather costly operation which we do not want to do for multiple test results at once but only for each individual test result (1:1 relation). Related issue: https://progress.opensuse.org/issues/10212
- Loading branch information
Showing
4 changed files
with
117 additions
and
2 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,42 @@ | ||
# 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'); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div id="scenario"> | ||
Results for <i><%= $scenario %></i>, limited to <%= $limit_previous %> | ||
</div> | ||
<div id="results"> | ||
<table id="results" class="display 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 $job (@$previous) { | ||
<tr> | ||
% my $res = $job->result; | ||
<td id="res_<%= $job->id %>"> | ||
% my $css = ""; | ||
% next unless ($job->state eq "done"); | ||
% $css .= " result_" . $res; | ||
<span id="res-<%= $job->id %>"> | ||
<a href="<%= url_for('test', 'testid' => $job->id) %>"> | ||
<i class="status fa fa-circle<%= $css %>" title="Done: <%= $res %>"></i> | ||
</a> | ||
</span> | ||
</td> | ||
<td class="build"><%= $job->settings_hash->{BUILD} %></td> | ||
<td class="t_finished"> | ||
%# <%= $job->t_finished %> | ||
<abbr class="timeago" title="<%= $job->t_finished->datetime() %>Z"><%= format_time($job->t_finished) %></abbr> | ||
( | ||
<%= format_time_duration($job->t_finished - $job->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