e2e: harden akLogin against Lit stage re-render; settle per hop in crawl/sso
This commit is contained in:
1 parent
912c0edeff
commit
4e1c8a873f
3 files changed
+70
-46
No files matched your search
+17
-3
@@ -18,11 +18,25 @@ export async function akLogin(page: Page, baseUrl: string, user: string, pass: s
|
||||
|
||||
const pwd = page.locator('input[name="password"]');
|
||||
await pwd.waitFor({ state: "visible", timeout: 30_000 });
|
||||
await pwd.fill(pass);
|
||||
await page.locator('button[type="submit"]').first().click();
|
||||
|
||||
// authentik's flow executor (Lit) can re-render the stage right after it
|
||||
// mounts, wiping a programmatic fill; clicking the submit button then
|
||||
// POSTs an empty form ("This field is required"). Fill, VERIFY the value
|
||||
// survived, and submit via Enter (native form path), retrying if the
|
||||
// stage reset under us.
|
||||
for (let attempt = 0; attempt < 3; attempt++) {
|
||||
await pwd.fill(pass);
|
||||
await expect(pwd).toHaveValue(pass, { timeout: 5_000 });
|
||||
await pwd.press("Enter");
|
||||
try {
|
||||
await page.waitForURL(/:\/\/www\.franksdank\.cloud\//, { timeout: 20_000 });
|
||||
break;
|
||||
} catch {
|
||||
if (attempt === 2) throw new Error("password stage never advanced after 3 attempts");
|
||||
}
|
||||
}
|
||||
|
||||
// Back on the homepage with panels rendered.
|
||||
await page.waitForURL(/:\/\/www\.franksdank\.cloud\//, { timeout: 60_000 });
|
||||
await expect(page.locator("#grid .panel").first()).toBeVisible({ timeout: 30_000 });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user