docs: finalise Arma 3 UX enhancement plan and update project docs

- .claude/plan/arma3-ux-enhancement.md: full plan review pass
  - Add Progress Tracker table for session handoff
  - Fix Phase 1 field names to match ServerConfig model (password_admin,
    battleye, disable_von)
  - Fix Phase 2 rotation endpoints to use ServerService(db) inline pattern
  - Fix Phase 4 router/service: add get_by_slot() to PlayerRepository,
    add get_rcon_client() to ThreadRegistry, fix BanRepository.create()
    signature (expires_at not duration_minutes), correct router pattern
  - Fix Phase 6: already implemented, mark as SKIP
  - Fix CSS class names: btn-secondary→btn-ghost, input-base→neu-input
  - Add 19 implementation decisions from Q&A session to Coding Conventions
- CLAUDE.md: update status table, type mapping table, add plan summary
  and new endpoint list, add key implementation gotchas section
- frontend/README.md: replace Vite boilerplate with project README
- frontend/tests-e2e: E2E test improvements from previous session
  (mock-based login error test, full dashboard mock coverage)
This commit is contained in:
Tran G. (Revernomad) Khoa
2026-04-17 15:45:34 +07:00
parent 34cc1fd008
commit a688bdfdf9
5 changed files with 477 additions and 265 deletions

View File

@@ -29,11 +29,18 @@ test.describe("Login Flow", () => {
});
test("should show error on invalid credentials", async ({ page }) => {
// Mock the backend to return 401 for invalid login
await page.route("**/api/auth/login", (route) =>
route.fulfill({
status: 401,
contentType: "application/json",
body: JSON.stringify({
detail: "Invalid credentials",
}),
}),
);
await loginPage.login("invalid", "credentials");
await page.waitForResponse(
(resp) => resp.url().includes("/api/auth/login"),
{ timeout: 10_000 },
).catch(() => {});
await expect(loginPage.errorMessage).toBeVisible({ timeout: 10_000 });
});
@@ -52,7 +59,16 @@ test.describe("Login Flow", () => {
}),
);
await page.route("**/api/servers*", (route) =>
// Mock auth/me and servers so the dashboard loads
await page.route("**/api/auth/me", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({ success: true, data: { id: 1, username: "admin", role: "admin" }, error: null }),
}),
);
await page.route("**/api/servers**", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
@@ -66,8 +82,14 @@ test.describe("Login Flow", () => {
});
test("should show loading state while submitting", async ({ page }) => {
await page.route("**/api/auth/login", (route) =>
route.fulfill({
let resolveLogin: (value: unknown) => void;
const loginPromise = new Promise((resolve) => {
resolveLogin = resolve;
});
await page.route("**/api/auth/login", async (route) => {
await loginPromise;
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
@@ -77,19 +99,19 @@ test.describe("Login Flow", () => {
user: { id: 1, username: "admin", role: "admin" },
},
}),
delay: 500,
}),
);
});
});
await page.route("**/api/servers*", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({ success: true, data: [] }),
}),
);
await loginPage.usernameInput.fill("admin");
await loginPage.passwordInput.fill("password");
await loginPage.login("admin", "password");
await expect(loginPage.submitButton).toContainText("Signing in...");
// Click submit and immediately check for loading state
await loginPage.submitButton.click();
// The button should show "Signing in..." while the request is pending
await expect(loginPage.submitButton).toContainText("Signing in...", { timeout: 5_000 });
// Resolve the login to let the test finish
resolveLogin!("done");
});
});