Files
euchre_camp/e2e/cucumber/support/world.ts
T
david d5dc170417 feat: add tournament schedule feature test (issue #7)
- 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)
2026-04-26 16:39:13 -07:00

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();