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.
1454 lines
58 KiB
TypeScript
1454 lines
58 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import type { Page } from '@playwright/test';
|
|
import {
|
|
buildSchedulePath,
|
|
buildRouteParam,
|
|
generateScheduleEntry,
|
|
generateScheduleEntries,
|
|
getToday,
|
|
getTomorrow,
|
|
getFutureDate,
|
|
getPastDate,
|
|
CITIES,
|
|
FIXTURES,
|
|
} from '../support/test-utilities';
|
|
|
|
const today = getToday();
|
|
const tomorrow = getTomorrow();
|
|
const futureDate = getFutureDate(7);
|
|
const pastDate = getPastDate(7);
|
|
const dateFrom = today;
|
|
const dateTo = tomorrow;
|
|
|
|
// ============================================================================
|
|
// Schedule Search Tests (40+ tests)
|
|
// ============================================================================
|
|
|
|
test.describe('Schedule Search', () => {
|
|
test.describe('Category 1: Basic Schedule Search', () => {
|
|
test('Should search by departure and arrival city (manual input) (Test 1)', async ({
|
|
page,
|
|
}) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search by cities from autocomplete list (Test 2)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
await departureInput.press('Enter');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
await arrivalInput.press('Enter');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with today date (Test 3)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await dateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with future date (Test 4)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await dateInput.fill(futureDate);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with past date and show validation (Test 5)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await dateInput.fill(pastDate);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search without date and show validation (Test 6)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search with invalid cities and show error (Test 7)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Invalid City');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Another Invalid City');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="schedule-no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
|
|
test('Should search with same departure and arrival and show validation (Test 8)', async ({
|
|
page,
|
|
}) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Moscow');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe('Category 2: Round-Trip Search', () => {
|
|
test('Should search with outbound date only (Test 9)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const outboundDateInput = page.locator('[data-testid="schedule-outbound-date-input"]');
|
|
await outboundDateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with outbound and return dates (Test 10)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const outboundDateInput = page.locator('[data-testid="schedule-outbound-date-input"]');
|
|
await outboundDateInput.fill(today);
|
|
|
|
const returnDateInput = page.locator('[data-testid="schedule-return-date-input"]');
|
|
await returnDateInput.fill(tomorrow);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should select return date from calendar (Test 11)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const calendarInput = page.locator('[data-testid="schedule-calendar"]');
|
|
await calendarInput.click();
|
|
|
|
const calendarDate = page.locator('[data-testid="calendar-date"]').first();
|
|
await calendarDate.click();
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should verify date range selection (Test 12)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateRange = page.locator('[data-testid="schedule-date-range"]');
|
|
await expect(dateRange).toBeVisible();
|
|
});
|
|
|
|
test('Should verify date format DD.MM.YYYY (Test 13)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await dateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const dateText = page.locator('[data-testid="schedule-date-display"]');
|
|
await expect(dateText).toBeVisible();
|
|
|
|
const dateValue = await dateText.textContent();
|
|
expect(dateValue).toMatch(/\d{2}\.\d{2}\.\d{4}/);
|
|
});
|
|
|
|
test('Should verify date validation min/max dates (Test 14)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await expect(dateInput).toBeEnabled();
|
|
});
|
|
|
|
test('Should search with invalid return date and show error (Test 15)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const outboundDateInput = page.locator('[data-testid="schedule-outbound-date-input"]');
|
|
await outboundDateInput.fill(today);
|
|
|
|
const returnDateInput = page.locator('[data-testid="schedule-return-date-input"]');
|
|
await returnDateInput.fill('invalid-date');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search with return date before outbound date and show validation (Test 16)', async ({
|
|
page,
|
|
}) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const outboundDateInput = page.locator('[data-testid="schedule-outbound-date-input"]');
|
|
await outboundDateInput.fill(futureDate);
|
|
|
|
const returnDateInput = page.locator('[data-testid="schedule-return-date-input"]');
|
|
await returnDateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should exchange departure and arrival cities (Test 17)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const exchangeButton = page.locator('[data-testid="schedule-exchange-button"]');
|
|
await exchangeButton.click();
|
|
|
|
const departureValue = await departureInput.inputValue();
|
|
const arrivalValue = await arrivalInput.inputValue();
|
|
|
|
expect(departureValue).toContain('Sochi');
|
|
expect(arrivalValue).toContain('Moscow');
|
|
});
|
|
|
|
test('Should verify round-trip URL pattern (Test 18)', async ({ page }) => {
|
|
await page.goto(`/ru-ru/schedule?from=MOW&to=AER&dateFrom=${dateFrom}&dateTo=${dateTo}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveURL(/schedule/);
|
|
await expect(page).toHaveURL(/from=MOW/);
|
|
await expect(page).toHaveURL(/to=AER/);
|
|
await expect(page).toHaveURL(/dateFrom=/);
|
|
await expect(page).toHaveURL(/dateTo=/);
|
|
});
|
|
});
|
|
|
|
test.describe('Category 3: Flight Results', () => {
|
|
test('Should verify flight results display (Test 19)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-results"]');
|
|
await expect(results).toBeVisible();
|
|
});
|
|
|
|
test('Should verify flight count (Test 20)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should verify flight details in results (Test 21)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const flightNumber = result.locator('[data-testid="schedule-flight-number"]');
|
|
await expect(flightNumber).toBeVisible();
|
|
});
|
|
|
|
test('Should verify empty results message (Test 22)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Unknown City');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Unknown City');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="schedule-no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
await expect(noResults).toContainText('Нет результатов');
|
|
});
|
|
|
|
test('Should verify loading state (Test 23)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const loadingSpinner = page.locator('[data-testid="schedule-loading-spinner"]');
|
|
await expect(loadingSpinner).toBeVisible();
|
|
});
|
|
|
|
test('Should verify error state (Test 24)', async ({ page }) => {
|
|
await page.route('**/api/schedule/**', (route) => {
|
|
return route.abort('internetdisconnected');
|
|
});
|
|
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const networkError = page.locator('[data-testid="schedule-network-error"]');
|
|
await expect(networkError).toBeVisible();
|
|
});
|
|
|
|
test('Should verify sort options (Test 25)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const sortButton = page.locator('[data-testid="schedule-sort-button"]');
|
|
await expect(sortButton).toBeVisible();
|
|
|
|
await sortButton.click();
|
|
|
|
const sortOption = page.locator('[data-testid="sort-option-time"]');
|
|
await expect(sortOption).toBeVisible();
|
|
});
|
|
|
|
test('Should verify filter options (Test 26)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const filterButton = page.locator('[data-testid="schedule-filter-button"]');
|
|
await expect(filterButton).toBeVisible();
|
|
|
|
await filterButton.click();
|
|
|
|
const filterOption = page.locator('[data-testid="filter-option-direct"]');
|
|
await expect(filterOption).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe('Category 4: Flight Details', () => {
|
|
test('Should open flight details from results (Test 27)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await result.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveURL(/schedule\/detail/);
|
|
});
|
|
|
|
test('Should verify flight details content (Test 28)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await result.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const flightNumber = page.locator('[data-testid="schedule-flight-number"]');
|
|
await expect(flightNumber).toBeVisible();
|
|
});
|
|
|
|
test('Should verify flight route details (Test 29)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await result.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureCity = page.locator('[data-testid="schedule-departure-city"]');
|
|
await expect(departureCity).toBeVisible();
|
|
|
|
const arrivalCity = page.locator('[data-testid="schedule-arrival-city"]');
|
|
await expect(arrivalCity).toBeVisible();
|
|
});
|
|
|
|
test('Should verify flight status details (Test 30)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await result.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const status = page.locator('[data-testid="schedule-status"]');
|
|
await expect(status).toBeVisible();
|
|
});
|
|
|
|
test('Should close flight details (Test 31)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await result.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const closeBtn = page.locator('[data-testid="schedule-close-details-btn"]');
|
|
await closeBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveURL(/schedule/);
|
|
});
|
|
});
|
|
|
|
test.describe('Category 5: Edge Cases', () => {
|
|
test('Should search for non-existent cities (Test 32)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('XXX');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('YYY');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="schedule-no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
|
|
test('Should search with special characters (Test 33)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow!@#$%');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi!@#$%');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="schedule-no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
|
|
test('Should search with very long city names (Test 34)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const longCityName = 'Москва'.repeat(10);
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill(longCityName);
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill(longCityName);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search with Unicode characters (Test 35)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow 🛫');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi 🛬');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="schedule-no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
|
|
test('Should handle rapid search attempts (Test 36)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
|
|
for (let i = 0; i < 5; i++) {
|
|
await departureInput.fill('Moscow');
|
|
await arrivalInput.fill('Sochi');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
}
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with invalid date range (Test 37)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateFromInput = page.locator('[data-testid="schedule-date-from-input"]');
|
|
await dateFromInput.fill('invalid');
|
|
|
|
const dateToInput = page.locator('[data-testid="schedule-date-to-input"]');
|
|
await dateToInput.fill('invalid');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search with return date before outbound date (Test 38)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const outboundDateInput = page.locator('[data-testid="schedule-outbound-date-input"]');
|
|
await outboundDateInput.fill(futureDate);
|
|
|
|
const returnDateInput = page.locator('[data-testid="schedule-return-date-input"]');
|
|
await returnDateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search with very long date range (Test 39)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateFromInput = page.locator('[data-testid="schedule-date-from-input"]');
|
|
await dateFromInput.fill(today);
|
|
|
|
const dateToInput = page.locator('[data-testid="schedule-date-to-input"]');
|
|
await dateToInput.fill(getFutureDate(365));
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with empty cities (Test 40)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const validationError = page.locator('[data-testid="schedule-validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should search for different cities (Test 41)', async ({ page }) => {
|
|
const cities = ['MOW', 'LED', 'AER', 'OVB', 'KRR'];
|
|
|
|
for (const cityCode of cities) {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill(cityCode);
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('AER');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
}
|
|
});
|
|
|
|
test('Should display correct date in title (Test 42)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await dateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const dateText = page.locator('[data-testid="schedule-date-display"]');
|
|
await expect(dateText).toBeVisible();
|
|
await expect(dateText).toContainText(today);
|
|
});
|
|
|
|
test('Should filter by airline (Test 43)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const airlineFilter = page.locator('[data-testid="schedule-airline-filter"]');
|
|
await airlineFilter.click();
|
|
|
|
const aeroflotOption = page.locator('[data-testid="filter-option-SU"]');
|
|
await aeroflotOption.click();
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should filter by direct flights (Test 44)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const directFilter = page.locator('[data-testid="schedule-direct-filter"]');
|
|
await directFilter.click();
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should display flight number (Test 45)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const flightNumber = result.locator('[data-testid="schedule-flight-number"]');
|
|
await expect(flightNumber).toBeVisible();
|
|
});
|
|
|
|
test('Should display airline name (Test 46)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const airlineName = result.locator('[data-testid="schedule-airline-name"]');
|
|
await expect(airlineName).toBeVisible();
|
|
});
|
|
|
|
test('Should display departure and arrival cities (Test 47)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const depCity = result.locator('[data-testid="schedule-departure-city"]');
|
|
await expect(depCity).toBeVisible();
|
|
|
|
const arrCity = result.locator('[data-testid="schedule-arrival-city"]');
|
|
await expect(arrCity).toBeVisible();
|
|
});
|
|
|
|
test('Should display scheduled time (Test 48)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const depTime = result.locator('[data-testid="schedule-departure-time"]');
|
|
await expect(depTime).toBeVisible();
|
|
});
|
|
|
|
test('Should display arrival time (Test 49)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const arrTime = result.locator('[data-testid="schedule-arrival-time"]');
|
|
await expect(arrTime).toBeVisible();
|
|
});
|
|
|
|
test('Should display aircraft type (Test 50)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const aircraftType = result.locator('[data-testid="schedule-aircraft-type"]');
|
|
await expect(aircraftType).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe('Additional Schedule Tests', () => {
|
|
test('Should handle network error (Test 51)', async ({ page }) => {
|
|
await page.route('**/api/schedule/**', (route) => {
|
|
return route.abort('internetdisconnected');
|
|
});
|
|
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
|
|
const networkError = page.locator('[data-testid="schedule-network-error"]');
|
|
await expect(networkError).toBeVisible();
|
|
});
|
|
|
|
test('Should have proper ARIA labels (Test 52)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const form = page.locator('[data-testid="schedule-search-form"]');
|
|
await expect(form).toHaveAttribute('role', 'form');
|
|
});
|
|
|
|
test('Should be keyboard navigable (Test 53)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await page.keyboard.press('Tab');
|
|
await page.keyboard.press('Tab');
|
|
await page.keyboard.press('Tab');
|
|
|
|
const focusedElement = page.locator(':focus');
|
|
await expect(focusedElement).toBeVisible();
|
|
});
|
|
|
|
test('Should search by flight number (Test 54)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const flightSearchInput = page.locator('[data-testid="schedule-flight-search-input"]');
|
|
await flightSearchInput.fill('SU 1234');
|
|
await flightSearchInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should show no results when flight not found (Test 55)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const flightSearchInput = page.locator('[data-testid="schedule-flight-search-input"]');
|
|
await flightSearchInput.fill('SU 9999');
|
|
await flightSearchInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="schedule-no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
|
|
test('Should search by route (Test 56)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const routeTab = page.locator('[data-testid="schedule-route-search-tab"]');
|
|
await routeTab.click();
|
|
await page.waitForTimeout(500);
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await departureInput.press('Enter');
|
|
await page.waitForTimeout(500);
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
await page.waitForTimeout(500);
|
|
await arrivalInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should display days of week (Test 57)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const daysOfWeek = result.locator('[data-testid="schedule-days-of-week"]');
|
|
await expect(daysOfWeek).toBeVisible();
|
|
});
|
|
|
|
test('Should display effective date range (Test 58)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const result = page.locator('[data-testid="schedule-search-result"]').first();
|
|
await expect(result).toBeVisible();
|
|
|
|
const dateRange = result.locator('[data-testid="schedule-date-range"]');
|
|
await expect(dateRange).toBeVisible();
|
|
});
|
|
|
|
test('Should search with different date ranges (Test 59)', async ({ page }) => {
|
|
const dateRanges = [
|
|
{ from: today, to: tomorrow },
|
|
{ from: today, to: getFutureDate(3) },
|
|
{ from: today, to: getFutureDate(7) },
|
|
];
|
|
|
|
for (const range of dateRanges) {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const dateFromInput = page.locator('[data-testid="schedule-date-from-input"]');
|
|
await dateFromInput.fill(range.from);
|
|
|
|
const dateToInput = page.locator('[data-testid="schedule-date-to-input"]');
|
|
await dateToInput.fill(range.to);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
}
|
|
});
|
|
|
|
test('Should search with one-way trip (Test 60)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const oneWayTab = page.locator('[data-testid="schedule-one-way-tab"]');
|
|
await oneWayTab.click();
|
|
await page.waitForTimeout(500);
|
|
|
|
const dateInput = page.locator('[data-testid="schedule-date-input"]');
|
|
await dateInput.fill(today);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with round-trip (Test 61)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const roundTripTab = page.locator('[data-testid="schedule-round-trip-tab"]');
|
|
await roundTripTab.click();
|
|
await page.waitForTimeout(500);
|
|
|
|
const outboundDateInput = page.locator('[data-testid="schedule-outbound-date-input"]');
|
|
await outboundDateInput.fill(today);
|
|
|
|
const returnDateInput = page.locator('[data-testid="schedule-return-date-input"]');
|
|
await returnDateInput.fill(tomorrow);
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should switch between one-way and round-trip (Test 62)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const roundTripTab = page.locator('[data-testid="schedule-round-trip-tab"]');
|
|
await roundTripTab.click();
|
|
await page.waitForTimeout(500);
|
|
|
|
const oneWayTab = page.locator('[data-testid="schedule-one-way-tab"]');
|
|
await oneWayTab.click();
|
|
await page.waitForTimeout(500);
|
|
|
|
const oneWayVisible = await page.locator('[data-testid="schedule-date-input"]').isVisible();
|
|
expect(oneWayVisible).toBe(true);
|
|
});
|
|
|
|
test('Should handle invalid URL parameters (Test 63)', async ({ page }) => {
|
|
await page.goto(`/ru-ru/schedule?from=XXX&to=YYY&dateFrom=invalid&dateTo=invalid`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const errorState = page.locator('[data-testid="schedule-error-state"]');
|
|
await expect(errorState).toBeVisible();
|
|
});
|
|
|
|
test('Should navigate with pre-filled search (Test 64)', async ({ page }) => {
|
|
await page.goto(`/ru-ru/schedule?from=MOW&to=AER`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveURL(/schedule/);
|
|
await expect(page).toHaveURL(/from=MOW/);
|
|
await expect(page).toHaveURL(/to=AER/);
|
|
});
|
|
|
|
test('Should search with different aircraft types (Test 65)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const aircraftFilter = page.locator('[data-testid="schedule-aircraft-filter"]');
|
|
await aircraftFilter.click();
|
|
|
|
const aircraftOption = page.locator('[data-testid="filter-option-Airbus A320"]');
|
|
await aircraftOption.click();
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with time range (Test 66)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const timeRangeInput = page.locator('[data-testid="schedule-time-range-input"]');
|
|
await timeRangeInput.fill('06:00-18:00');
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with cabin class (Test 67)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const cabinFilter = page.locator('[data-testid="schedule-cabin-filter"]');
|
|
await cabinFilter.click();
|
|
|
|
const economyOption = page.locator('[data-testid="filter-option-economy"]');
|
|
await economyOption.click();
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with airline preference (Test 68)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const airlineFilter = page.locator('[data-testid="schedule-airline-filter"]');
|
|
await airlineFilter.click();
|
|
|
|
const aeroflotOption = page.locator('[data-testid="filter-option-SU"]');
|
|
await aeroflotOption.click();
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with non-stop filter (Test 69)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const nonStopFilter = page.locator('[data-testid="schedule-nonstop-filter"]');
|
|
await nonStopFilter.click();
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
|
|
test('Should search with flexible dates (Test 70)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildSchedulePath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const departureInput = page.locator('[data-testid="schedule-departure-city-input"]');
|
|
await departureInput.fill('Moscow');
|
|
|
|
const arrivalInput = page.locator('[data-testid="schedule-arrival-city-input"]');
|
|
await arrivalInput.fill('Sochi');
|
|
|
|
const flexibleDatesCheckbox = page.locator('[data-testid="schedule-flexible-dates"]');
|
|
await flexibleDatesCheckbox.click();
|
|
|
|
const searchButton = page.locator('[data-testid="schedule-search-button"]');
|
|
await searchButton.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const results = page.locator('[data-testid="schedule-search-result"]');
|
|
await expect(results).toHaveCount(50);
|
|
});
|
|
});
|
|
});
|