feat: add Playwright configuration and initial e2e test for authentication

- Created Playwright configuration file to set up testing environment.
- Added a new e2e test for user authentication in login.spec.ts.
- Updated tsconfig.node.json to include playwright.config.ts.
- Enhanced vite.config.ts to include API proxying for backend integration.
- Added a placeholder for last run test results in .last-run.json.
This commit is contained in:
2025-10-11 17:25:38 +02:00
parent 0c405ee6ca
commit 1099a738a3
17 changed files with 558 additions and 14 deletions

View File

@@ -0,0 +1,26 @@
import { expect, test, type Page } from '@playwright/test';
const demoCredentials = {
username: process.env.DEMO_USERNAME ?? 'demo',
password: process.env.DEMO_PASSWORD ?? 'railgame123',
};
test.describe('Authentication', () => {
test('allows the demo user to sign in and view the network snapshot', async ({
page,
}: {
page: Page;
}) => {
await page.goto('/');
await expect(page.getByRole('heading', { name: 'Sign in' })).toBeVisible();
await page.getByLabel('Username').fill(demoCredentials.username);
await page.getByLabel('Password').fill(demoCredentials.password);
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page.getByRole('heading', { name: 'Network Snapshot' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Stations' })).toBeVisible();
await expect(page.getByRole('button', { name: 'Sign out' })).toBeVisible();
});
});