Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
better comments
  • Loading branch information
aslilac committed Dec 19, 2024
commit bc1108e0058cfedb2b0ac522c53e6e48e9c6916b
6 changes: 3 additions & 3 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ type LoginOptions = {

export async function login(page: Page, options: LoginOptions = users.admin) {
const ctx = page.context();
// biome-ignore lint/suspicious/noExplicitAny: shenanigans to make life easier
// biome-ignore lint/suspicious/noExplicitAny: reset the current user
(ctx as any)[Symbol.for("currentUser")] = undefined;
await ctx.clearCookies();
await page.goto("/login");
await page.getByLabel("Email").fill(options.email);
await page.getByLabel("Password").fill(options.password);
await page.getByRole("button", { name: "Sign In" }).click();
await expectUrl(page).toHavePathName("/workspaces");
// biome-ignore lint/suspicious/noExplicitAny: shenanigans to make life easier
// biome-ignore lint/suspicious/noExplicitAny: update once logged in
(ctx as any)[Symbol.for("currentUser")] = options;
}

export function currentUser(page: Page): LoginOptions {
const ctx = page.context();
// biome-ignore lint/suspicious/noExplicitAny: shenanigans to make life easier
// biome-ignore lint/suspicious/noExplicitAny: get the current user
const user = (ctx as any)[Symbol.for("currentUser")];

if (!user) {
Expand Down
Loading