qe-fe-automation
Version:
FE test automation framework using cypress
47 lines (43 loc) • 1.19 kB
text/typescript
import {
buildPassengerInfo,
buildPaymentMethod,
Employee,
generateBookingId,
getFiveDaysAgoDate,
getFiveHoursLaterDate,
getOneMonthAheadDate
} from '@fixtures/navan_pro/reed_mackay_booking/common';
import { faker } from '@faker-js/faker';
function buildFlightInfo() {
const departureDate = getOneMonthAheadDate();
return {
flightNumber: '7197',
airlineCode: 'BA',
cabinClass: 'ECO',
departureTime: departureDate,
arrivalTime: getFiveHoursLaterDate(departureDate),
departureAirportCode: 'LGW',
arrivalAirportCode: 'MAD'
};
}
export const buildFlightForEmployee = (employee: Employee) => {
return {
bookingStatus: 'CONFIRMED',
bookingId: generateBookingId(),
amount: faker.datatype.number({ max: 3000, min: 20 }),
cancelable: faker.datatype.boolean(),
currency: 'USD',
serviceFee: faker.datatype.number({ max: 100 }),
employeeId: employee.uuid,
orderDateTime: getFiveDaysAgoDate(),
personal: false,
passengerInfo: [
{
...buildPassengerInfo(employee),
ticketNumbers: ['N/A']
}
],
paymentMethod: buildPaymentMethod(),
flightInfo: [buildFlightInfo()]
};
};