查看历史记录-history-viewer
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>测试历史记录</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='history_style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>测试历史记录</h1>
|
||||
<div class="user-info">
|
||||
<a href="{{ url_for('llm_config') }}">LLM 标准配置</a> |
|
||||
<span>欢迎, {{ g.user['username'] }}</span> |
|
||||
<a href="{{ url_for('logout') }}">登出</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<table class="history-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>测试时间</th>
|
||||
<th>状态</th>
|
||||
<th>总计</th>
|
||||
<th>通过</th>
|
||||
<th>失败</th>
|
||||
<th>错误</th>
|
||||
<th>跳过</th>
|
||||
<th>耗时 (秒)</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if history %}
|
||||
{% for run in history %}
|
||||
{% set summary = run.summary %}
|
||||
{% if summary and 'error' not in summary and 'overall_summary' in summary %}
|
||||
{% set overall = summary.overall_summary %}
|
||||
|
||||
{# 根据成功率计算渐变色 (HSL: 0=红, 120=绿) #}
|
||||
{% set success_rate_str = overall.test_case_success_rate | default('0%') %}
|
||||
{% set success_rate = success_rate_str.replace('%', '')|float %}
|
||||
{% set hue = success_rate * 1.2 %}
|
||||
|
||||
{% set status_text = 'PASSED' if overall.test_cases_failed == 0 and overall.test_cases_error == 0 and overall.stages_failed == 0 and overall.stages_error == 0 else 'FAILED' %}
|
||||
|
||||
{# 如果通过,行背景为淡绿色,否则为淡红色 #}
|
||||
<tr class="status-row-{{ 'passed' if status_text == 'PASSED' else 'failed' }}">
|
||||
<td>{{ run.id.replace('_', ' ') }}</td>
|
||||
<td>
|
||||
{# 状态标签使用动态计算的HSL颜色 #}
|
||||
<span class="status-badge" style="background-color: hsl({{ hue }}, 85%, 45%);">
|
||||
{{ "%.1f"|format(success_rate) }}%
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ overall.total_test_cases_executed }}</td>
|
||||
<td>{{ overall.test_cases_passed }}</td>
|
||||
<td>{{ overall.test_cases_failed }}</td>
|
||||
<td>{{ overall.test_cases_error }}</td>
|
||||
<td>{{ overall.test_cases_skipped_in_endpoint }}</td>
|
||||
<td>{{ "%.2f"|format(summary.duration_seconds|float) }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('show_details', run_id=run.id) }}" class="button">查看详情</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{ run.id.replace('_', ' ') }}</td>
|
||||
<td colspan="8" class="error-row">无法加载此运行的摘要信息 (未运行结束或报告格式不正确)。</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="9" style="text-align: center;">没有找到任何测试记录。</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user