Agent Tests for API, MAUI, and Slop Features

This commit is contained in:
2026-06-03 19:08:35 -04:00
parent 46150d3a69
commit 0feac0f0a0
142 changed files with 4156 additions and 1462 deletions
@@ -3,7 +3,11 @@ namespace Tests.Pages.BuildCalculator;
public class HotkeyViewerComponent
{
private readonly Website _website;
public HotkeyViewerComponent(Website website) => _website = website;
public HotkeyViewerComponent(Website website)
{
_website = website;
}
public ILocator KeyContainer => _website.Locator(".keyContainer");
@@ -12,12 +16,13 @@ public class HotkeyViewerComponent
var upper = keyLabel.ToUpperInvariant();
var buttons = KeyContainer.Locator("> div > div");
var count = await buttons.CountAsync();
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
var btn = buttons.Nth(i);
var text = (await btn.TextContentAsync())?.Trim().ToUpperInvariant() ?? "";
if (text.StartsWith(upper)) return btn;
}
return null;
}
@@ -25,7 +30,7 @@ public class HotkeyViewerComponent
{
var btn = await FindKeyButtonAsync(keyText);
if (btn is null) throw new InvalidOperationException($"Key \"{keyText}\" not found");
await btn.ClickAsync(new() { Force = true });
await btn.ClickAsync(new LocatorClickOptions { Force = true });
}
public async Task<string?> GetFirstEntityNameAsync(string keyText)
@@ -44,11 +49,12 @@ public class HotkeyViewerComponent
var entities = btn.Locator("> div");
var count = await entities.CountAsync();
var names = new List<string>();
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
var text = (await entities.Nth(i).TextContentAsync())?.Trim();
if (!string.IsNullOrEmpty(text)) names.Add(text);
}
return names;
}
}
}