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,27 @@
namespace Tests.Pages.BuildCalculator;
public class BankComponent
{
private readonly Website _website;
public BankComponent(Website website) => _website = website;
public ILocator BankContainer => _website.Locator(".bankContainer");
public ILocator DisplayValue(string label) =>
BankContainer.Locator(".displayContainer").Filter(new() { HasText = label }).Locator(".displayContent");
public async Task<string> GetTimeAsync() => (await DisplayValue("Time").TextContentAsync())?.Trim() ?? "";
public async Task<string> GetAlloyAsync() => (await DisplayValue("Alloy").TextContentAsync())?.Trim() ?? "";
public async Task<string> GetEtherAsync() => (await DisplayValue("Ether").TextContentAsync())?.Trim() ?? "";
public async Task<string> GetPyreAsync() => (await DisplayValue("Pyre").TextContentAsync())?.Trim() ?? "";
public async Task<string> GetSupplyAsync() => (await DisplayValue("Supply").TextContentAsync())?.Trim() ?? "";
public async Task<string> GetWorkerCountAsync() =>
(await BankContainer.Locator(".workerText").Locator(".displayContent").Nth(0).TextContentAsync())?.Trim() ?? "";
public async Task<string> GetBusyWorkerCountAsync() =>
(await BankContainer.Locator(".workerText").Locator(".displayContent").Nth(1).TextContentAsync())?.Trim() ?? "";
public async Task<string> GetCreatingWorkerCountAsync() =>
(await BankContainer.Locator(".workerText").Locator(".displayContent").Nth(2).TextContentAsync())?.Trim() ?? "";
}