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.
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import * as moment from 'moment';
|
|
|
|
describe('Онлайн табло: Поиск рейса', () => {
|
|
const flightNumber = '0022'; // Москва - Санкт-Петербург
|
|
const expectedUrlDateTime = `${moment().format('DDMMYYYY')}`;
|
|
const today = moment().format('DD.MM.YYYY');
|
|
|
|
beforeEach(() => {
|
|
cy.intercept('GET', '**api/flights/v1.1/ru/board**').as('getFlights');
|
|
cy.visit('/');
|
|
cy.getByTestId('flight-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(`Должен искать рейс SU${flightNumber} , открывать корректный URL и детали рейса`, () => {
|
|
cy.getByTestId('flight-number-input').type(`${flightNumber}`).type('{enter}');
|
|
cy.getByTestId('calendar-input').type(today).type('{enter}');
|
|
|
|
|
|
cy.getByTestId('flight-number-search-button').click();
|
|
|
|
assertSearchResults();
|
|
|
|
cy.url().should('include', `ru-ru/onlineboard/flight/SU${flightNumber}/${expectedUrlDateTime}`);
|
|
|
|
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');
|
|
});
|
|
});
|