Agent Tests for API, MAUI, and Slop Features
This commit is contained in:
+20
-10
@@ -1,4 +1,3 @@
|
||||
using Microsoft.Playwright;
|
||||
using Tests.Pages;
|
||||
using Tests.Shared;
|
||||
|
||||
@@ -6,16 +5,12 @@ namespace Tests.Helpers;
|
||||
|
||||
public class Website
|
||||
{
|
||||
public IPage Page { get; }
|
||||
public bool RunAgainstProduction { get; }
|
||||
public string BaseUrl { get; }
|
||||
|
||||
public Website(IPage page)
|
||||
{
|
||||
Page = page;
|
||||
RunAgainstProduction = Environment.GetEnvironmentVariable("RUN_AGAINST_PRODUCTION") == "true";
|
||||
|
||||
BaseUrl = RunAgainstProduction ? "https://igpfanreference.ca" : (LocalServer.BaseUrl ?? "http://localhost:5234");
|
||||
BaseUrl = RunAgainstProduction ? "https://igpfanreference.ca" : LocalServer.BaseUrl ?? "http://localhost:5234";
|
||||
|
||||
NavigationBar = new NavigationBar(this);
|
||||
SearchDialog = new SearchDialog(this);
|
||||
@@ -25,8 +20,10 @@ public class Website
|
||||
DatabaseSinglePage = new DatabaseSinglePage(this);
|
||||
}
|
||||
|
||||
public ILocator Locator(string selector) => Page.Locator(selector);
|
||||
public ILocator FindById(string id) => Page.Locator($"#{id}");
|
||||
public IPage Page { get; }
|
||||
public bool RunAgainstProduction { get; }
|
||||
public string BaseUrl { get; }
|
||||
|
||||
public NavigationBar NavigationBar { get; }
|
||||
public SearchDialog SearchDialog { get; }
|
||||
public BuildCalculatorPage BuildCalculatorPage { get; }
|
||||
@@ -34,17 +31,30 @@ public class Website
|
||||
public DatabasePage DatabasePage { get; }
|
||||
public DatabaseSinglePage DatabaseSinglePage { get; }
|
||||
|
||||
public ILocator Locator(string selector)
|
||||
{
|
||||
return Page.Locator(selector);
|
||||
}
|
||||
|
||||
public ILocator FindById(string id)
|
||||
{
|
||||
return Page.Locator($"#{id}");
|
||||
}
|
||||
|
||||
public async Task GotoAsync(string? path = null)
|
||||
{
|
||||
var url = path is null ? BaseUrl : $"{BaseUrl}/{path}";
|
||||
await Page.GotoAsync(url);
|
||||
}
|
||||
|
||||
public async Task ClickElementAsync(ILocator locator) => await locator.ClickAsync();
|
||||
public async Task ClickElementAsync(ILocator locator)
|
||||
{
|
||||
await locator.ClickAsync();
|
||||
}
|
||||
|
||||
public async Task EnterInputAsync(ILocator locator, string value)
|
||||
{
|
||||
await locator.FillAsync(value);
|
||||
await locator.PressAsync("Enter");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user