Agent Tests for API, MAUI, and Slop Features
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Tests.Pages.BuildCalculator;
|
||||
|
||||
public class EntityClickViewComponent
|
||||
{
|
||||
private readonly Website _website;
|
||||
public EntityClickViewComponent(Website website) => _website = website;
|
||||
|
||||
public EntityClickViewComponent(Website website)
|
||||
{
|
||||
_website = website;
|
||||
}
|
||||
|
||||
public ILocator EntityClickView => _website.Locator(".entityClickView");
|
||||
|
||||
@@ -16,16 +22,21 @@ public class EntityClickViewComponent
|
||||
|
||||
public async Task<string?> GetEntityHealthAsync()
|
||||
{
|
||||
var healthText = EntityClickView.Locator("div").Filter(new() { HasTextRegex = new System.Text.RegularExpressions.Regex("Health", System.Text.RegularExpressions.RegexOptions.IgnoreCase) }).First;
|
||||
var healthText = EntityClickView.Locator("div").Filter(new LocatorFilterOptions
|
||||
{ HasTextRegex = new Regex("Health", RegexOptions.IgnoreCase) }).First;
|
||||
if (await healthText.CountAsync() == 0) return null;
|
||||
var text = (await healthText.TextContentAsync()) ?? "";
|
||||
var match = System.Text.RegularExpressions.Regex.Match(text, @"(\d+)");
|
||||
var text = await healthText.TextContentAsync() ?? "";
|
||||
var match = Regex.Match(text, @"(\d+)");
|
||||
return match.Success ? match.Groups[1].Value : null;
|
||||
}
|
||||
|
||||
public async Task ClickDetailedViewAsync() =>
|
||||
await EntityClickView.Locator("button").Filter(new() { HasText = "Detailed" }).ClickAsync();
|
||||
public async Task ClickDetailedViewAsync()
|
||||
{
|
||||
await EntityClickView.Locator("button").Filter(new LocatorFilterOptions { HasText = "Detailed" }).ClickAsync();
|
||||
}
|
||||
|
||||
public async Task ClickPlainViewAsync() =>
|
||||
await EntityClickView.Locator("button").Filter(new() { HasText = "Plain" }).ClickAsync();
|
||||
}
|
||||
public async Task ClickPlainViewAsync()
|
||||
{
|
||||
await EntityClickView.Locator("button").Filter(new LocatorFilterOptions { HasText = "Plain" }).ClickAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user