{#- partials/step_card.html Renders a single step card. Context: step — dict with keys: result (str) PASS | FAIL | WARN | INFO | SKIP step_number (str/int) step_title (str) test_case_id (str) duration (float) dur_bar_width (int) pre-computed bar width 0-60px text (str, optional) description (str, optional) description_is_html (bool) is_json (bool) json_raw (object, optional) screenshot_html (str, optional) attachment_html (str, optional) http_status_code (int, optional) HTTP status code http_method (str, optional) GET/POST/PUT/etc. preview_text (str, optional) short preview (hidden when expanded) phase (str, optional) test phase label step_group (str, optional) step group label api_data (dict, optional) structured API data for tab rendering total_steps — int, total number of steps in this test case #} {%- set result_upper = step.result | upper -%} {%- set badge = badge_map(result_upper) -%} {%- set border_cls = border_map(result_upper) -%} {%- set step_id = step.test_case_id | default('unknown') ~ '-s' ~ step.step_number | default('unknown') -%} {%- set collapse_id = 'collapse-' ~ step.test_case_id | default('unknown') ~ '-' ~ step.step_number | default('unknown') -%} {%- set extra_cls = '' -%} {%- if result_upper == 'SKIP' %}{% set extra_cls = ' skip-hl' %}{% endif -%} {%- if result_upper == 'FAIL' and step.is_critical | default(false) %}{% set extra_cls = extra_cls ~ ' fail-hl' %}{% endif -%}
{# #15 Step number: N/total #} {{ step.step_number | default('?') }}/{{ total_steps | default('?') }} {{ result_upper }} {%- if step.step_type and step.step_type not in ('info', 'default', 'compare', 'api', 'setup', 'execution', 'teardown', 'group_start') %} {{ step.step_type }} {%- endif %} {# #21 Root cause badge for FAIL steps #} {%- if result_upper == 'FAIL' %} {{ render_root_cause_badge(step.http_status_code, step.text) }} {%- endif %} {{ step.step_title | default('No Title') }}
{#- #16 HTTP status code badge #} {%- if step.http_status_code %} {{ step.http_status_code }} {%- endif %} {#- #17 HTTP method badge #} {%- if step.http_method %} {{ step.http_method }} {%- endif %} {{ '%.2f' | format(step.duration | default(0)) }}s {# #18 Duration mini bar — uses pre-computed dur_bar_width #} {%- set dur = step.duration | default(0) | float -%} {%- set bar_w = step.dur_bar_width | default(0) -%} {%- set bar_color = 'var(--fail)' if dur >= 3 else ('var(--warn)' if dur >= 1 else 'var(--pass)') -%}
{# #22 Preview text — between .sh and .sbody, hidden when step expanded (CSS-controlled via :has) #} {%- if step.preview_text %}
{{ step.preview_text }}
{%- endif %}
{%- if step.text %}

Text: {{ step.text }}

{%- endif %} {# #26 API data tabs — rendered when step has structured api_data dict #} {%- if step.api_data %} {%- set ad = step.api_data -%} {%- set uid = step.test_case_id | default('x') ~ step.step_number | default('0') -%} {#- kv summary row: Endpoint / Method / Status / Duration / Start / End -#} {%- if ad.url is defined and ad.url %}
Endpoint
{{ ad.url }}
{%- if ad.method is defined and ad.method %}
Method
{{ ad.method }}
{%- endif %} {%- if ad.http_status_code is defined and ad.http_status_code %} {%- set sc = ad.http_status_code | int(0) -%}
Status
{{ ad.http_status_code }}
{%- endif %} {%- if ad.duration is defined and ad.duration %}
Duration
{{ ad.duration }}
{%- endif %} {%- if ad.start_time is defined and ad.start_time %}
Start
{{ ad.start_time }}
{%- endif %} {%- if ad.end_time is defined and ad.end_time %}
End
{{ ad.end_time }}
{%- endif %}
{%- endif %}
{%- if ad.response_json is defined and ad.response_json %} {%- endif %} {%- if ad.curl_command is defined and ad.curl_command %} {%- endif %}
{{- ad.req_body_json | format_json_viewer("Request Body") }}
{%- if ad.response_json is defined and ad.response_json %}
{{- ad.response_json | format_json_viewer("Response") }}
{%- endif %}
{{- ad.req_headers_json | format_json_viewer("Request Headers") }}
{%- if ad.curl_command is defined and ad.curl_command %}
{{ ad.curl_command | e }}
{%- endif %} {%- elif step.description %} {%- if step.description_is_html %} {{ step.description | safe }} {%- elif step.is_json and step.json_raw is not none %}
{{ step.json_raw | format_json_viewer("Description (JSON)") }}
{%- else %}

Description:

{%- endif %} {%- endif %} {%- if step.screenshot_html %} {{ step.screenshot_html | safe }} {%- endif %} {%- if step.attachment_html %} {{ step.attachment_html | safe }} {%- endif %}
Duration: {{ '%.2f' | format(step.duration | default(0)) }}s