1bece10df2
- Add tournament-schedule.feature with 4 scenarios - Add step definitions for tournament schedule navigation - Tests viewing schedule, generating round-robin, bye rounds, and matchup navigation - Note: Some @wip scenarios require data setup (tournament creation, team addition)
55 lines
1.1 KiB
TypeScript
55 lines
1.1 KiB
TypeScript
/**
|
|
* World context for Cucumber tests
|
|
* Provides shared state between step definitions
|
|
*/
|
|
|
|
import { Page, BrowserContext, chromium, Browser } from '@playwright/test';
|
|
|
|
export interface WorldState {
|
|
page: Page;
|
|
context: BrowserContext;
|
|
prisma: any; // Lazy-loaded PrismaClient
|
|
baseURL: string;
|
|
user?: {
|
|
email: string;
|
|
name: string;
|
|
password: string;
|
|
};
|
|
tournament?: any;
|
|
tournamentTeamCount?: number;
|
|
player?: any;
|
|
match?: any;
|
|
}
|
|
|
|
export class World implements WorldState {
|
|
page!: Page;
|
|
context!: BrowserContext;
|
|
prisma: any;
|
|
baseURL: string;
|
|
user?: {
|
|
email: string;
|
|
name: string;
|
|
password: string;
|
|
};
|
|
tournament?: any;
|
|
player?: any;
|
|
match?: any;
|
|
|
|
constructor() {
|
|
this.baseURL = process.env.BASE_URL || 'http://localhost:3000';
|
|
this.prisma = null; // Will be lazily loaded when needed
|
|
}
|
|
|
|
async getPrisma() {
|
|
if (!this.prisma) {
|
|
// Lazily load PrismaClient when first accessed
|
|
const { PrismaClient } = await import('@prisma/client');
|
|
this.prisma = new PrismaClient();
|
|
}
|
|
return this.prisma;
|
|
}
|
|
}
|
|
|
|
// Export singleton instance
|
|
export const world = new World();
|