mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-26 08:29:41 -05:00
+5








8f2e8add9a
Co-authored-by: Kevin B. <kurami32_kbm@proton.me> Co-authored-by: spatiumstas <79056064+spatiumstas@users.noreply.github.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Andreas Fehn <fehnomenal@fehn.systems> Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Takahiro Shimizu <anatofuz@gmail.com> Co-authored-by: Graham Steffaniak <gtsteffaniak@users.noreply.github.com> Co-authored-by: Joel Town Road <13539685+hippi345@users.noreply.github.com> Co-authored-by: beemines <3083452174@qq.com> Co-authored-by: Bee mines <Beemines82@gmail.com> Co-authored-by: dweebzxx <134675545+dweebzxx@users.noreply.github.com> Co-authored-by: Stephan Paternotte <Stephan-P@users.noreply.github.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { Browser, Page } from "@playwright/test";
|
|
import { expect, firefox } from "@playwright/test";
|
|
import { createShareAndGetHash, openContextMenuHelper } from "./test-setup.ts";
|
|
|
|
// Perform authentication and store auth state
|
|
async function globalSetup() {
|
|
const browser: Browser = await firefox.launch();
|
|
const context = await browser.newContext();
|
|
const page: Page = await context.newPage();
|
|
|
|
// Set basic auth credentials for protected /subpath route
|
|
await page.setExtraHTTPHeaders({
|
|
Authorization: "Basic ZGVtby0xMjcuMC4wLjE6U2VjdXJlUGFzczEyMyE=",
|
|
});
|
|
|
|
await page.goto("http://127.0.0.1/subpath/");
|
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - demo-127.0.0.1");
|
|
|
|
const shareHash = await createShareAndGetHash(page, "Path: /", async () => {
|
|
await openContextMenuHelper(page);
|
|
await page.locator('button[aria-label="Share"]').click();
|
|
});
|
|
await page.evaluate((hash) => {
|
|
localStorage.setItem("shareHash", hash);
|
|
}, shareHash);
|
|
|
|
await context.storageState({ path: "./loginAuth.json" });
|
|
await browser.close();
|
|
}
|
|
|
|
export default globalSetup;
|