Converting Tests back to C# but still with Playwright
This commit is contained in:
@@ -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() ?? "";
|
||||
}
|
||||
Reference in New Issue
Block a user