test: add Playwright E2E test configuration and test files
Railtrack Pro Tests / Code Quality Check (pull_request) Has been cancelled
Railtrack Pro Tests / Code Coverage Check (pull_request) Has been cancelled
Railtrack Pro Tests / Run Test Suite (pull_request) Has been cancelled

This commit is contained in:
Railtrack Pro Dev
2026-03-20 11:12:57 +00:00
parent 7191519b95
commit 3f7237c106
2 changed files with 75 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
/**
* Playwright E2E Tests for Railtrack Pro
* Tests core game functionality with video recording on failure
*/
const { test, expect } = require('@playwright/test');
test.describe('Railtrack Pro E2E Tests', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:8080');
});
test.afterEach(async ({ page }) => {
await page.close();
});
test('should load game page successfully', async ({ page }) => {
await expect(page).toHaveTitle(/Railtrack Pro/i);
});
test('should render Three.js canvas', async ({ page }) => {
const canvas = page.locator('canvas');
await expect(canvas).toBeVisible();
});
test('should initialize game world', async ({ page }) => {
await page.waitForTimeout(2000);
const canvas = page.locator('canvas');
const rect = await canvas.boundingBox();
expect(rect).toBeTruthy();
});
test('should respond to mouse interactions', async ({ page }) => {
await page.waitForTimeout(2000);
const canvas = page.locator('canvas');
await canvas.hover();
console.log('Mouse interaction successful');
});
});
console.log('Playwright E2E test file created successfully');