mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
integration-test: Create authentication setup
This commit is contained in:
parent
6a459427fb
commit
a98f01d924
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@ images/app-icons/mac/*.png
|
||||
/playwright-report/
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
/playwright/.auth/
|
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 });
|
||||
});
|
@ -7,14 +7,6 @@ test("Can insert equations", async ({ page }) => {
|
||||
await page.setDefaultTimeout(60_000);
|
||||
await page.setDefaultNavigationTimeout(60_000);
|
||||
|
||||
await page.goto(ROOT_URL);
|
||||
await expect(page).toHaveURL(`${ROOT_URL}/login`);
|
||||
|
||||
// Log in
|
||||
await page.getByRole("textbox", { name: "Password" }).fill(LOGIN_PASSWORD);
|
||||
await page.getByRole("button", { name: "Login"}).click();
|
||||
await page.waitForURL(/\/#root\//);
|
||||
|
||||
// Create a new note
|
||||
// await page.locator("button.button-widget.bx-file-blank")
|
||||
// .click();
|
5
integration-tests/update_check.spec.ts
Normal file
5
integration-tests/update_check.spec.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test("Displays update badge when there is a version available", async ({ page }) => {
|
||||
await page.goto("http://localhost:8080");
|
||||
});
|
@ -34,13 +34,17 @@ export default defineConfig({
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
name: "setup",
|
||||
testMatch: /.*\.setup\.ts/
|
||||
},
|
||||
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
name: "firefox",
|
||||
use: {
|
||||
...devices[ "Desktop Firefox" ],
|
||||
storageState: "playwright/.auth/user.json"
|
||||
},
|
||||
dependencies: [ "setup" ]
|
||||
},
|
||||
|
||||
/* Test against mobile viewports. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user