test(adminui): #1097 page-level assertion that the mapping Local-parent Raw picker offers no Tag nodes (+ export-root positive control)

This commit is contained in:
Joseph Doherty
2026-12-04 17:20:29 -05:00
parent 50a2acb2be
commit b617fb9678
@@ -194,6 +194,42 @@ public sealed class DataConnectionRootPickerTests : BunitContext
cut.WaitForAssertion(() => cut.Find("#mapping-parent").GetAttribute("value").ShouldBe("RawDevice " + RawTreeTestDb.FolderedDeviceId));
}
private const string HistTagRadio = "input[title='Tag tag:" + RawTreeTestDb.HistorizedTagId + "']";
private static void ExpandToGroup(IRenderedComponent<CascadingValue<Task<AuthenticationState>>> c, bool expandGroup = true)
{
c.WaitForAssertion(() => c.FindAll("[role=dialog] input[type=radio]").Count.ShouldBeGreaterThan(0));
c.Find("button[aria-label='Expand PLCs']").Click();
c.WaitForElement("button[aria-label='Expand modbus-1']").Click();
c.WaitForElement("button[aria-label='Expand Device1']").Click();
if (expandGroup) c.WaitForElement("button[aria-label='Expand Motors']").Click();
}
/// <summary>#1097 positive control: the export-root Raw picker offers Tag leaves.</summary>
[Fact]
public void ExportRoot_RawTreePicker_OffersTagNodes()
{
var cut = RenderPage();
cut.WaitForElement("button:contains('New export')").Click();
cut.WaitForElement("#export-root-browse").Click();
ExpandToGroup(cut);
cut.WaitForElement(HistTagRadio);
}
/// <summary>#1097: the mapping's Local-parent Raw picker never offers Tag leaves.</summary>
[Fact]
public void LocalParent_RawTreePicker_OffersNoTagNodes()
{
var cut = RenderPage();
cut.WaitForElement("button:contains('New mapping')").Click();
cut.WaitForElement("#mapping-parent-browse").Click();
ExpandToGroup(cut, expandGroup: false); // the group has only tag children, so with tags excluded it is a leaf
cut.WaitForElement("input[title='TagGroup grp:" + RawTreeTestDb.RootGroupId + "']");
cut.FindAll("button[aria-label='Expand Motors']").Count.ShouldBe(0);
cut.FindAll(HistTagRadio).Count.ShouldBe(0);
cut.FindAll("[role=dialog] input[title^='Tag tag:']").Count.ShouldBe(0);
}
[Fact]
public void ChangingTheExportRealm_ClearsTheStaleRoot()
{