feat: Implement tournament schedule tab and fix E2E tests #27
@@ -40,4 +40,7 @@ module.exports = {
|
||||
|
||||
// Strict mode (fail on undefined steps)
|
||||
strict: true,
|
||||
|
||||
// Increase default timeout for steps (default is 5000ms)
|
||||
defaultTimeout: 30000,
|
||||
};
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
* Cucumber hooks for EuchreCamp E2E tests
|
||||
*/
|
||||
|
||||
import { Before, After, BeforeAll, AfterAll } from '@cucumber/cucumber';
|
||||
import { Before, After, BeforeAll, AfterAll, setDefaultTimeout } from '@cucumber/cucumber';
|
||||
import { chromium, Browser } from '@playwright/test';
|
||||
import { world } from './world';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
// Set default timeout for Cucumber steps (30 seconds)
|
||||
setDefaultTimeout(30000);
|
||||
|
||||
// Global browser instance
|
||||
let browser: Browser;
|
||||
|
||||
@@ -101,9 +104,7 @@ Before(async function () {
|
||||
|
||||
// Log console messages for debugging
|
||||
world.page.on('console', msg => {
|
||||
if (msg.type() === 'error') {
|
||||
console.log('❌ PAGE ERROR:', msg.text());
|
||||
}
|
||||
console.log(`🌍 BROWSER ${msg.type()}:`, msg.text());
|
||||
});
|
||||
|
||||
// Log network errors
|
||||
|
||||
@@ -18,7 +18,12 @@ export interface WorldState {
|
||||
tournament?: any;
|
||||
tournamentTeamCount?: number;
|
||||
player?: any;
|
||||
playerId?: string; // Added for storing extracted player ID
|
||||
match?: any;
|
||||
generatedData?: {
|
||||
uniqueEmail?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
|
||||
export class World implements WorldState {
|
||||
@@ -34,7 +39,12 @@ export class World implements WorldState {
|
||||
tournament?: any;
|
||||
tournamentTeamCount?: number;
|
||||
player?: any;
|
||||
playerId?: string; // Added for storing extracted player ID
|
||||
match?: any;
|
||||
generatedData?: {
|
||||
uniqueEmail?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
constructor() {
|
||||
this.baseURL = process.env.BASE_URL || 'http://localhost:3000';
|
||||
@@ -43,9 +53,21 @@ export class World implements WorldState {
|
||||
|
||||
async getPrisma() {
|
||||
if (!this.prisma) {
|
||||
// Lazily load PrismaClient when first accessed
|
||||
// Load .env.development file for test database configuration (fallback)
|
||||
require('dotenv').config({ path: '.env.development' })
|
||||
|
||||
// Ensure database environment is set for Cucumber tests BEFORE importing PrismaClient
|
||||
if (!process.env.DATABASE_URL) {
|
||||
throw new Error('DATABASE_URL not set. Make sure .env.development exists and contains DATABASE_URL or set DATABASE_URL environment variable.');
|
||||
}
|
||||
process.env.DATABASE_PROVIDER = process.env.DATABASE_PROVIDER || 'postgresql';
|
||||
|
||||
// Import PrismaClient AFTER setting environment variables
|
||||
const { PrismaClient } = await import('@prisma/client');
|
||||
this.prisma = new PrismaClient();
|
||||
const { PrismaPg } = await import('@prisma/adapter-pg');
|
||||
|
||||
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
|
||||
this.prisma = new PrismaClient({ adapter });
|
||||
}
|
||||
return this.prisma;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user