Migrate UI tests to Playwright dotta
This commit is contained in:
@@ -3,8 +3,25 @@ using JdeScoping.Ui.Tests.Support;
|
||||
|
||||
namespace JdeScoping.Ui.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Playwright UI smoke tests for the Cache Refresh Status page.
|
||||
/// Validates that the page loads and shows the "Cache Refresh Status" heading or redirects to search.
|
||||
/// Requires a running Docker host (Category: RequiresDockerHost).
|
||||
/// </summary>
|
||||
public sealed class RefreshStatusPageTests(PlaywrightFixture fixture) : UiTestBase(fixture)
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies the Refresh Status page loads at /refresh-status and displays the expected heading.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Steps:
|
||||
/// <list type="number">
|
||||
/// <item>Navigate to the Refresh Status page.</item>
|
||||
/// <item>Assert the URL ends with /refresh-status or /search (redirect).</item>
|
||||
/// <item>If on the refresh page, assert "Cache Refresh Status" heading is visible.</item>
|
||||
/// <item>If redirected, assert "Search Details" is visible.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
[Trait("Category", "RequiresDockerHost")]
|
||||
public async Task RefreshStatus_Loads()
|
||||
@@ -12,19 +29,17 @@ public sealed class RefreshStatusPageTests(PlaywrightFixture fixture) : UiTestBa
|
||||
await RunAsync(async page =>
|
||||
{
|
||||
await UiNavigationHelper.NavigateToRefreshStatusAsync(page);
|
||||
var url = page.Url;
|
||||
var onRefreshStatus = url.EndsWith("/refresh-status", StringComparison.OrdinalIgnoreCase);
|
||||
var redirectedToSearch = url.EndsWith("/search", StringComparison.OrdinalIgnoreCase);
|
||||
string url = page.Url;
|
||||
bool onRefreshStatus = url.EndsWith("/refresh-status", StringComparison.OrdinalIgnoreCase);
|
||||
bool redirectedToSearch = url.EndsWith("/search", StringComparison.OrdinalIgnoreCase);
|
||||
Assert.True(onRefreshStatus || redirectedToSearch, $"Unexpected URL: {url}");
|
||||
|
||||
if (onRefreshStatus)
|
||||
{
|
||||
await Assertions.Expect(page.GetByText("Cache Refresh Status")).ToBeVisibleAsync(new() { Timeout = 15_000 });
|
||||
}
|
||||
await Assertions.Expect(page.GetByText("Cache Refresh Status"))
|
||||
.ToBeVisibleAsync(new LocatorAssertionsToBeVisibleOptions { Timeout = 15_000 });
|
||||
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