qe-fe-automation
Version:
FE test automation framework using cypress
73 lines (68 loc) • 2.98 kB
text/typescript
import { LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import { HelpCenter } from '@helpcenter-lib/helpcenter';
import { ChatBox, ChatApiIntercept } from '@chat-lib/index';
import { LocationUtility } from '@utility-lib/location';
import moment = require('moment');
const DATE_FORMAT = 'YYYY-MM-DD';
describe('Chat: Invoices and charges', () => {
it.skip(
'C8913823: user asks about the invoice for trip from list of trips',
{ tags: ['@tier2'] },
() => {
const bookingData1 = {
location: LocationUtility.getCityUS(),
checkInDate: moment(moment()).add(10, 'days').format(DATE_FORMAT),
checkOutDate: moment(moment()).add(12, 'days').format(DATE_FORMAT),
tripName: 'Cypress First Hotel Booking',
reason: 'AvaChatTest1',
tripId: 'NEW'
};
const bookingData2 = {
location: LocationUtility.getCityUS(),
checkInDate: moment(moment()).add(20, 'days').format(DATE_FORMAT),
checkOutDate: moment(moment()).add(21, 'days').format(DATE_FORMAT),
tripName: 'Cypress Second Hotel Booking',
reason: 'AvaChatTest2',
tripId: 'NEW'
};
const bookingData3 = {
location: LocationUtility.getCityUS(),
checkInDate: moment(moment()).add(5, 'days').format(DATE_FORMAT),
checkOutDate: moment(moment()).add(6, 'days').format(DATE_FORMAT),
tripName: 'Cypress Third Hotel Booking',
reason: 'AvaChatTest3',
tripId: 'NEW'
};
LoginPage.createNewCompanyAndLoginWithUserByType({
users: [User_Type.ADMIN],
companySuffix: '-avacsate2etest'
});
LoginPage.createHotelBookingForOnBoardingCompany(bookingData1);
LoginPage.createHotelBookingForOnBoardingCompany(bookingData2);
LoginPage.createHotelBookingForOnBoardingCompany(bookingData3);
ChatApiIntercept.interceptChatApis();
HelpCenter.visitPage();
ChatBox.openChatWithAva();
ChatBox.selectMsgYouWannaSendBackToAva('No');
ChatBox.selectMsgYouWannaSendBackToAva('Upcoming trips');
ChatBox.selectBooking('Hotel', 2);
ChatBox.selectMsgYouWannaSendBackToAva('Invoice and charges');
ChatBox.validateInvoiceMsgText(
'A copy of this invoice/receipt is also available to download.'
);
ChatBox.selectMsgYouWannaSendBackToAva('Send to my email');
ChatBox.readAvaMsgAndSelectReply(
'Ok, I have sent the invoice to your mailbox.',
'Yes, something else'
);
ChatBox.selectMsgYouWannaSendBackToAva('Go back');
ChatBox.selectMsgYouWannaSendBackToAva('Upcoming trips');
ChatBox.selectMsgYouWannaSendBackToAva('Go back');
ChatBox.selectMsgYouWannaSendBackToAva('Upcoming trips');
ChatBox.selectBooking('Hotel', 1);
ChatBox.selectMsgYouWannaSendBackToAva('Invoice and charges');
ChatBox.selectMsgYouWannaSendBackToAva('Help with something else');
}
);
});