Migrate UI tests to Playwright dotta
This commit is contained in:
@@ -1,9 +1,27 @@
|
||||
using JdeScoping.Ui.Tests.Helpers;
|
||||
using JdeScoping.Ui.Tests.Support;
|
||||
|
||||
namespace JdeScoping.Ui.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// 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).
|
||||
/// </summary>
|
||||
public sealed class SearchQueuePageTests(PlaywrightFixture fixture) : UiTestBase(fixture)
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies the Search Queue page loads at /search/queue and displays queue content or a redirect.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Steps:
|
||||
/// <list type="number">
|
||||
/// <item>Navigate to the Search Queue page.</item>
|
||||
/// <item>Assert the URL ends with /search/queue or /search (redirect).</item>
|
||||
/// <item>If on the queue page, assert "Search Queue" heading and grid/alert/loading indicator are visible.</item>
|
||||
/// <item>If redirected, assert "Search Details" is visible.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
[Trait("Category", "RequiresDockerHost")]
|
||||
public async Task SearchQueue_Loads()
|
||||
@@ -11,23 +29,25 @@ public sealed class SearchQueuePageTests(PlaywrightFixture fixture) : UiTestBase
|
||||
await RunAsync(async page =>
|
||||
{
|
||||
await UiNavigationHelper.NavigateToQueueAsync(page);
|
||||
var url = page.Url;
|
||||
var onQueue = url.EndsWith("/search/queue", StringComparison.OrdinalIgnoreCase);
|
||||
var redirectedToSearch = url.EndsWith("/search", StringComparison.OrdinalIgnoreCase);
|
||||
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() { Timeout = 15_000 });
|
||||
var hasGrid = await page.Locator(".rz-data-grid").First.IsVisibleAsync();
|
||||
var hasAlert = await page.Locator(".rz-alert").First.IsVisibleAsync();
|
||||
var hasLoading = await page.GetByText("Loading queue").IsVisibleAsync();
|
||||
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() { Timeout = 15_000 });
|
||||
await Assertions.Expect(page.GetByText("Search Details"))
|
||||
.ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 15_000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user