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.
744 lines
28 KiB
TypeScript
744 lines
28 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import type { Page } from '@playwright/test';
|
|
import {
|
|
buildFlightsMapPath,
|
|
CITIES,
|
|
getToday,
|
|
getTomorrow,
|
|
getFutureDate,
|
|
getPastDate,
|
|
} from '../support/test-utilities';
|
|
|
|
const today = getToday();
|
|
const tomorrow = getTomorrow();
|
|
const futureDate = getFutureDate(7);
|
|
const pastDate = getPastDate(7);
|
|
|
|
// ============================================================================
|
|
// Flights Map Tests (20+ tests)
|
|
// ============================================================================
|
|
|
|
test.describe('Flights Map', () => {
|
|
test.describe('Category 1: Basic Map Navigation (4 tests)', () => {
|
|
test('Should navigate to flights map page (Test 1)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveURL(/flights-map/);
|
|
});
|
|
|
|
test('Should verify map loads on flights map page (Test 2)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const mapContainer = page.locator('[data-testid="map-container"]');
|
|
await expect(mapContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should verify map controls are visible (Test 3)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const zoomControl = page.locator('.leaflet-control-zoom');
|
|
await expect(zoomControl).toBeVisible();
|
|
});
|
|
|
|
test('Should verify page title (Test 4)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveTitle(/Flights Map/i);
|
|
});
|
|
});
|
|
|
|
test.describe('Category 2: City Selection (6 tests)', () => {
|
|
test('Should select departure city on map (Test 5)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(fromInput).toHaveValue('Moscow');
|
|
});
|
|
|
|
test('Should select arrival city on map (Test 6)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
await toInput.fill('Sochi');
|
|
await page.waitForTimeout(500);
|
|
await toInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(toInput).toHaveValue('Sochi');
|
|
});
|
|
|
|
test('Should verify city selection with autocomplete (Test 7)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Saint');
|
|
await page.waitForTimeout(500);
|
|
|
|
const autocompleteOption = page.locator('[data-testid="autocomplete-option"]').first();
|
|
await autocompleteOption.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(fromInput).toContainText('Saint Petersburg');
|
|
});
|
|
|
|
test('Should verify city input fields (Test 8)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
|
|
await expect(fromInput).toBeVisible();
|
|
await expect(toInput).toBeVisible();
|
|
});
|
|
|
|
test('Should clear city selection (Test 9)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const clearBtn = page.locator('[data-testid="flights-map-clear-btn"]');
|
|
await clearBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(fromInput).toHaveValue('');
|
|
});
|
|
|
|
test('Should select multiple cities for search (Test 10)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await toInput.fill('Sochi');
|
|
await page.waitForTimeout(500);
|
|
await toInput.press('Enter');
|
|
|
|
await expect(fromInput).toHaveValue('Moscow');
|
|
await expect(toInput).toHaveValue('Sochi');
|
|
});
|
|
});
|
|
|
|
test.describe('Category 3: Flight Search (6 tests)', () => {
|
|
test('Should search flights from selected departure city (Test 11)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search flights to selected arrival city (Test 12)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await toInput.fill('Sochi');
|
|
await page.waitForTimeout(500);
|
|
await toInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search flights with date selection (Test 13)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const dateFromInput = page.locator('[data-testid="flights-map-date-from"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await dateFromInput.fill(today);
|
|
await dateFromInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search flights with date range (Test 14)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const dateFromInput = page.locator('[data-testid="flights-map-date-from"]');
|
|
const dateToInput = page.locator('[data-testid="flights-map-date-to"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await dateFromInput.fill(today);
|
|
await dateFromInput.press('Enter');
|
|
|
|
await dateToInput.fill(futureDate);
|
|
await dateToInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search flights with filters (Test 15)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const connectionsSelect = page.locator('[data-testid="flights-map-connections-select"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await connectionsSelect.selectOption('0');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search flights with invalid selection and show error (Test 16)', async ({
|
|
page,
|
|
}) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Invalid City XXX');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe('Category 4: Flight Results (4 tests)', () => {
|
|
test('Should verify flight results display (Test 17)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should verify flight count in results (Test 18)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const flightCount = page.locator('[data-testid="flight-count"]');
|
|
await expect(flightCount).toBeVisible();
|
|
});
|
|
|
|
test('Should verify flight details in results (Test 19)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const firstResult = page.locator('[data-testid="flight-result"]').first();
|
|
await expect(firstResult).toBeVisible();
|
|
|
|
const flightNumber = firstResult.locator('[data-testid="flight-number"]');
|
|
await expect(flightNumber).toBeVisible();
|
|
});
|
|
|
|
test('Should verify empty results message (Test 20)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('NonExistent City');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
await expect(noResults).toContainText('No results');
|
|
});
|
|
});
|
|
|
|
test.describe('Category 5: Edge Cases (2 tests)', () => {
|
|
test('Should handle search with no cities selected (Test 21)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const validationError = page.locator('[data-testid="validation-error"]');
|
|
await expect(validationError).toBeVisible();
|
|
});
|
|
|
|
test('Should handle invalid city selection (Test 22)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('XXX');
|
|
await page.waitForTimeout(500);
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe('Category 6: Additional Flights Map Tests', () => {
|
|
test('Should navigate to flights map for different cities (Test 23)', async ({ page }) => {
|
|
const cities = ['MOW', 'LED', 'AER', 'OVB', 'KRR'];
|
|
|
|
for (const cityCode of cities) {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill(CITIES.find((c) => c.code === cityCode)?.name || '');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('Should display correct date in results (Test 24)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const dateFromInput = page.locator('[data-testid="flights-map-date-from"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await dateFromInput.fill(today);
|
|
await dateFromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const dateDisplay = page.locator('[data-testid="date-display"]');
|
|
await expect(dateDisplay).toBeVisible();
|
|
await expect(dateDisplay).toContainText(today);
|
|
});
|
|
|
|
test('Should filter by connections (Test 25)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const connectionsSelect = page.locator('[data-testid="flights-map-connections-select"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await connectionsSelect.selectOption('1');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should display flight status badges (Test 26)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const statusBadge = page.locator('[data-testid="status-badge"]').first();
|
|
await expect(statusBadge).toBeVisible();
|
|
});
|
|
|
|
test('Should display flight departure and arrival cities (Test 27)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await toInput.fill('Sochi');
|
|
await page.waitForTimeout(500);
|
|
await toInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const firstResult = page.locator('[data-testid="flight-result"]').first();
|
|
await expect(firstResult).toBeVisible();
|
|
|
|
const depCity = firstResult.locator('[data-testid="departure-city"]');
|
|
const arrCity = firstResult.locator('[data-testid="arrival-city"]');
|
|
await expect(depCity).toBeVisible();
|
|
await expect(arrCity).toBeVisible();
|
|
});
|
|
|
|
test('Should display flight times (Test 28)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const firstResult = page.locator('[data-testid="flight-result"]').first();
|
|
await expect(firstResult).toBeVisible();
|
|
|
|
const depTime = firstResult.locator('[data-testid="departure-time"]');
|
|
const arrTime = firstResult.locator('[data-testid="arrival-time"]');
|
|
await expect(depTime).toBeVisible();
|
|
await expect(arrTime).toBeVisible();
|
|
});
|
|
|
|
test('Should display flight airline information (Test 29)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const firstResult = page.locator('[data-testid="flight-result"]').first();
|
|
await expect(firstResult).toBeVisible();
|
|
|
|
const airlineName = firstResult.locator('[data-testid="airline-name"]');
|
|
await expect(airlineName).toBeVisible();
|
|
});
|
|
|
|
test('Should handle network error (Test 30)', async ({ page }) => {
|
|
await page.route('**/api/destinations**', (route) => {
|
|
return route.abort('internetdisconnected');
|
|
});
|
|
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const networkError = page.locator('[data-testid="network-error"]');
|
|
await expect(networkError).toBeVisible();
|
|
});
|
|
|
|
test('Should search with special characters (Test 31)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow!@#$');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const noResults = page.locator('[data-testid="no-results"]');
|
|
await expect(noResults).toBeVisible();
|
|
});
|
|
|
|
test('Should search with Unicode characters (Test 32)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow 🛫');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should handle rapid search attempts (Test 33)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
|
|
for (let i = 0; i < 5; i++) {
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(200);
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
}
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should verify map zoom controls (Test 34)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const zoomInBtn = page.locator('.leaflet-control-zoom-in');
|
|
const zoomOutBtn = page.locator('.leaflet-control-zoom-out');
|
|
|
|
await expect(zoomInBtn).toBeVisible();
|
|
await expect(zoomOutBtn).toBeVisible();
|
|
|
|
await zoomInBtn.click();
|
|
await page.waitForTimeout(200);
|
|
|
|
await zoomOutBtn.click();
|
|
await page.waitForTimeout(200);
|
|
});
|
|
|
|
test('Should verify map center coordinates (Test 35)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const mapContainer = page.locator('[data-testid="map-container"]');
|
|
await expect(mapContainer).toBeVisible();
|
|
|
|
const markers = page.locator('[data-testid="flight-marker"]');
|
|
const markerCount = await markers.count();
|
|
expect(markerCount).toBeGreaterThan(0);
|
|
});
|
|
|
|
test('Should search with past date and show validation (Test 36)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const dateFromInput = page.locator('[data-testid="flights-map-date-from"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await dateFromInput.fill(pastDate);
|
|
await dateFromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search with future date (Test 37)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const dateFromInput = page.locator('[data-testid="flights-map-date-from"]');
|
|
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await dateFromInput.fill(futureDate);
|
|
await dateFromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search from Saint Petersburg to Sochi (Test 38)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
|
|
await fromInput.fill('Saint Petersburg');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await toInput.fill('Sochi');
|
|
await page.waitForTimeout(500);
|
|
await toInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search from Novosibirsk to Moscow (Test 39)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
const toInput = page.locator('[data-testid="flights-map-to-input"] input');
|
|
|
|
await fromInput.fill('Novosibirsk');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
await toInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await toInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
|
|
test('Should search with no arrival city (Test 40)', async ({ page }) => {
|
|
await page.goto(`/ru-ru${buildFlightsMapPath()}`);
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const fromInput = page.locator('[data-testid="flights-map-from-input"] input');
|
|
await fromInput.fill('Moscow');
|
|
await page.waitForTimeout(500);
|
|
await fromInput.press('Enter');
|
|
|
|
const searchBtn = page.locator('[data-testid="flights-map-search-btn"]');
|
|
await searchBtn.click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const resultsContainer = page.locator('[data-testid="flights-map-results"]');
|
|
await expect(resultsContainer).toBeVisible();
|
|
});
|
|
});
|
|
});
|