0a5ab058a6
- 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.
59 lines
2.2 KiB
TypeScript
59 lines
2.2 KiB
TypeScript
import * as moment from 'moment';
|
|
|
|
describe('Онлайн табло: Поиск по маршруту', () => {
|
|
const route = {
|
|
departureCity: {
|
|
name: 'Москва',
|
|
code: 'MOW',
|
|
latitude: 55.7558,
|
|
longitude: 37.62,
|
|
},
|
|
arrivalCity: {
|
|
name: 'Сочи',
|
|
code: 'AER',
|
|
latitude: 43.58,
|
|
longitude: 39.72,
|
|
},
|
|
};
|
|
const today = moment().format('DD.MM.YYYY');
|
|
beforeEach(() => {
|
|
cy.intercept('GET', '**api/flights/v1.1/ru/board**').as('getFlights');
|
|
cy.forbidGeolocation();
|
|
cy.visit('/');
|
|
cy.getByTestId('route-filter').click();
|
|
});
|
|
|
|
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(`Должен искать рейсы ${route.departureCity.name} - ${route.arrivalCity.name} , открывать корректный URL и детали рейса`, () => {
|
|
cy.getByTestId('route-departure-city-input').type(`${route.departureCity.name}`);
|
|
cy.getByTestId('route-arrival-city-input').type(`${route.arrivalCity.name}`);
|
|
|
|
cy.getByTestId('calendar-input').type(today).type('{enter}');
|
|
cy.getByTestId('route-arrival-city-input').getByTestId('city-code').contains(`${route.arrivalCity.code}`).should('be.visible');
|
|
|
|
cy.getByTestId('route-departure-city-input').getByTestId('city-code').contains(`${route.departureCity.code}`).should('be.visible');
|
|
|
|
cy.getByTestId('route-search-button').click();
|
|
|
|
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');
|
|
});
|
|
});
|