test(alerts): check the history's Action column on one rule's rows, which the test owns (#5316)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 53s
CI / unit (push) Successful in 1m19s
CI / publish (push) Successful in 1m19s

The all-rules page reads a Postgres shared with other tests, whose
Ansible-run events turn the column on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 23:06:33 -04:00
co-authored by Claude Opus 5.5
parent 531a193bd1
commit e37cd0a873
+4 -1
View File
@@ -73,13 +73,16 @@ def test_a_viewer_reads_the_alert_history(app):
assert '98% <span class="tone-dim">(fires above 90%)</span>' in page
assert "email failed" in page and f"mx-{tag}: timed out" in page and "webhook sent" in page
assert f"muted · patch-{tag}" in page and "No CPU reading" in page and "2 changes of state" in page
assert "<th>Rule</th>" in page and "<th>Notified</th>" in page and "<th>Action</th>" not in page
assert "<th>Rule</th>" in page and "<th>Notified</th>" in page
resp = await client.get(f"/alerts/history?range=24h&rule={hot_id}", headers={"HX-Request": "true"})
rows = await resp.get_data(as_text=True)
assert "<html" not in rows and "<table" in rows
assert f"old-{tag}" in rows and f"cold-note-{tag}" not in rows
assert "<th>Rule</th>" not in rows # one rule: no column for it
# Columns only for what this rule's rows hold: it told someone, it ran
# nothing. (The all-rules page shares Postgres with other tests' runs.)
assert "<th>Notified</th>" in rows and "<th>Action</th>" not in rows
assert "Fired 1 time</strong> in the last 24h" in rows # its verdict
# The next page as the reader scrolls: only older rows, without the table