Files
flights_web_raw/ClientApp/cypress/integration/01 - online board - arrival.ts
T
gnezim 0a5ab058a6 Initial commit: Aeroflot Flights Web - Angular 12 baseline
- Angular 12 application with PrimeNG components
- 5 existing Cypress e2e test suites
- SCSS styling with BEM naming convention
- i18n support (10 languages)
- Leaflet map integration
- Complete component hierarchy and routing structure

This baseline will be used for Angular → React migration.
2026-04-05 18:47:57 +03:00

64 lines
2.4 KiB
TypeScript

import * as moment from 'moment';
describe('Онлайн табло: Прилет', () => {
const arrivalCity = {
name: 'Анапа',
code: 'AAQ',
latitude: 55.7558,
longitude: 37.62,
};
const today = moment().format('DD.MM.YYYY');
const expectedUrlDateTime = `${moment().format('DDMMYYYY')}-0000-2400`;
beforeEach(() => {
cy.intercept('GET', '**api/flights/v1.1/ru/board**').as('getFlights');
cy.forbidGeolocation();
cy.visit('/');
});
const assertSearchResults = () => {
cy.getByTestId('loader').should('be.visible');
cy.wait('@getFlights').then(() => {
cy.getByTestId('board-search-result').should('be.visible');
cy.getByTestId('flight-result').should('have.length.at.least', 1);
});
};
it(`Должен искать рейсы (${arrivalCity.name} - ручной ввод), открывать корректный URL и детали рейса`, () => {
cy.getByTestId('city-autocomplete-input').type(`${arrivalCity.name}`).type('{enter}');
cy.getByTestId('calendar-input').type(today).type('{enter}');
cy.getByTestId('city-code').contains(`${arrivalCity.code}`).should('be.visible');
cy.getByTestId('arrival-search-button').click();
cy.url().should('include', `ru-ru/onlineboard/arrival/${arrivalCity.code}/${expectedUrlDateTime}`);
assertSearchResults();
cy.getByTestId('flight-result')
.first()
.getByTestId('flight-carrier-number')
.should('be.visible')
.getByTestId('flight-company-logo')
.should('be.visible');
cy.getByTestId('flight-details-button').click();
cy.getByTestId('flight-details-number').should('be.visible');
cy.getByTestId('flight-company-logo').should('be.visible');
});
it(`Должен искать рейсы (${arrivalCity.name} - выбор из списка)`, () => {
cy.getByTestId('calendar-input').type(today).type('{enter}');
cy.getByTestId('autocomplete-popup-button').click();
cy.getByTestId(`city-name-cell-${arrivalCity.name}`).click();
cy.getByTestId('city-code').contains(`${arrivalCity.code}`).should('be.visible');
cy.getByTestId('arrival-search-button').click();
assertSearchResults();
});
});