mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-23 11:17:26 +02:00
✅ Add admin setup test (#1742)
This commit is contained in:
parent
74f4ba23be
commit
b19a498ffc
5 changed files with 139 additions and 0 deletions
28
apps/web/tests/test-utils.ts
Normal file
28
apps/web/tests/test-utils.ts
Normal 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,
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue