Skip to content

Commit

Permalink
Render test case text, bugs and hyperlinks
Browse files Browse the repository at this point in the history
as expandable content for each execution in TestRun page
  • Loading branch information
asankov committed May 29, 2020
1 parent 37e4730 commit 3c3e4fe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
13 changes: 11 additions & 2 deletions tcms/testruns/static/testruns/js/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,24 @@ function renderAdditionalInformation(testExecutions, testExecutionCaseIds) {
const listGroupItem = $(`.test-execution-${testExecution.id}`)
listGroupItem.find('.test-execution-priority').html(testCase.priority)
listGroupItem.find('.test-execution-category').html(testCase.category)
listGroupItem.find('.test-execution-text').html(testCase.text)
listGroupItem.find('.test-execution-notes').append(testCase.notes)

const isAutomatedElement = listGroupItem.find('.test-execution-automated')
const isAutomatedIcon = testCase.is_automated ? 'fa-cog' : 'fa-thumbs-up'
const isAutomatedAttr = testCase.is_automated ? isAutomatedElement.data('automated') : isAutomatedElement.data('manual')
isAutomatedElement.addClass(isAutomatedIcon)
isAutomatedElement.attr('title', isAutomatedAttr)

jsonRPC('TestExecution.get_links', { 'execution_id': testExecution.id, 'is_defect': true }, bugs => {
listGroupItem.find('.test-execution-bugs-count').html(bugs.length)
jsonRPC('TestExecution.get_links', { 'execution_id': testExecution.id }, links => {
const bugCount = links.filter(link => link.is_defect).length;
listGroupItem.find('.test-execution-bugs-count').html(bugCount)

const ul = listGroupItem.find('.test-execution-hyperlinks')
links.forEach(link => {
const icon = link.is_defect ? `<span class="fa fa-bug"></span>` : ''
ul.append(`<li>${icon} <a href="${link.url}">${link.name || link.url}</a></li>`)
})
})
})
})
Expand Down
18 changes: 16 additions & 2 deletions tcms/testruns/templates/testruns/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ <h2 class="card-pf-title">
</div>
<div title="{% trans 'Bugs' %}" class="list-view-pf-additional-info-item">
<span class="fa fa-bug"></span>
{% comment %} TODO fetch bugs {% endcomment %}
<span class="test-execution-bugs-count"></span>
</div>
</div>
Expand All @@ -171,7 +170,22 @@ <h2 class="card-pf-title">
</div>
</div>
<div class="list-group-item-container container-fluid hidden">
{% comment %} TODO: exandable content goes here {% endcomment %}
<div class="row">
<div class="col-md-9">
<div class="test-execution-text-container markdown-text">
<p class="test-execution-text"></p>
<p class="test-execution-notes">
<strong>{% trans 'Notes' %}:</strong>
</p>
<strong>{% trans "Bugs and hyperlinks" %}:</strong>
<div>
<ul class="test-execution-hyperlinks">

</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
Expand Down

0 comments on commit 3c3e4fe

Please sign in to comment.