MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / disableUserAuthentication

Function disableUserAuthentication

e2e/security.spec.js:25–71  ·  view source on GitHub ↗

* Disable user authentication. * * This function is used to revert the system state for subsequent testing * rather than to actively verify functionality. * * Note that we'd ideally want to ensure a clean system state by removing the * TinyPilot database file before each test. However, this wo

(page, browser)

Source from the content-addressed store, hash-verified

23 *
24 */
25async function disableUserAuthentication(page, browser) {
26 await test.step("Disable user authentication", async () => {
27 await page.reload();
28 await expect(page).toHaveURL("/");
29 await expect(page.getByRole("menuitem", { name: "System" })).toBeVisible();
30 await page.getByRole("menuitem", { name: "System" }).hover();
31 await page.getByRole("menuitem", { name: "Security" }).hover();
32 await page.getByRole("menuitem", { name: "Users" }).click();
33
34 const securityDialog = page.locator("#manage-users-dialog");
35 await expect(securityDialog).toBeVisible();
36
37 await locateToggle(page, "#require-authentication").click();
38 await expect(
39 securityDialog.getByRole("heading", {
40 name: "Disable User Authentication",
41 })
42 ).toBeVisible();
43 await securityDialog
44 .getByRole("button", { name: "Delete All Users" })
45 .click();
46
47 // We should be back on main screen of the Manage Users dialog.
48 await expect(
49 securityDialog.getByRole("heading", {
50 name: "Manage Users",
51 })
52 ).toBeVisible();
53 await securityDialog
54 .getByRole("button", { name: "Close", exact: true })
55 .click();
56 await expect(
57 securityDialog.getByRole("heading", {
58 name: "Manage Users",
59 })
60 ).not.toBeVisible();
61 });
62
63 const guestPage = await (await browser.newContext()).newPage();
64 await test.step("Confirm unauthenticated page access", async () => {
65 await guestPage.goto("/");
66 await expect(guestPage).toHaveURL("/");
67 await expect(
68 guestPage.getByRole("menuitem", { name: "System" })
69 ).toBeVisible();
70 });
71}
72
73/*
74 *

Callers 1

security.spec.jsFile · 0.70

Calls 1

locateToggleFunction · 0.70

Tested by

no test coverage detected