mirror of
https://github.com/bolucat/Archive.git
synced 2025-11-02 12:44:34 +08:00
Update On Mon Apr 1 20:27:02 CEST 2024
This commit is contained in:
32
filebrowser/frontend/tests/auth.spec.ts
Normal file
32
filebrowser/frontend/tests/auth.spec.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { test, expect } from "./fixtures/auth";
|
||||
|
||||
test("redirect to login", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page).toHaveURL(/\/login/);
|
||||
|
||||
await page.goto("/files/");
|
||||
await expect(page).toHaveURL(/\/login\?redirect=\/files\//);
|
||||
});
|
||||
|
||||
test("login and logout", async ({ authPage, page, context }) => {
|
||||
await authPage.goto();
|
||||
await expect(page).toHaveTitle(/Login - File Browser$/);
|
||||
|
||||
await authPage.loginAs("fake", "fake");
|
||||
await expect(authPage.wrongCredentials).toBeVisible();
|
||||
|
||||
await authPage.loginAs();
|
||||
await expect(authPage.wrongCredentials).toBeHidden();
|
||||
// await page.waitForURL("**/files/", { timeout: 5000 });
|
||||
await expect(page).toHaveTitle(/.*Files - File Browser$/);
|
||||
|
||||
let cookies = await context.cookies();
|
||||
expect(cookies.find((c) => c.name == "auth")?.value).toBeDefined();
|
||||
|
||||
await authPage.logout();
|
||||
// await page.waitForURL("**/login", { timeout: 5000 });
|
||||
await expect(page).toHaveTitle(/Login - File Browser$/);
|
||||
|
||||
cookies = await context.cookies();
|
||||
expect(cookies.find((c) => c.name == "auth")?.value).toBeUndefined();
|
||||
});
|
||||
Reference in New Issue
Block a user