39 lines
1.7 KiB
C#
39 lines
1.7 KiB
C#
namespace Tests.Pages.BuildCalculator;
|
|
|
|
public class OptionsComponent
|
|
{
|
|
private readonly Website _website;
|
|
public OptionsComponent(Website website) => _website = website;
|
|
|
|
private ILocator FormNumberInput(string label) =>
|
|
_website.Locator(".formNumberContainer").Filter(new() { HasText = label }).Locator("input[type='number']");
|
|
|
|
private ILocator ButtonWithLabel(string label) =>
|
|
_website.Locator("button").Filter(new() { HasText = label });
|
|
|
|
public ILocator BuildingInputDelayInput => FormNumberInput("Building Input Delay");
|
|
public ILocator WaitTimeInput => FormNumberInput("Wait Time");
|
|
public ILocator WaitToInput => FormNumberInput("Wait To");
|
|
public ILocator AddWaitButton => ButtonWithLabel("Add Wait").First;
|
|
public ILocator AddWaitToButton => ButtonWithLabel("Add Wait").Last;
|
|
|
|
public async Task SetBuildingInputDelayAsync(int value)
|
|
{
|
|
await BuildingInputDelayInput.FillAsync(value.ToString());
|
|
await BuildingInputDelayInput.PressAsync("Enter");
|
|
}
|
|
|
|
public async Task SetWaitTimeAsync(int value) =>
|
|
await WaitTimeInput.FillAsync(value.ToString());
|
|
|
|
public async Task SetWaitToAsync(int value) =>
|
|
await WaitToInput.FillAsync(value.ToString());
|
|
|
|
public async Task ClickAddWaitAsync() => await AddWaitButton.ClickAsync();
|
|
public async Task ClickAddWaitToAsync() => await AddWaitToButton.ClickAsync();
|
|
|
|
public async Task<string> GetBuildingInputDelayAsync() => await BuildingInputDelayInput.InputValueAsync();
|
|
public async Task<string> GetWaitTimeAsync() => await WaitTimeInput.InputValueAsync();
|
|
public async Task<string> GetWaitToAsync() => await WaitToInput.InputValueAsync();
|
|
}
|