Commit graph

7 commits

Author SHA1 Message Date
Pat Hartl
12d63c02a2 Stabilize Playwright smoke layer for CI
The remaining Playwright failures were all in interactions that depend on
the Blazor Server circuit being responsive in CI:

- Settings page access now navigates to /Settings/General directly instead
  of expanding the flaky nested Settings SubMenu flyout.
- Drop SettingsMenu_ShowsAllExpectedSubItems; the submenu-expansion is the
  unreliable interaction the bUnit migration exists to replace, and the
  Settings pages are now covered by bUnit component tests.
- Remove the GameImport UI tests (and unused GamesPage/OpenRCT2.lcx). The
  ChunkUploader modal never renders under the in-process test host, so they
  failed in every CI run; the Games list render is already covered by
  AdminNavigationTests.GamesPage_ShowsEmptyTable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 23:14:42 -05:00
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
Pat Hartl
6a2b5177b0 Use SQLite instead of EF InMemory for UI tests
The DataTable component issues relational queries (AsSplitQuery, Include,
and a translated punctuation-stripping search expression) that the EF
InMemory provider cannot translate. On CI this surfaced as a native stack
overflow in CountAsync that crashed the in-process server and cascaded
into widespread timeouts. A file-based SQLite database supports these
queries and concurrent connections, stabilizing the test run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-24 00:39:44 -05:00
Pat Hartl
f2a864b540 Update UI tests for post-merge changes from main
- Target net10.0 to match the now-net10 server project (and fix the
  Playwright browser-install path in the PR workflow accordingly).
- Dismiss the persistent "Import Ready" notification (added with main's
  background UploadTracker) before clicking Import; its Duration=0 toast
  overlays and intercepts the modal's Import button.
- Update General settings assertions: "Database Provider" moved to the new
  dedicated /Settings/Database page, so assert on "Use SSL" instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-23 22:11:05 -05:00
Aaron Powell
0bac5e7b8b Move test .lcx file into repo under TestData
Copy OpenRCT2.lcx into TestData/ and reference via AppContext.BaseDirectory
so tests don't depend on a user-specific Downloads path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-08 08:25:45 +11:00
Aaron Powell
5e3d740b83 Refactor UI tests to use WebApplicationFactory instead of dotnet run
Replace process-based server management (ServerManager) with ASP.NET Core's
WebApplicationFactory<Program> for proper integration testing:

- Add UITestApplicationFactory with dual-host pattern (real Kestrel + dummy TestServer)
  to work around .NET 9's hard-cast to TestServer in WebApplicationFactory
- Use in-memory EF Core database with dynamic port binding (IPAddress.Loopback:0)
- Stub IVersionProvider and IGitHubService to avoid external dependencies
- Programmatically create admin user in ConfiguredServerFixture via service layer
- Remove ServerManager.cs (no longer needed)
- Skip CompleteWizardAndLogin test (requires real DB file I/O)
- 18 tests pass, 1 skipped, ~28s runtime (down from ~101s)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-08 08:25:44 +11:00
Aaron Powell
94cfd6fe18 Spike: Playwright UI automated tests for server application
Add LANCommander.Server.UI.Tests project with 19 Playwright-based UI tests
covering three key scenarios:

- First-time setup flow (4 tests): Fresh server redirect, setup wizard steps,
  database provider selection, and complete wizard-to-login flow
- Login flow (5 tests): Unauthenticated redirect, page elements, valid/invalid
  credentials, and empty credential handling
- Admin navigation (10 tests): Dashboard, sidebar menu, Games, Redistributables,
  Tools, Servers, Issues, Files, Settings pages, and Settings submenu items

Infrastructure includes:
- ServerManager: Manages server process lifecycle with data directory backup/restore
- PlaywrightFixture: Browser lifecycle management (headless Chromium)
- ConfiguredServerFixture: Shared xUnit class fixture for tests needing a
  configured server (avoids restarting server per test)
- Page objects: LoginPage, FirstTimeSetupPage, AdminDashboardPage

Key technical decisions:
- Uses IClassFixture<T> pattern to share server instances across test classes
- Disables parallel execution (tests share port 1337)
- Uses element-based waits instead of URL-based waits for Blazor SSR reliability
- Uses role-based selectors for AntDesign components (no standard label/for)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-08 08:25:44 +11:00