using System.Text.RegularExpressions; using Microsoft.Playwright; using Microsoft.Playwright.NUnit; namespace Tests; [Parallelizable(ParallelScope.Self)] [TestFixture] public class SyndicateTests : AuthenticatedPageTest { [Test] public async Task SyndicatesPage_ShouldOpenDialogOnPairingClick() { await Page.GotoAsync(BaseUrl); await Expect(Page).ToHaveTitleAsync(new Regex("Chrono CCG")); // Wait for page load await Page.WaitForSelectorAsync("nav"); // Take a screenshot of the home page await Page.ScreenshotAsync(new PageScreenshotOptions { Path = "home-page.png" }); // 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."); } var pairingCards = Page.Locator(".pairing-card"); var count = await pairingCards.CountAsync(); if (count > 0) { // Click the first pairing card await pairingCards.First.ClickAsync(); // Wait for dialog (CardDialog uses .card-detail) await Page.WaitForSelectorAsync(".card-detail", new PageWaitForSelectorOptions { State = WaitForSelectorState.Visible, Timeout = 5000 }); // Verify dialog is visible var dialog = Page.Locator(".card-detail"); await Expect(dialog).ToBeVisibleAsync(); // Take a screenshot of the dialog await Page.ScreenshotAsync(new PageScreenshotOptions { Path = "syndicate-dialog.png" }); } } }