2024-08-24 22:02:33 +00:00
|
|
|
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", async ({ authPage, page, context }) => {
|
|
|
|
await authPage.goto();
|
2024-09-16 21:01:16 +00:00
|
|
|
await expect(page).toHaveTitle(/Login - FileBrowser Quantum$/);
|
2024-08-24 22:02:33 +00:00
|
|
|
|
|
|
|
await authPage.loginAs("fake", "fake");
|
|
|
|
await expect(authPage.wrongCredentials).toBeVisible();
|
|
|
|
|
|
|
|
await authPage.loginAs();
|
|
|
|
await expect(authPage.wrongCredentials).toBeHidden();
|
|
|
|
// await page.waitForURL("**/files/", { timeout: 5000 });
|
2024-09-16 21:01:16 +00:00
|
|
|
await expect(page).toHaveTitle(/.*Files - FileBrowser Quantum$/);
|
2024-08-24 22:02:33 +00:00
|
|
|
|
|
|
|
let cookies = await context.cookies();
|
|
|
|
expect(cookies.find((c) => c.name == "auth")?.value).toBeDefined();
|
|
|
|
|
|
|
|
// await authPage.logout();
|
|
|
|
// await page.waitForURL("**/login", { timeout: 5000 });
|
2024-09-16 21:01:16 +00:00
|
|
|
// await expect(page).toHaveTitle(/Login - FileBrowser Quantum$/);
|
2024-08-24 22:02:33 +00:00
|
|
|
// cookies = await context.cookies();
|
|
|
|
// expect(cookies.find((c) => c.name == "auth")?.value).toBeUndefined();
|
|
|
|
});
|