51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using Microsoft.Playwright;
|
|
|
|
namespace Tests.PageObjects;
|
|
|
|
public class SyndicatesPage : BasePage
|
|
{
|
|
public SyndicatesPage(IPage page) : base(page)
|
|
{
|
|
}
|
|
|
|
public ILocator PairingCards => Page.Locator(".pairing-card");
|
|
public ILocator SyndicateDialog => Page.Locator(".card-detail");
|
|
public ILocator DialogCloseButton => SyndicateDialog.Locator(".detail-close");
|
|
public ILocator DialogTitle => SyndicateDialog.Locator(".detail-header h2");
|
|
|
|
public async Task GotoAsync()
|
|
{
|
|
await NavigateToAsync("/syndicates");
|
|
}
|
|
|
|
public async Task WaitForInteractiveAsync()
|
|
{
|
|
await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
|
|
try
|
|
{
|
|
await Page.WaitForSelectorAsync(".pairing-card", new PageWaitForSelectorOptions { Timeout = 15_000 });
|
|
}
|
|
catch (Exception)
|
|
{
|
|
var content = await Page.ContentAsync();
|
|
var title = await Page.TitleAsync();
|
|
var url = Page.Url;
|
|
Console.WriteLine($"[DEBUG_LOG] FAILED to find .pairing-card. URL: {url}, Title: {title}");
|
|
Console.WriteLine("[DEBUG_LOG] Page Content snippet: " +
|
|
(content.Length > 2000 ? content.Substring(0, 2000) : content));
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task OpenSyndicateAsync(string name)
|
|
{
|
|
await PairingCards.Filter(new LocatorFilterOptions { HasText = name }).ClickAsync();
|
|
}
|
|
|
|
public async Task CloseDialogAsync()
|
|
{
|
|
await DialogCloseButton.ClickAsync();
|
|
await Page.WaitForSelectorAsync(".card-detail",
|
|
new PageWaitForSelectorOptions { State = WaitForSelectorState.Hidden });
|
|
}
|
|
} |