qe-fe-automation
Version:
FE test automation framework using cypress
86 lines (80 loc) • 3 kB
text/typescript
import {
Flights,
FlightTripType,
FlightCheckout,
FlightInterceptApis
} from '@flight-lib/index';
import { CreateEvent, Invitations } from '@group-events-lib/index';
import { FlightBookingUtility, FlightUtility } from '@flight-modal/index';
import { GuestInviteWorkflow, GuestInfo } from '@guest-invite-lib/index';
import { LoginPage } from '@admin-lib/index';
import { Provider_Type, User_Type } from '@support-onboard/index';
describe('GME: Book a flight with travel windows via guest invite', () => {
beforeEach(() => {
LoginPage.createNewCompanyAndLoginWithUserByType({
providers: [Provider_Type.SABRE_FLIGHT],
users: [User_Type.ADMIN]
});
cy.createGuestInvitePaymentMethod();
FlightInterceptApis.interceptFlightsApis();
});
it(
'C1153823: Book a roundtrip flight with travel windows via guest invite',
{ tags: ['@tier2'] },
() => {
const firstName = 'Alexey';
const lastName = 'Sidorov';
const costCenter = 'Cost Center';
const department = 'Department';
const inviteName = 'Meeting in Paris';
const location = 'Paris, France';
const paymentMethod = 'Company — GUEST_INVITE';
const eventStartDate = '12';
const eventEndDate = '15';
const departureDate = '10';
const returnDate = '17';
const dayBefore = '9';
const dayAfter = '18';
const latestArrivalTime = '8:00 AM';
const earliestReturningTime = '7:00 PM';
const flightBookingParams = FlightBookingUtility.initFlightBookingParams({
locations: ['AMS - Schiphol Airport, Amsterdam, Netherlands'],
flightTripType: FlightTripType.ROUNDTRIP,
isItEventSearch: true
});
cy.task('getDataFromCache', 'userEmail').then((email: any) => {
const guestInfo: GuestInfo = {
firstName,
lastName,
email,
costCenter,
department,
inviteName,
location,
eventStartDate,
eventEndDate,
departureDate,
returnDate,
latestArrivalTime,
earliestReturningTime,
paymentMethod
};
GuestInviteWorkflow.createGuestInviteWithTravelWindows(guestInfo);
});
CreateEvent.openSearchPage();
Invitations.verifyInvitationName(inviteName);
Invitations.verifyLatestArrivalTime(latestArrivalTime);
Invitations.verifyEarliestReturningTime(earliestReturningTime);
Invitations.verifyOnlyTravelDatesAreEnabled(dayBefore, dayAfter);
Flights.setOrigin(flightBookingParams.locations[0]);
Invitations.selectTravelWindowsDates(departureDate, returnDate);
Flights.searchFlight(true);
FlightUtility.runChooseResultFlow(flightBookingParams);
FlightCheckout.saveTripInformation();
FlightCheckout.checkCancellationPolicy();
FlightCheckout.updateContactDetails();
FlightCheckout.checkIn('Skip');
FlightCheckout.bookAndPay(flightBookingParams);
}
);
});