using JdeScoping.Ui.Tests.Helpers;
using JdeScoping.Ui.Tests.Support;
namespace JdeScoping.Ui.Tests;
///
/// Playwright UI smoke tests for the Searches Dashboard page.
/// Validates that the dashboard loads at the expected URL and shows a heading or data grid.
/// Requires a running Docker host (Category: RequiresDockerHost).
///
public sealed class SearchesDashboardPageTests(PlaywrightFixture fixture) : UiTestBase(fixture)
{
///
/// Verifies the Searches Dashboard page loads at /searches and displays a heading or data grid.
///
///
/// Steps:
/// 1. Navigate to the Searches Dashboard page.
/// 2. Assert the URL ends with /searches, /search, or /.
/// 3. Assert that "Searches Dashboard", "Search Details", or the Radzen data grid is visible.
///
[Fact]
[Trait("Category", "RequiresDockerHost")]
public async Task SearchesDashboard_Loads()
{
await RunAsync(async page =>
{
await UiNavigationHelper.NavigateToSearchesDashboardAsync(page);
string url = page.Url;
Assert.True(
url.EndsWith("/searches", StringComparison.OrdinalIgnoreCase) ||
url.EndsWith("/search", StringComparison.OrdinalIgnoreCase) ||
url.EndsWith("/", StringComparison.OrdinalIgnoreCase),
$"Unexpected URL: {url}");
bool hasSearchesHeading = await page.GetByText("Searches Dashboard").IsVisibleAsync();
bool hasSearchDetails = await page.GetByText("Search Details").IsVisibleAsync();
bool hasGrid = await page.Locator(".rz-data-grid").First.IsVisibleAsync();
Assert.True(hasSearchesHeading || hasSearchDetails || hasGrid);
});
}
}