using JdeScoping.Ui.Tests.Helpers; using JdeScoping.Ui.Tests.Support; namespace JdeScoping.Ui.Tests; /// /// Playwright UI smoke tests for the Search Queue page. /// Validates that the queue page loads and shows a data grid, alert, or loading indicator. /// Requires a running Docker host (Category: RequiresDockerHost). /// public sealed class SearchQueuePageTests(PlaywrightFixture fixture) : UiTestBase(fixture) { /// /// Verifies the Search Queue page loads at /search/queue and displays queue content or a redirect. /// /// /// Steps: /// 1. Navigate to the Search Queue page. /// 2. Assert the URL ends with /search/queue or /search (redirect). /// 3. If on the queue page, assert "Search Queue" heading and grid/alert/loading indicator are visible. /// 4. If redirected, assert "Search Details" is visible. /// [Fact] [Trait("Category", "RequiresDockerHost")] public async Task SearchQueue_Loads() { await RunAsync(async page => { await UiNavigationHelper.NavigateToQueueAsync(page); string url = page.Url; bool onQueue = url.EndsWith("/search/queue", StringComparison.OrdinalIgnoreCase); bool redirectedToSearch = url.EndsWith("/search", StringComparison.OrdinalIgnoreCase); Assert.True(onQueue || redirectedToSearch, $"Unexpected URL: {url}"); if (onQueue) { await Assertions.Expect(page.GetByText("Search Queue")) .ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 15_000 }); bool hasGrid = await page.Locator(".rz-data-grid").First.IsVisibleAsync(); bool hasAlert = await page.Locator(".rz-alert").First.IsVisibleAsync(); bool hasLoading = await page.GetByText("Loading queue").IsVisibleAsync(); Assert.True(hasGrid || hasAlert || hasLoading, "Expected queue grid, alert, or loading indicator."); } else { await Assertions.Expect(page.GetByText("Search Details")) .ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 15_000 }); } }); } }