test: cover N15 ambiguous strict exit
This commit is contained in:
@@ -141,3 +141,51 @@ func TestMarkdownReportDoesNotExposeVisibleText(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrictModeClassifiesAmbiguousMatches(t *testing.T) {
|
||||
root := &Node{
|
||||
ControlType: "Window",
|
||||
AutomationID: "frmMain",
|
||||
FrameworkID: "WinForm",
|
||||
Children: []Node{
|
||||
{ControlType: "Pane", AutomationID: "duplicate", FrameworkID: "WinForm"},
|
||||
{ControlType: "Pane", AutomationID: "duplicate", FrameworkID: "WinForm"},
|
||||
},
|
||||
}
|
||||
catalog := []Selector{
|
||||
{
|
||||
ID: "duplicate_panel",
|
||||
Description: "duplicate structural selector",
|
||||
AllowedUse: AllowedUseReadOnlyLocate,
|
||||
Required: Criteria{AutomationID: "duplicate", ControlType: "Pane", FrameworkID: "WinForm"},
|
||||
StabilityScore: 80,
|
||||
Evidence: Evidence{CaptureID: "unit-test", UIAPath: "root/duplicate"},
|
||||
},
|
||||
}
|
||||
|
||||
report := RunCatalogReport("synthetic-ambiguous.json", root, catalog, fixedReportTime())
|
||||
if !report.OK {
|
||||
t.Fatalf("report OK=false: %#v", report.Error)
|
||||
}
|
||||
if report.CatalogSize != 1 {
|
||||
t.Fatalf("catalog_size = %d, want 1", report.CatalogSize)
|
||||
}
|
||||
if report.MatchedCount != 1 {
|
||||
t.Fatalf("matched_count = %d, want 1", report.MatchedCount)
|
||||
}
|
||||
if report.UnmatchedCount != 0 {
|
||||
t.Fatalf("unmatched_count = %d, want 0", report.UnmatchedCount)
|
||||
}
|
||||
if report.AmbiguousCount != 1 {
|
||||
t.Fatalf("ambiguous_count = %d, want 1", report.AmbiguousCount)
|
||||
}
|
||||
if len(report.Selectors) != 1 {
|
||||
t.Fatalf("len(selectors) = %d, want 1", len(report.Selectors))
|
||||
}
|
||||
if got := report.Selectors[0].MatchCount; got != 2 {
|
||||
t.Fatalf("selector match_count = %d, want 2", got)
|
||||
}
|
||||
if got := StrictExitCode(report); got != StrictExitAmbiguous {
|
||||
t.Fatalf("StrictExitCode = %d, want %d", got, StrictExitAmbiguous)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user