v0.71.0: fix admin e2e — pass sessionId into page.evaluate
CI / build + unit + e2e (pull_request) Successful in 15m37s
CI / build + unit + e2e (pull_request) Successful in 15m37s
This commit is contained in:
+3
-1
@@ -34,7 +34,9 @@ test('admin panel: login form, wrong-creds error, session auth, DB grid CRUD, lo
|
|||||||
|
|
||||||
// --- Authenticate via the test hook + localStorage, then reopen the panel.
|
// --- Authenticate via the test hook + localStorage, then reopen the panel.
|
||||||
const sessionId = await mintAdminSession(page);
|
const sessionId = await mintAdminSession(page);
|
||||||
await page.evaluate((key) => window.localStorage.setItem(key, sessionId), SESSION_KEY);
|
// Both values must be passed as arguments — the function runs in the browser, where Node-side
|
||||||
|
// variables are not in scope.
|
||||||
|
await page.evaluate(([key, sid]) => window.localStorage.setItem(key, sid), [SESSION_KEY, sessionId]);
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect(adminBtn).toBeVisible({ timeout: 30_000 });
|
await expect(adminBtn).toBeVisible({ timeout: 30_000 });
|
||||||
await adminBtn.click();
|
await adminBtn.click();
|
||||||
|
|||||||
Reference in New Issue
Block a user