test(playwright): alarm-override trigger-config scenarios — HiLo merge, non-HiLo replace, validation, cancel, clear (T41)

This commit is contained in:
Joseph Doherty
2026-06-18 19:35:14 -04:00
parent 2e4ca5a35f
commit b7f7fe935c
5 changed files with 312 additions and 9 deletions
@@ -104,10 +104,18 @@ public static partial class CliRunner
/// Adds an alarm to a template via <c>template alarm add</c> (using the typed setpoint
/// flags) and returns its new <c>id</c>. Throws on failure.
/// </summary>
/// <remarks>
/// The HiLo setpoint flags (<paramref name="hi"/>/<paramref name="hiHi"/>/<paramref name="lo"/>/
/// <paramref name="loLo"/>) and the ValueMatch <paramref name="matchValue"/> are additive,
/// per-trigger-type selectors over the same <c>template alarm add</c> command — only the flags
/// relevant to <paramref name="triggerType"/> are emitted, the rest are skipped when null. This
/// lets one helper provision both the fixture's HiLo alarm and a ValueMatch alarm
/// (<c>--match-value</c>) without a parallel helper.
/// </remarks>
public static async Task<int> AddAlarmAsync(
int templateId, string name, string triggerType = "HiLo", int priority = 500,
string? attribute = null, double? hi = null, double? hiHi = null,
double? lo = null, double? loLo = null)
double? lo = null, double? loLo = null, string? matchValue = null)
{
var inv = System.Globalization.CultureInfo.InvariantCulture;
var args = new List<string>
@@ -123,6 +131,7 @@ public static partial class CliRunner
if (hiHi.HasValue) { args.Add("--hihi"); args.Add(hiHi.Value.ToString(inv)); }
if (lo.HasValue) { args.Add("--lo"); args.Add(lo.Value.ToString(inv)); }
if (loLo.HasValue) { args.Add("--lolo"); args.Add(loLo.Value.ToString(inv)); }
if (matchValue is not null) { args.Add("--match-value"); args.Add(matchValue); }
using var doc = await RunJsonAsync([.. args]);
return RequireId(doc, "template alarm add");