fix(central-ui): FlowStepDetail keeps a still-valid tab across steps; refresh-persistence tests (Task 12 review)

This commit is contained in:
Joseph Doherty
2026-09-09 11:50:28 -04:00
parent 4f33bff3fb
commit 7b3eaea891
2 changed files with 58 additions and 3 deletions
@@ -362,4 +362,58 @@ public class FlowStepDetailTests : BunitContext
Assert.Contains("Tag write was not confirmed", row.QuerySelector(".fsd-line-exc")!.TextContent);
Assert.Contains("System.TimeoutException", row.QuerySelector("details pre")!.TextContent);
}
[Fact]
public void SwitchingSteps_KeepsAStillValidTab()
{
var a = ScriptStep(FlowStepOutcome.Ok, "ProcessRecipeDownload", Guid.NewGuid());
var b = ScriptStep(FlowStepOutcome.Ok, "AckRecipe", Guid.NewGuid());
var cut = Render<FlowStepDetail>(p => p.Add(x => x.Step, a));
cut.Find("[data-test=flow-step-tab-timing]").Click();
Assert.Contains("active", cut.Find("[data-test=flow-step-tab-timing]").ClassName);
cut.Render(p => p.Add(x => x.Step, b));
Assert.Contains("active", cut.Find("[data-test=flow-step-tab-timing]").ClassName);
Assert.DoesNotContain("active", cut.Find("[data-test=flow-step-tab-input]").ClassName);
}
[Fact]
public void RefreshingTheSameStep_KeepsTheTabAndTheLevelFilter()
{
// The page re-reads outcomes after a Live run and hands back a NEW FlowStep instance carrying
// the same EventId plus whatever rows have landed since — that must not disturb the panel.
var eventId = Guid.NewGuid();
var exec = Guid.NewGuid();
FlowStep Refreshed(IReadOnlyList<FlowLogLine> logs)
=> new(eventId, exec, null, FlowStepKind.ScriptRun, FlowLane.Site, "ProcessRecipeDownload",
"sub", T0, 1731, FlowStepOutcome.Failed, "{}", "{}", "Recipe 42 rejected by Galaxy (code 7)",
"site-a", "node-a", "DelmiaSim01", "ProcessRecipeDownload", null, null, null, ExceptionDetail, logs);
var first = Refreshed([Line("info", "Recipe 42 requested", seq: 1), Line("warn", "ResultCode 7", seq: 2)]);
var cut = Render<FlowStepDetail>(p => p.Add(x => x.Step, first));
Assert.Equal("Log (2)", cut.Find("[data-test=flow-step-tab-log]").TextContent.Trim());
cut.Find("[data-test=flow-step-log-filter-warn]").Click();
Assert.Single(cut.FindAll("[data-test=flow-step-log-lines] tr[data-level]"));
cut.Find("[data-test=flow-step-tab-timing]").Click();
cut.Render(p => p.Add(x => x.Step, Refreshed(
[
Line("info", "Recipe 42 requested", seq: 1),
Line("warn", "ResultCode 7", seq: 2),
Line("error", "Rejecting recipe 42", seq: 3),
])));
Assert.Contains("active", cut.Find("[data-test=flow-step-tab-timing]").ClassName);
Assert.Equal("Log (3)", cut.Find("[data-test=flow-step-tab-log]").TextContent.Trim());
cut.Find("[data-test=flow-step-tab-log]").Click();
Assert.Contains("btn-secondary", cut.Find("[data-test=flow-step-log-filter-warn]").ClassName);
var rows = cut.FindAll("[data-test=flow-step-log-lines] tr[data-level]");
Assert.Equal(2, rows.Count);
Assert.Equal("warn", rows[0].GetAttribute("data-level"));
Assert.Equal("error", rows[1].GetAttribute("data-level"));
}
}