mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 04:08:40 +00:00
Add six domain-level web app e2e tests covering team member removal, file upload/delete/restore, share link creation and password protection, and collection creation. Introduce a parametrized 'file' fixture with configurable media types (text/binary/image/video/pdf) for future type-scoped tests, plus helpers for share APIs and team member seeding. Also document all web app e2e test cases in apps/web/e2e/README.md and require this documentation in AGENTS.md.
27 lines
781 B
TypeScript
27 lines
781 B
TypeScript
import type { PrismaClient } from '../../../../packages/db/src/generated/prisma/client'
|
|
import { uniqueEmail } from './auth'
|
|
|
|
export interface SeededMember {
|
|
userId: string
|
|
email: string
|
|
}
|
|
|
|
/**
|
|
* Seeds a new user with a team membership of the given role directly through
|
|
* the database (fast, no UI). The user is not authenticated.
|
|
*/
|
|
export async function seedTeamMember(
|
|
prisma: PrismaClient,
|
|
teamId: string,
|
|
role: 'owner' | 'editor' | 'reviewer',
|
|
): Promise<SeededMember> {
|
|
const email = uniqueEmail(`member-${role}`)
|
|
const user = await prisma.user.create({
|
|
data: { name: email, email, password: 'Password123!' },
|
|
})
|
|
await prisma.teamMember.create({
|
|
data: { teamId, userId: user.id, role, scope: 'team' },
|
|
})
|
|
return { userId: user.id, email }
|
|
}
|