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:
31
frontend/tests-e2e/pages/ServerDetailPage.ts
Normal file
31
frontend/tests-e2e/pages/ServerDetailPage.ts
Normal 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}")`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user