qe-fe-automation
Version:
FE test automation framework using cypress
84 lines (81 loc) • 2.79 kB
text/typescript
import { GuestInvite } from '@admin-factory/interface';
import { faker } from '@faker-js/faker';
import { Dates } from '@utility-lib/dates';
export function createTrainGuestInvite(
userResponse: any,
paymentMethodUuid: string
): GuestInvite {
return {
invitees: [
{
givenName: faker.name.firstName(),
familyName: faker.name.lastName().replace(/'/g, ''),
email: userResponse.email,
billTo: 'Not Applicable',
department: 'Not Applicable'
}
],
tripInvitation: {
extraGuestAllowed: false,
purpose: `TrainEvent-${faker.datatype.number({ min: 10000000 })}`,
location: 'New Street, Birmingham, UK',
customBookingWindowDays: null,
hasCustomBookingWindow: false,
hotelRestrictions: false,
returnFlightTimeLocked: false,
destinationAirport: '',
flightBookingAllowed: false,
flightBookingInstructions: '',
flightMaxPriceLocale: '',
recommendedHotels: [],
hotelBookingAllowed: false,
hotelBookingInstructions: '',
hotelMaxPriceLocale: '',
railBookingAllowed: true,
railBookingInstructions: '',
railMaxPriceLocale: '',
carRentalCompanyName: '',
carBookingAllowed: false,
carBookingInstructions: '',
carMaxPriceLocale: '',
flightItineraryType: [],
railItineraryType: [],
generalInstructions: '',
companyPaymentMethodUuid: paymentMethodUuid,
hotelRateTypes: ['PAY_NOW'],
startDateTime: Dates.getDateTime(10).slice(0, 10).concat('T12:00'),
endDateTime: Dates.getDateTime(12).slice(0, 10).concat('T12:00'),
travelEarliestDepartureDateTime: Dates.getDateTime(9).slice(0, 10).concat('T12:00'),
travelLatestReturningDateTime: Dates.getDateTime(13).slice(0, 10).concat('T12:00'),
contact: {
uuid: userResponse.uuid
},
flightMaxPrice: 0,
railMaxPrice: 0,
hotelMaxPrice: 0,
carMaxPrice: 0,
locationGooglePlaceId:
'EhpOZXcgU3RyZWV0LCBCaXJtaW5naGFtLCBVSyIuKiwKFAoSCSsWIU6JvHBIEQd-t699Q2a6EhQKEgk5MAZ4NLpwSBF1EoEaKyMk2w',
billTo: '',
department: '',
reminderEmailConfig: {
repeatEveryDays: null,
remindBeforeDays: null
},
companyPolicyLevel: {
dateCreated: userResponse.companyPolicyLevel.dateCreated,
dateUpdated: userResponse.companyPolicyLevel.dateUpdated,
level: 'DEFAULT',
longHaulDurationThreshold: 480,
mediumHaulDurationThreshold: 300,
mediumHaulEnabled: true,
name: 'DEFAULT',
tripInvitationCount: 14718,
userCount: 9488,
uuid: userResponse.companyPolicyLevel.uuid
},
companyCarDirectBillPaymentMethods: [],
customFieldValues: []
}
};
}