Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 9 additions & 9 deletions apps/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"dependencies": {
"@wxyc/database": "^1.0.0",
"@wxyc/authentication": "^1.0.0",
"better-auth": "^1.3.23",
"cors": "^2.8.5",
"dotenv": "^17.2.1",
"express": "^5.1.0"
"better-auth": "^1.4.18",
"cors": "^2.8.6",
"dotenv": "^17.2.3",
"express": "^5.2.1"
},
"peerDependencies": {
"drizzle-orm": "^0.41.0"
"drizzle-orm": "^0.45.1"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^5.0.3",
"@types/express-serve-static-core": "^5.0.7",
"typescript": "^5.6.2"
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/express-serve-static-core": "^5.1.1",
"typescript": "^5.9.3"
}
}
14 changes: 7 additions & 7 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"@wxyc/database": "*",
"@wxyc/authentication": "*",
"async-mutex": "^0.5.0",
"aws-jwt-verify": "^5.1.0",
"cors": "^2.8.5",
"express": "^5.1.0",
"aws-jwt-verify": "^5.1.1",
"cors": "^2.8.6",
"express": "^5.2.1",
"node-fetch": "^3.3.2",
"node-ssh": "^13.2.1",
"postgres": "^3.4.4",
"posthog-node": "^5.8.6",
"postgres": "^3.4.8",
"posthog-node": "^5.24.7",
"ssh2": "^1.17.0",
"swagger-ui-express": "^5.0.1",
"yaml": "^2.7.1"
"yaml": "^2.8.2"
},
"peerDependencies": {
"drizzle-orm": "^0.41.0"
"drizzle-orm": "^0.45.1"
}
}
34 changes: 26 additions & 8 deletions dev_env/setup-e2e-test-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@ import { config } from 'dotenv';
config();

const TEST_PASSWORD = 'testpassword123';
const TEMP_PASSWORD = 'temppass123'; // For incomplete users (onboarding flow)

const TEST_USERS = [
interface TestUser {
id: string;
username: string;
password?: string; // Uses TEST_PASSWORD if not specified
}

const TEST_USERS: TestUser[] = [
{ id: 'test-member-id-000000000000000001', username: 'test_member' },
{ id: 'test-dj1-id-00000000000000000001', username: 'test_dj1' },
{ id: 'test-dj2-id-00000000000000000002', username: 'test_dj2' },
{ id: 'test-md-id-0000000000000000001', username: 'test_music_director' },
{ id: 'test-sm-id-0000000000000000001', username: 'test_station_manager' },
{ id: 'test-incomplete-id-0000000000001', username: 'test_incomplete' },
{ id: 'test-incomplete-id-0000000000001', username: 'test_incomplete', password: TEMP_PASSWORD },
{ id: 'test-deletable-id-00000000000001', username: 'test_deletable_user' },
{ id: 'test-promotable-id-0000000000001', username: 'test_promotable_user' },
{ id: 'test-demotable-sm-id-000000000001', username: 'test_demotable_sm' },
{ id: 'test-reset1-id-000000000000000001', username: 'test_reset1' },
{ id: 'test-reset2-id-000000000000000002', username: 'test_reset2' },
{ id: 'test-adminreset1-id-00000000001', username: 'test_adminreset1' },
];

async function setUpTestUsers() {
Expand All @@ -38,26 +48,34 @@ async function setUpTestUsers() {

console.log('Setting up E2E test users with passwords...\n');

// Hash the test password
const hashedPassword = await context.password.hash(TEST_PASSWORD);
console.log('Password hashed successfully');
// Hash both passwords upfront
const hashedTestPassword = await context.password.hash(TEST_PASSWORD);
const hashedTempPassword = await context.password.hash(TEMP_PASSWORD);
console.log('Passwords hashed successfully');

for (const user of TEST_USERS) {
try {
// Use custom password if specified, otherwise default test password
const passwordHash = user.password
? (user.password === TEMP_PASSWORD ? hashedTempPassword : await context.password.hash(user.password))
: hashedTestPassword;

// Update the account with the password hash
const result = await db
.update(account)
.set({ password: hashedPassword })
.set({ password: passwordHash })
.where(eq(account.userId, user.id));

console.log(`[+] Set password for ${user.username}`);
const passwordType = user.password ? user.password : TEST_PASSWORD;
console.log(`[+] Set password for ${user.username} (${passwordType})`);
} catch (error) {
console.error(`[-] Failed to set password for ${user.username}:`, error);
}
}

console.log('\nE2E test user setup complete!');
console.log(`All test users now have password: ${TEST_PASSWORD}`);
console.log(`Most test users have password: ${TEST_PASSWORD}`);
console.log(`Incomplete user has password: ${TEMP_PASSWORD}`);
process.exit(0);
} catch (error) {
console.error('Failed to set up E2E test users:', error);
Expand Down
Loading
Loading