LANCommander/LANCommander.Server.UI.Tests/Components/UserManagementComponentTests.cs
Pat Hartl 004a254c37 Migrate flaky Playwright admin UI tests to bUnit
Replace the SignalR-circuit-race-prone Playwright component tests for
GameEdit, Settings, metadata, profile, roles and users with in-process
bUnit component tests. Keep a thin Playwright smoke layer for the true
E2E paths (login, admin navigation/routing, first-time setup, game
import) that bUnit cannot cover.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 20:45:21 -05:00

29 lines
946 B
C#

using Bunit;
using UsersIndex = LANCommander.Server.UI.Pages.Settings.Users.Index;
namespace LANCommander.Server.UI.Tests.Components;
/// <summary>
/// bUnit component tests for the user management page. Replaces the Playwright
/// <c>SettingsTests.SettingsUsers_ShowsUserList</c> assertion that the seeded
/// admin user appears in the data table.
/// </summary>
[Collection("BUnit")]
public class UserManagementComponentTests : BUnitTestContext
{
public UserManagementComponentTests(BUnitServerFixture fixture) : base(fixture)
{
}
[Fact]
public void Users_ShowsSeededAdminUser()
{
var cut = RenderComponent<UsersIndex>();
// The DataTable loads rows asynchronously after first render; poll until the seeded
// admin user appears.
cut.WaitForAssertion(
() => Assert.Contains(TestConstants.AdminUserName, cut.Markup),
timeout: TimeSpan.FromSeconds(10));
}
}