More tests and WIP vibe work
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Playwright;
|
||||
using Microsoft.Playwright.NUnit;
|
||||
using Tests.PageObjects;
|
||||
|
||||
namespace Tests;
|
||||
|
||||
@@ -8,45 +9,57 @@ namespace Tests;
|
||||
[TestFixture]
|
||||
public class SyndicateTests : AuthenticatedPageTest
|
||||
{
|
||||
private SyndicatesPage _syndicatesPage;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_syndicatesPage = new SyndicatesPage(Page);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SyndicatesPage_ShouldOpenDialogOnPairingClick()
|
||||
{
|
||||
await Page.GotoAsync(BaseUrl);
|
||||
await Expect(Page).ToHaveTitleAsync(new Regex("Chrono CCG"));
|
||||
await _syndicatesPage.GotoAsync();
|
||||
await _syndicatesPage.WaitForInteractiveAsync();
|
||||
|
||||
// Wait for page load
|
||||
await Page.WaitForSelectorAsync("nav");
|
||||
|
||||
// Take a screenshot of the home page
|
||||
await Page.ScreenshotAsync(new PageScreenshotOptions { Path = "home-page.png" });
|
||||
var count = await _syndicatesPage.PairingCards.CountAsync();
|
||||
Assert.That(count, Is.GreaterThan(0), "No pairing cards found on Syndicates page.");
|
||||
|
||||
// Navigate to syndicates
|
||||
await Page.GotoAsync($"{BaseUrl}/syndicates");
|
||||
|
||||
// Wait for page load and cards to be present
|
||||
try {
|
||||
await Page.WaitForSelectorAsync(".pairing-card", new PageWaitForSelectorOptions { Timeout = 10000 });
|
||||
} catch (Exception) {
|
||||
System.Console.WriteLine("[DEBUG_LOG] .pairing-card not found. This might be due to environment issues.");
|
||||
}
|
||||
// Click the first pairing card
|
||||
await _syndicatesPage.PairingCards.First.ClickAsync();
|
||||
|
||||
var pairingCards = Page.Locator(".pairing-card");
|
||||
var count = await pairingCards.CountAsync();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
// Click the first pairing card
|
||||
await pairingCards.First.ClickAsync();
|
||||
// Verify dialog is visible
|
||||
await Expect(_syndicatesPage.SyndicateDialog).ToBeVisibleAsync();
|
||||
|
||||
// Wait for dialog (CardDialog uses .card-detail)
|
||||
await Page.WaitForSelectorAsync(".card-detail", new PageWaitForSelectorOptions { State = WaitForSelectorState.Visible, Timeout = 5000 });
|
||||
// Take a screenshot of the dialog
|
||||
await Page.ScreenshotAsync(new PageScreenshotOptions { Path = "syndicate-dialog.png" });
|
||||
}
|
||||
|
||||
// Verify dialog is visible
|
||||
var dialog = Page.Locator(".card-detail");
|
||||
await Expect(dialog).ToBeVisibleAsync();
|
||||
[Test]
|
||||
public async Task SyndicatesPage_ShouldShowCorrectSyndicateTitle()
|
||||
{
|
||||
await _syndicatesPage.GotoAsync();
|
||||
await _syndicatesPage.WaitForInteractiveAsync();
|
||||
|
||||
// Take a screenshot of the dialog
|
||||
await Page.ScreenshotAsync(new PageScreenshotOptions { Path = "syndicate-dialog.png" });
|
||||
}
|
||||
var firstCard = _syndicatesPage.PairingCards.First;
|
||||
var syndicateName = await firstCard.Locator(".syn-name").InnerTextAsync();
|
||||
|
||||
await firstCard.ClickAsync();
|
||||
|
||||
await Expect(_syndicatesPage.DialogTitle).ToHaveTextAsync(syndicateName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SyndicatesPage_ShouldCloseDialog()
|
||||
{
|
||||
await _syndicatesPage.GotoAsync();
|
||||
await _syndicatesPage.WaitForInteractiveAsync();
|
||||
|
||||
await _syndicatesPage.PairingCards.First.ClickAsync();
|
||||
await Expect(_syndicatesPage.SyndicateDialog).ToBeVisibleAsync();
|
||||
|
||||
await _syndicatesPage.CloseDialogAsync();
|
||||
await Expect(_syndicatesPage.SyndicateDialog).ToBeHiddenAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user