test: add E2E server-detail tests and fill coverage gaps to 83.9%

- Add Playwright E2E for all 5 UX phases (Config/Missions/Mods/Players/Logs)
  with ServerDetailPage POM and fully mocked API routes
- Add logger.test.ts: dynamic module re-import pattern for level-gating tests
- Add useUpdateServer + useKillServer tests to useServers.test.tsx
- Add CreateServerPage edge cases: non-admin gate, API error handling, step 2 render
- Add auth.store rehydration and null-branch coverage tests
- Update FRONTEND.md, MODULES.md, API.md, README.md to reflect current state
  (167 unit tests, 38 E2E tests, 9 useServers hooks, all UX phases implemented)
This commit is contained in:
Tran G. (Revernomad) Khoa
2026-04-18 10:24:03 +07:00
parent 8bac29fb68
commit b7d670a91c
10 changed files with 606 additions and 11 deletions

View File

@@ -0,0 +1,31 @@
import { Page, Locator } from "@playwright/test";
export class ServerDetailPage {
readonly page: Page;
readonly content: Locator;
readonly loading: Locator;
readonly errorMessage: Locator;
readonly tabBar: Locator;
constructor(page: Page) {
this.page = page;
this.content = page.locator('[data-testid="server-detail-page"]');
this.loading = page.locator('[data-testid="server-detail-loading"]');
this.errorMessage = page.locator('[data-testid="server-detail-error"]');
// Tab bar: div wrapping the tab buttons (no ARIA role, plain flex div)
this.tabBar = page.locator('[data-testid="server-detail-page"] .flex.gap-1');
}
async goto(serverId: number) {
await this.page.goto(`/servers/${serverId}`);
await this.page.waitForLoadState("networkidle");
}
async clickTab(name: string) {
await this.tabBar.locator(`button:has-text("${name}")`).click();
}
getTab(name: string): Locator {
return this.tabBar.locator(`button:has-text("${name}")`);
}
}