Add admin setup test (#1742)

This commit is contained in:
Luke Vella 2025-06-02 10:54:45 +01:00 committed by GitHub
parent 74f4ba23be
commit b19a498ffc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 139 additions and 0 deletions

View file

@ -0,0 +1,28 @@
import type { Page } from "@playwright/test";
import { prisma } from "@rallly/database";
import { LoginPage } from "./login-page";
export async function createUserInDb(
email: string,
name: string,
role: "user" | "admin" = "user",
) {
return prisma.user.create({
data: {
email,
name,
role,
locale: "en",
timeZone: "Europe/London",
emailVerified: new Date(),
},
});
}
export async function loginWithEmail(page: Page, email: string) {
const loginPage = new LoginPage(page);
await loginPage.goto();
await loginPage.login({
email,
});
}