feat: Implement tournament schedule tab and fix E2E tests #27
@@ -73,9 +73,31 @@ AfterAll(async function () {
|
|||||||
* Before each scenario: Create new page context
|
* Before each scenario: Create new page context
|
||||||
*/
|
*/
|
||||||
Before(async function () {
|
Before(async function () {
|
||||||
|
try {
|
||||||
// Create new context and page
|
// Create new context and page
|
||||||
world.context = await browser.newContext();
|
world.context = await browser.newContext();
|
||||||
world.page = await world.context.newPage();
|
world.page = await world.context.newPage();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Failed to create new browser context:', error);
|
||||||
|
console.log('🌍 Attempting to relaunch browser...');
|
||||||
|
|
||||||
|
// Try to relaunch browser
|
||||||
|
try {
|
||||||
|
await browser.close();
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore close errors
|
||||||
|
}
|
||||||
|
|
||||||
|
// Relaunch browser
|
||||||
|
browser = await chromium.launch({
|
||||||
|
headless: process.env.CI ? true : false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Retry creating context
|
||||||
|
world.context = await browser.newContext();
|
||||||
|
world.page = await world.context.newPage();
|
||||||
|
console.log('✅ Browser relaunched successfully');
|
||||||
|
}
|
||||||
|
|
||||||
// Log console messages for debugging
|
// Log console messages for debugging
|
||||||
world.page.on('console', msg => {
|
world.page.on('console', msg => {
|
||||||
|
|||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Run Cucumber tests with development database
|
||||||
|
|
||||||
|
# Load development environment
|
||||||
|
export $(cat .env.development | grep -v '^#' | xargs)
|
||||||
|
|
||||||
|
# Start dev server in background
|
||||||
|
bun run dev > /tmp/dev-server.log 2>&1 &
|
||||||
|
DEV_PID=$!
|
||||||
|
|
||||||
|
# Wait for server to be ready
|
||||||
|
echo "Waiting for dev server to start..."
|
||||||
|
sleep 15
|
||||||
|
|
||||||
|
# Check if server is ready
|
||||||
|
if curl -s http://localhost:3000 > /dev/null 2>&1; then
|
||||||
|
echo "✅ Dev server is ready"
|
||||||
|
else
|
||||||
|
echo "❌ Dev server failed to start"
|
||||||
|
kill $DEV_PID 2>/dev/null
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run Cucumber tests
|
||||||
|
echo "Running Cucumber tests..."
|
||||||
|
bun run test:acceptance:cucumber "$@"
|
||||||
|
|
||||||
|
# Capture exit code
|
||||||
|
EXIT_CODE=$?
|
||||||
|
|
||||||
|
# Stop dev server
|
||||||
|
echo "Stopping dev server..."
|
||||||
|
kill $DEV_PID 2>/dev/null
|
||||||
|
wait $DEV_PID 2>/dev/null
|
||||||
|
|
||||||
|
exit $EXIT_CODE
|
||||||
Reference in New Issue
Block a user