49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using Microsoft.Playwright;
|
|
|
|
namespace Tests.PageObjects;
|
|
|
|
public class AgentsPage : BasePage
|
|
{
|
|
public AgentsPage(IPage page) : base(page)
|
|
{
|
|
}
|
|
|
|
public ILocator Grid => Page.Locator(".agents-grid");
|
|
public ILocator AgentCards => Page.Locator(".agent-card");
|
|
public ILocator SearchInput => Page.Locator(".search-input");
|
|
|
|
public async Task GotoAsync()
|
|
{
|
|
await NavigateToAsync("/agents");
|
|
}
|
|
|
|
public async Task WaitForInteractiveAsync()
|
|
{
|
|
await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
|
|
try
|
|
{
|
|
// Wait for the grid container with a much longer timeout for Telerik initialization
|
|
await Page.WaitForSelectorAsync(".agents-page",
|
|
new PageWaitForSelectorOptions { Timeout = 30_000, State = WaitForSelectorState.Visible });
|
|
// Wait for the actual Telerik Grid to be rendered and populated
|
|
await Page.WaitForSelectorAsync(".k-grid",
|
|
new PageWaitForSelectorOptions { Timeout = 30_000, State = WaitForSelectorState.Visible });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
var content = await Page.ContentAsync();
|
|
var title = await Page.TitleAsync();
|
|
var url = Page.Url;
|
|
Console.WriteLine($"[DEBUG_LOG] FAILED to find Agents Grid. Error: {ex.Message}");
|
|
Console.WriteLine($"[DEBUG_LOG] URL: {url}, Title: {title}");
|
|
Console.WriteLine("[DEBUG_LOG] Page Content length: " + content.Length);
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task SearchAsync(string query)
|
|
{
|
|
await SearchInput.FillAsync(query);
|
|
await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
|
}
|
|
} |