Adding vibe tests

This commit is contained in:
2026-06-25 10:52:11 -04:00
parent 00e7184b3b
commit f8b0974b79
7 changed files with 219 additions and 8 deletions
+18
View File
@@ -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();
}
}
+21
View File
@@ -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();
}
+17
View File
@@ -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();
}
}