Commit bf0ee02a authored by Luis Araujo's avatar Luis Araujo

Show recorded values for jobs from the page to submit results

This commit adds support to show the recorded values from the page to
submit the manual tests results for a specific image type if there is
already a job entry for it in the database.
Signed-off-by: Luis Araujo's avatarLuis Araujo <luis.araujo@collabora.co.uk>
parent 213f7d84
......@@ -50,8 +50,28 @@ def generate_index(username=None):
def generate_select_image(username, form):
return render_template('select_image.html', username=username, form=form)
def generate_submit_report(username, form, image_release, image_version,
def generate_submit_report(username, form, image_release,
image_version, image_deployment,
image_type, manual_testcases_table):
# Search if there is already a saved job for this image type and show the
# values in the submit_report page.
img_type, img_arch, visibility = image_type.split('-')
job_db = Job.query.filter_by(image_release = image_release,
image_build = image_version,
image_deployment = image_deployment,
image_type = img_type,
image_architecture = img_arch,
visibility = visibility,
exec_type = "manual").first()
records = {}
if job_db:
# Build a structure of the form { testcase: (result, notes) .. } and pass
# to the template to render existing values in the submit_report page.
for testcase_record in job_db.testcases:
records.update({ testcase_record.suite: (testcase_record.result,
testcase_record.notes) })
return render_template('submit_report.html',
username=username,
image_release=image_release,
......@@ -60,6 +80,7 @@ def generate_submit_report(username, form, image_release, image_version,
testcases_table=manual_testcases_table,
priority_color_table=priority_color_table,
test_cases_url=config['test-cases-url'],
records=records,
form=form)
def generate_submitted():
......
......@@ -34,16 +34,28 @@
</div>
<div class="col">
<div class="form-group" style="margin-bottom: 0px">
<div class="form-group">
{% if records[test_case] %}
<label class="radio-inline" style="margin-right: 10px;">
<input type="radio" name="{{ test_case }}" value="pass" {% if records[test_case][0] == 'pass' %}checked{% endif %}> PASS
</label>
<label class="radio-inline" style="margin-right: 10px;">
<input type="radio" name="{{ test_case }}" value="fail" {% if records[test_case][0] == 'fail' %}checked{% endif %}> FAIL
</label>
<label class="radio-inline" style="margin-right: 10px;">
<input type="radio" name="{{ test_case }}" value="not_tested" {% if records[test_case][0] == 'not_tested' %}checked{% endif %}> NOT TESTED
</label>
{% else %}
<label class="radio-inline" style="margin-right: 10px;"><input type="radio" name="{{ test_case }}" value="pass"> PASS</label>
<label class="radio-inline" style="margin-right: 10px;"><input type="radio" name="{{ test_case }}" value="fail"> FAIL</label>
<label class="radio-inline" style="margin-right: 10px;"><input type="radio" name="{{ test_case }}" value="not_tested" checked> NOT TESTED</label>
{% endif %}
</div>
</div>
<!-- Text Area -->
<div class="col text-right">
<textarea id="__{{ test_case }}_notes" name="__{{ test_case }}_notes" class="form-control" style="height: 40px; margin-bottom: 10px" placeholder="Notes ..."></textarea>
<textarea id="__{{ test_case }}_notes" name="__{{ test_case }}_notes" class="form-control" style="height: 40px; margin-bottom: 10px" placeholder="Notes ...">{% if records[test_case] %}{{ records[test_case][1] }}{% endif %}</textarea>
</div>
</div>
......
......@@ -161,7 +161,8 @@ def submit_report(image_release, image_version, image_type, image_deployment):
# image type and deployment.
return \
generate_submit_report(session['username'], form,
image_release, image_version, image_type,
image_release, image_version,
image_deployment, image_type,
testcases_table.get((image_deployment, image_type)))
@app.route('/', methods=['POST'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment