aboutsummaryrefslogtreecommitdiff
path: root/dashboard_app/templates/dashboard_app/test_result_detail.html
blob: 69091912e415cd00743cc35ff7b1b98d5449d147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
{% extends "layouts/content-bootstrap.html" %}
{% load i18n %}
{% load humanize %}

{% block styles %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}dashboard_app/css/bootstrap-editable.css"/>
{% endblock %}

{% block content %}
<h2 class="modal-header">Test Result: {{ test_result.test_case|default:"<i>unknown test case</i>" }}</h2>
<p>Each test result is part of a test run and multiple test runs can be part of the same test job.
In the <i>"You are here"</i> breadcrumb list above, click the Run link to go up to the test run detail page to see
full details of the test job which generated this test result.</p>
<p>If the test result output was captured as an attachment of the test run, the attachment name and line number will be
shown as links. The same output can also be viewed in the attachments of the test run itself.</p>

<div class="row">
  <div class="col-md-4">
    <h4 class="modal-header">Metadata</h4>
    <dl class="horizontal">
      <dt>ID</dt>
      <dd>
        <small><span style="white-space:nowrap">{{ test_result.test_run.analyzer_assigned_uuid }}/{{ test_result.relative_index }}</span> (<a href="{{ test_result.get_permalink }}">{% trans "permalink" %}</a>)</small>
      </dd>
      <dt>Test Case</dt>
      <dd>
    {% if test_result.test_case %}
      <b>{{ test_result.test_case }}</b>
    {% else %}
      <i>{% trans "unknown test case" %}</i>
    {% endif %}
      {% trans "from test" %} <b><a href="{{ test_result.test_run.test.get_absolute_url }}">{{ test_result.test_run.test }}</a></b></dd>
    </dl>
  </div>

  <div class="col-md-4">
    <h4 class="modal-header">Run Attributes</h4>
  {% with test_result.test_run.attributes.values as attrs %}
    <dl class="dl-horizontal">
    {% for item in attrs|dictsort:"name" %}
      <dt>{{ item.name }}</dt>
      <dd>{{ item.value }}</dd>
    {% empty %}
      <i>none</i>
    {% endfor %}
    </dl>
  {% endwith %}
  </div>

  <div class="col-md-4">
    <h4 class="modal-header">Result Attributes <button class="btn btn-xs btn-success" id="attribute_insert"><span class="glyphicon glyphicon-plus"></span></button></h4>

    {% with test_result.attributes.values as attrs %}
    <dl class="dl-horizontal" id="attributes_container">
    {% for item in attrs|dictsort:"is_manual" %}
    <dt><div class="editable pull-right" data-pk="{{item.id}}" data-name="name">{{ item.name }}</div></dt>
    <dd><div class="editable pull-left" data-pk="{{item.id}}" data-name="value">{{ item.value }}</div>
    <div class="text-right"><button class="btn btn-xs btn-danger attribute-remove" data-pk="{{item.id}}">
      <span class="glyphicon glyphicon-remove"></span>
    </button></div></dd>
    {% empty %}
      <i>none</i>
    {% endfor %}
    </dl>
  {% endwith %}
  </div>
</div>

<div class="row">
  <div class="col-md-6">
    <h3 class="modal-header">Test result details</h3>
    <dl class="dl-horizontal">
      <dt>{% trans "Outcome" %}</dt>
      <dd>
        <img src="{{ STATIC_URL }}dashboard_app/images/icon-{{ test_result.result_code }}.png"
             alt="{{ test_result.result_code }}" width="16" height="16" border="0"/>
        {{ test_result.result_code }}
      </dd>
      <dt>{% trans "Measurement" %}</dt>
      <dd>
      {% if test_result.measurement != None and test_result.measurement != "" %}
      {{ test_result.measurement }} <span id="units">{{ test_result.test_case.units }}</span> <button class="btn btn-xs btn-info" data-toggle="modal" data-target="#unitsModal"><span class="glyphicon glyphicon-pencil"></span></button>
      <div class="modal fade" id="unitsModal" tabindex="-1" role="dialog" aria-labelledby="unitsModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title" id="unitsModalLabel">Update units</h4>
            </div>
            <div class="modal-body">
              <input id="units_edit" cols="40" rows="10" value="{{ test_result.test_case.units|default_if_none:'' }}" >
              <a class="btn btn-info btn-xs" href="{{ STATIC_URL }}docs/writing-tests.html#overwriting-units" target="_blank">?</a>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
              <button type="button" class="btn btn-primary" id="saveUnitsBtn">Save changes</button>
            </div>
          </div>
        </div>
      </div>

      {% else %}
        <i>{% trans "no measurement taken" %}</i>
      {% endif %}
      </dd>
      <dt>{% trans "output file/location" %}</dt>
      <dd>
        {% if test_result.filename %}
            {% if test_result.related_attachment_available and test_result.related_attachment.is_viewable %}
            {% with test_result.related_attachment as attachment %}
            <a href="{{ attachment.get_view_url }}">{{ test_result.filename }}</a> line <a href="{{ attachment.get_view_url }}#L{{test_result.lineno}}">{{ test_result.lineno }}</a>
            {% endwith %}
            {% else %}
                {{ test_result.filename }} line {{ test_result.lineno }}
            {% endif %}
        {% else %}
            <i>{% trans "no output captured for this test result" %}</i>
        {% endif %}
      </dd>
      <dt>{% trans "Message from the log file" %}</dt>
      <dd>
      {% if test_result.message %}
        <pre>{{ test_result.message }}</pre>
      {% else %}
        <i>{% trans "no message was captured for this test result" %}</i>
      {% endif %}
      </dd>
      <dt>{% trans "Test started on" %}</dt>
      <dd>
      {% if test_result.timestamp %}
        {{ test_result.timestamp|naturalday }}
        {{ test_result.timestamp|time }}
      {% else %}
        <i>{% trans "test result did not output a start time" %}</i>
      {% endif %}
      </dd>
      <dt>{% trans "Test duration" %}</dt>
      <dd>
      {% if test_result.duration %}
        {# TODO need a filter for displaying this sensibly. Currently there are some rounding errors #}
        {{ test_result.duration }}
      {% else %}
        <i>{% trans "test result did not output a duration" %}</i>
      {% endif %}
      </dd>
    </dl>
  </div>

  <div class="col-md-6">
    <h3 id="comments" class="modal-header">Comments <button class="btn btn-xs btn-info" data-toggle="modal" data-target="#commentModal"><span class="glyphicon glyphicon-pencil"></span></button></h3>
    <div class="modal fade" id="commentModal" tabindex="-1" role="dialog" aria-labelledby="commentModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="commentModalLabel">Update comments</h4>
          </div>
          <div class="modal-body">
            <textarea id="comments_text" cols="40" rows="10">{{ test_result.comments|default_if_none:"" }}</textarea>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
            <button type="button" class="btn btn-primary" id="saveCommentBtn">Save changes</button>
          </div>
        </div>
      </div>
    </div>
    <div id="comments_container">
    {% if test_result.comments or test_result.comments != "" %}
      {{ test_result.comments|linebreaksbr }}
    {% else %}
      <i>{% trans "no comments" %}</i>
    {% endif %}
    </div>
  </div>
</div>

<div class="row">
  <div class="col-md-6">
    <h4 class="modal-header" id="attachments">Attachments</h4>
    {% include "dashboard_app/_attachments.html" with attachments=test_result.attachments %}
  </div>
  <div class="col-md-6">
    {% if test_result.test_run.get_results.count > 1 %}
    <h4 class="modal-header">Other results from the same test run</h4>
    <div class="btn-group dropup">
      <button type="button" class="btn btn-default">{{ test_result.test_case }}</button>
      <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
      </button>
      <ul class="dropdown-menu">
      {% regroup test_result.test_run.get_results by test_case as test_result_group_list %}
      {% for test_result_group in test_result_group_list %}
        {% for other_test_result in test_result_group.list %}
        <li{% if other_test_result.pk == test_result.pk %} class="disabled"{% endif %}><a href="{{ other_test_result.get_absolute_url }}">
          Result #{{ other_test_result.relative_index }}: {{ other_test_result.get_result_display }}
          {% if test_result_group.list|length == 1 %} for {{ test_result_group.grouper }}{% endif %}
          {% if other_test_result.measurement != None %} ({{ other_test_result.measurement }}){% endif %}
        </a></li>
        {% endfor %}
      {% endfor %}
      </ul>
    </div>
    {% endif %}
  </div>
</div>
{% endblock %}

{% block scripts %}
<script src="{{ STATIC_URL }}dashboard_app/js/bootstrap-editable.min.js"></script>
<script src="{{ STATIC_URL }}dashboard_app/js/test_result_detail.js"></script>
<script src="{{ STATIC_URL }}dashboard_app/js/editable_attributes.js"></script>

<script>
  csrf_token = '{{csrf_token}}';
  remove_attribute_url = '+remove-result-attribute';
  update_attribute_url = '+update-result-attribute';
  test_case_name = '{{ test_result.test_case }}';
</script>
{% endblock %}