Converting Tests back to C# but still with Playwright

This commit is contained in:
2026-06-03 14:45:18 -04:00
parent 85834466f1
commit 46150d3a69
209 changed files with 1503 additions and 683 deletions
@@ -0,0 +1,31 @@
namespace Tests.Pages.BuildCalculator;
public class EntityClickViewComponent
{
private readonly Website _website;
public EntityClickViewComponent(Website website) => _website = website;
public ILocator EntityClickView => _website.Locator(".entityClickView");
public async Task<string?> GetEntityNameAsync()
{
var el = EntityClickView.Locator("#entityName");
if (await el.CountAsync() == 0) return null;
return (await el.TextContentAsync())?.Trim();
}
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;
if (await healthText.CountAsync() == 0) return null;
var text = (await healthText.TextContentAsync()) ?? "";
var match = System.Text.RegularExpressions.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 ClickPlainViewAsync() =>
await EntityClickView.Locator("button").Filter(new() { HasText = "Plain" }).ClickAsync();
}