375bcfb0fa
Copies Playwright e2e tests (58 specs, 300+ tests) designed for cross-app testing. Adapts API mocks to match real Aeroflot dictionary format (title objects with multilingual keys), adds board/schedule/days endpoint mocks, and provides Angular-specific Playwright config on port 4203.
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('US-102: Browser History Navigation', () => {
|
|
const BASE_URL = 'http://localhost:3001';
|
|
|
|
test('should update URL when search form changes', async ({ page }) => {
|
|
await page.goto(`${BASE_URL}/ru-ru/schedule`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Fill departure city input
|
|
const inputs = page.locator('input');
|
|
await inputs.first().fill('Moscow');
|
|
|
|
// Check URL contains parameter
|
|
const url = page.url();
|
|
expect(url).toContain('city=Moscow');
|
|
});
|
|
|
|
test('should preserve state on back button', async ({ page }) => {
|
|
await page.goto(`${BASE_URL}/ru-ru/schedule`);
|
|
|
|
// Set initial state
|
|
const inputs = page.locator('input');
|
|
await inputs.first().fill('Moscow');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Navigate away and back
|
|
await page.goto(`${BASE_URL}/ru-ru/flights`);
|
|
await page.goBack();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// State should be preserved in URL
|
|
const url = page.url();
|
|
expect(url).toContain('city=Moscow');
|
|
});
|
|
|
|
test('should support forward navigation', async ({ page }) => {
|
|
await page.goto(`${BASE_URL}/ru-ru/schedule`);
|
|
|
|
const inputs = page.locator('input');
|
|
await inputs.first().fill('St Petersburg');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Go back then forward
|
|
await page.goBack();
|
|
await page.goForward();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// URL should match forward state
|
|
const url = page.url();
|
|
expect(url).toContain('St');
|
|
});
|
|
|
|
test('should console have zero errors', async ({ page }) => {
|
|
const errors: string[] = [];
|
|
page.on('console', (msg) => {
|
|
if (msg.type() === 'error') errors.push(msg.text());
|
|
});
|
|
|
|
await page.goto(`${BASE_URL}/ru-ru/schedule`);
|
|
const inputs = page.locator('input');
|
|
await inputs.first().fill('Moscow');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await page.goBack();
|
|
await page.waitForLoadState('networkidle');
|
|
await page.goForward();
|
|
|
|
expect(errors).toHaveLength(0);
|
|
});
|
|
});
|