42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
|
|
/**
|
||
|
|
* 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');
|