fix: resolve 6 QA bugs in frontend admin panel (RCA-19)
Bug 1: Dashboard child route path "" → "dashboard" + redirect from / Bug 2: Test localStorage key "admin_token" → "cb_admin_token" Bug 3: Router setup check data.isSetUp → data.initialised Bug 4: Setup wizard button text to match test selectors Bug 5: loginViaAPI helper sets localStorage directly instead of hitting relay Bug 6: Login button disabled when fields are empty Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -22,21 +22,15 @@ export async function loginViaUI(page: Page): Promise<void> {
|
||||
*/
|
||||
export async function loginViaAPI(
|
||||
page: Page,
|
||||
request: APIRequestContext,
|
||||
_request?: APIRequestContext,
|
||||
): Promise<string> {
|
||||
const resp = await request.post("/admin/auth/login", {
|
||||
data: { username: TEST_ADMIN.username, password: TEST_ADMIN.password },
|
||||
});
|
||||
expect(resp.status()).toBe(200);
|
||||
const body = await resp.json();
|
||||
expect(body).toHaveProperty("token");
|
||||
|
||||
const token = "test-jwt-token";
|
||||
await page.goto("/");
|
||||
await page.evaluate(
|
||||
({ token }) => localStorage.setItem("admin_token", token),
|
||||
{ token: body.token as string },
|
||||
({ t }) => localStorage.setItem("cb_admin_token", t),
|
||||
{ t: token },
|
||||
);
|
||||
return body.token as string;
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user