test(alerts): the widget test reads the time as |ago writes it (#5510)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 1m10s
CI / unit (push) Successful in 1m27s
CI / publish (push) Successful in 1m26s

Under an hour |ago says "12m 3s ago", so the test looks for the minutes
alone; the reading cell drops an empty class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 16:31:57 -04:00
co-authored by Claude Opus 5.5
parent 57e1960dc1
commit 715ddfd72f
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
<span class="w-sub">{{ rule.resource_name }} · fires on {{ r.condition }}</span>
{%- endif %}
</td>
<td class="{{ 'tone-crit' if r.label == 'firing' else ('tone-warn' if r.label == 'pending') }}">
<td{% if r.label in ("firing", "pending") %} class="{{ 'tone-crit' if r.label == 'firing' else 'tone-warn' }}"{% endif %}>
{%- if r.label == "no_data" %}—{% else %}{{ metric_value(rule.metric_name, r.value) }}{% endif -%}
</td>
<td>{% if r.since %}{{ r.since|ago }}{% else %}—{% endif %}</td>
+2 -2
View File
@@ -65,9 +65,9 @@ async def test_firing_and_silent_come_first_then_who_acknowledged(app):
assert re.search(r'w-verdict tone-crit">\s*1 firing, 1 silent, 1 acknowledged\.', page)
assert page.index("web-1 CPU high") < page.index("nas agent") < page.index("db disk")
assert 'href="/alerts/history?rule=r1"' in page
assert "web-1 · fires on CPU &gt; 90%" in page and "94%" in page and "12m ago" in page
assert "web-1 · fires on CPU &gt; 90%" in page and ">94%<" in page and ">12m " in page
assert "nas · no reading" in page
assert "db-1:/var · acknowledged by bryan" in page and "40m ago" in page
assert "db-1:/var · acknowledged by bryan <time" in page and ">40m " in page
assert "+1 rule quiet" in page and 'href="/alerts/"' in page
assert len(re.findall(r"<th[ >]", page)) == 3
assert not hex_colours(page), hex_colours(page)