diff --git a/e2e/admin.spec.ts b/e2e/admin.spec.ts index afe3c76..aff0f44 100644 --- a/e2e/admin.spec.ts +++ b/e2e/admin.spec.ts @@ -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. 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 expect(adminBtn).toBeVisible({ timeout: 30_000 }); await adminBtn.click();