Playwright re-established. 54 test cases generated.

This commit is contained in:
AG
2025-11-30 14:35:47 +02:00
parent 683f80dfea
commit eef65251d7
63 changed files with 5752 additions and 157 deletions

Binary file not shown.

64
server/test_user.js Normal file
View File

@@ -0,0 +1,64 @@
import { PrismaClient } from '@prisma/client';
import bcrypt from 'bcryptjs';
async function createTestUsers() {
const prisma = new PrismaClient();
// Create a regular user
const user1Email = 'user1@gymflow.ai';
const user1Password = 'user1pass';
const hashedUser1Password = await bcrypt.hash(user1Password, 10);
await prisma.user.upsert({
where: { email: user1Email },
update: { password: hashedUser1Password },
create: {
email: user1Email,
password: hashedUser1Password,
role: 'USER',
profile: { create: { weight: 70 } },
},
});
// Create another regular user
const user2Email = 'user2@gymflow.ai';
const user2Password = 'user2pass';
const hashedUser2Password = await bcrypt.hash(user2Password, 10);
await prisma.user.upsert({
where: { email: user2Email },
update: { password: hashedUser2Password },
create: {
email: user2Email,
password: hashedUser2Password,
role: 'USER',
profile: { create: { weight: 75 } },
},
});
// Create a user that will be blocked
const blockedUserEmail = 'blocked@gymflow.ai';
const blockedUserPassword = 'blockedpass';
const hashedBlockedUserPassword = await bcrypt.hash(blockedUserPassword, 10);
await prisma.user.upsert({
where: { email: blockedUserEmail },
update: { password: hashedBlockedUserPassword, isBlocked: true },
create: {
email: blockedUserEmail,
password: hashedBlockedUserPassword,
role: 'USER',
isBlocked: true,
profile: { create: { weight: 80 } },
},
});
console.log('Test users created or updated successfully.');
await prisma.$disconnect();
}
createTestUsers()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
// This script is meant to be run once to seed data, so we don't need to keep it running.
});