Adding vibe tests
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using Microsoft.Playwright;
|
||||
|
||||
namespace Tests.PageObjects;
|
||||
|
||||
public class AgentsPage : BasePage
|
||||
{
|
||||
public AgentsPage(IPage page) : base(page) { }
|
||||
|
||||
public async Task GotoAsync() => await NavigateToAsync("/agents");
|
||||
|
||||
public ILocator Grid => Page.Locator(".agents-grid");
|
||||
|
||||
public async Task WaitForGridAsync()
|
||||
{
|
||||
await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
await Grid.WaitForAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Microsoft.Playwright;
|
||||
|
||||
namespace Tests.PageObjects;
|
||||
|
||||
public abstract class BasePage
|
||||
{
|
||||
protected readonly IPage Page;
|
||||
protected readonly string BaseUrl = "http://localhost:5256";
|
||||
|
||||
protected BasePage(IPage page)
|
||||
{
|
||||
Page = page;
|
||||
}
|
||||
|
||||
public async Task NavigateToAsync(string path)
|
||||
{
|
||||
await Page.GotoAsync($"{BaseUrl}{path}");
|
||||
}
|
||||
|
||||
public ILocator GetHeading() => Page.Locator("h1");
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Microsoft.Playwright;
|
||||
|
||||
namespace Tests.PageObjects;
|
||||
|
||||
public class DeckDetailPage : BasePage
|
||||
{
|
||||
public DeckDetailPage(IPage page) : base(page) { }
|
||||
|
||||
public ILocator ManaCurve => Page.Locator(".mana-curve");
|
||||
public ILocator ManaBars => Page.Locator(".mana-bar");
|
||||
public ILocator ManaBarLabels => Page.Locator(".mana-bar-label");
|
||||
public ILocator ManaCosts => Page.Locator(".mana-cost");
|
||||
|
||||
public async Task<int> GetManaBarCountAsync() => await ManaBars.CountAsync();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.Playwright;
|
||||
|
||||
namespace Tests.PageObjects;
|
||||
|
||||
public class DecksPage : BasePage
|
||||
{
|
||||
public DecksPage(IPage page) : base(page) { }
|
||||
|
||||
public async Task GotoAsync() => await NavigateToAsync("/decks");
|
||||
|
||||
public ILocator GetDeckCards() => Page.Locator(".deck-card");
|
||||
|
||||
public async Task ClickDeckByNameAsync(string name)
|
||||
{
|
||||
await Page.Locator(".deck-card-title").GetByText(name, new() { Exact = true }).ClickAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user