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.8 KiB
TypeScript
72 lines
2.8 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Navigation & Language (US-1, US-2) - React ru-ru', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('http://localhost:3002/ru-ru/onlineboard');
|
|
});
|
|
|
|
test('US-1: Tab navigation - switch between all tabs', async ({ page }) => {
|
|
// Verify Online Board tab is active
|
|
const onlineTab = page.locator('[data-testid="nav-onlineboard-tab"]');
|
|
await expect(onlineTab).toHaveClass(/active/);
|
|
|
|
// Click Schedule tab
|
|
const scheduleTab = page.locator('[data-testid="nav-schedule-tab"]');
|
|
await scheduleTab.click();
|
|
await expect(page).toHaveURL(/\/ru-ru\/schedule/);
|
|
await expect(scheduleTab).toHaveClass(/active/);
|
|
|
|
// Click Flights Map tab
|
|
const mapTab = page.locator('[data-testid="nav-flights-map-tab"]');
|
|
if (await mapTab.isVisible()) {
|
|
await mapTab.click();
|
|
await expect(page).toHaveURL(/\/ru-ru\/flights-map/);
|
|
await expect(mapTab).toHaveClass(/active/);
|
|
}
|
|
|
|
// Navigate back to Online Board
|
|
await onlineTab.click();
|
|
await expect(page).toHaveURL(/\/ru-ru\/onlineboard/);
|
|
await expect(onlineTab).toHaveClass(/active/);
|
|
});
|
|
|
|
test('US-2: Language switching - ru-ru to en-us to ru-ru', async ({ page }) => {
|
|
// Verify current language is Russian
|
|
await expect(page.locator('[data-testid="nav-onlineboard-tab"]')).toContainText('Онлайн-Табло');
|
|
|
|
// Click locale switcher dropdown
|
|
const switcher = page.locator('[data-testid="layout-locale-switcher"]');
|
|
await switcher.click();
|
|
|
|
// Select English (en-us)
|
|
await page.locator('text=English').first().click();
|
|
await expect(page).toHaveURL(/\/en-us\/onlineboard/);
|
|
|
|
// Verify UI is now in English
|
|
await expect(page.locator('[data-testid="nav-onlineboard-tab"]')).toContainText('Online Board');
|
|
|
|
// Click locale switcher dropdown again
|
|
await switcher.click();
|
|
|
|
// Switch back to Russian
|
|
await page.locator('text=Русский').first().click();
|
|
await expect(page).toHaveURL(/\/ru-ru\/onlineboard/);
|
|
await expect(page.locator('[data-testid="nav-onlineboard-tab"]')).toContainText('Онлайн-Табло');
|
|
});
|
|
|
|
test('US-2: Language switching - preserve page context', async ({ page }) => {
|
|
// Navigate to Schedule
|
|
await page.locator('[data-testid="nav-schedule-tab"]').click();
|
|
await expect(page).toHaveURL(/\/ru-ru\/schedule/);
|
|
|
|
// Switch to English via dropdown
|
|
const switcher = page.locator('[data-testid="layout-locale-switcher"]');
|
|
await switcher.click();
|
|
await page.locator('text=English').first().click();
|
|
|
|
// Should still be on Schedule page (not Online Board)
|
|
await expect(page).toHaveURL(/\/en-us\/schedule/);
|
|
await expect(page.locator('[data-testid="nav-schedule-tab"]')).toContainText('Schedule');
|
|
});
|
|
});
|