mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
integration-test: Create authentication setup
This commit is contained in:
17
integration-tests/auth.setup.ts
Normal file
17
integration-tests/auth.setup.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { test as setup, expect } from '@playwright/test';
|
||||
|
||||
const authFile = 'playwright/.auth/user.json';
|
||||
|
||||
const ROOT_URL = "http://localhost:8080";
|
||||
const LOGIN_PASSWORD = "eliandoran";
|
||||
|
||||
// Reference: https://playwright.dev/docs/auth#basic-shared-account-in-all-tests
|
||||
|
||||
setup("authenticate", async ({ page }) => {
|
||||
await page.goto(ROOT_URL);
|
||||
await expect(page).toHaveURL(`${ROOT_URL}/login`);
|
||||
|
||||
await page.getByRole("textbox", { name: "Password" }).fill(LOGIN_PASSWORD);
|
||||
await page.getByRole("button", { name: "Login"}).click();
|
||||
await page.context().storageState({ path: authFile });
|
||||
});
|
||||
Reference in New Issue
Block a user