UNPKG

qe-fe-automation

Version:
71 lines (66 loc) 2.94 kB
import { LoginPage } from '@admin-lib/index'; import { User_Type } from '@support-onboard/index'; import { HelpCenter } from '@helpcenter-lib/helpcenter'; import { ChatBox, ChatApiIntercept, ChatBooking } from '@chat-lib/index'; import { LocationUtility } from '@utility-lib/location'; import moment = require('moment'); import { Timeouts } from '@utility-lib/index'; const DATE_FORMAT = 'YYYY-MM-DD'; describe('Chat: ML supported flows', () => { it.skip( 'C9475666: Use chat to change hotel booking via ML supported flow', { tags: ['@tier2'] }, () => { const bookingData1 = { location: LocationUtility.getCityUS(), checkInDate: moment(moment()).add(20, 'days').format(DATE_FORMAT), checkOutDate: moment(moment()).add(22, 'days').format(DATE_FORMAT), tripName: 'Cypress First Hotel Booking', reason: 'AvaChatTest1', tripId: 'NEW' }; const bookingData2 = { location: LocationUtility.getCityUS(), checkInDate: moment(moment()).add(10, 'days').format(DATE_FORMAT), checkOutDate: moment(moment()).add(11, '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: '-avamltest' }); LoginPage.createHotelBookingForOnBoardingCompany(bookingData1); LoginPage.createHotelBookingForOnBoardingCompany(bookingData2); LoginPage.createHotelBookingForOnBoardingCompany(bookingData3); ChatApiIntercept.interceptChatApis(); HelpCenter.visitPage(); ChatBox.openChatWithAva(); ChatBox.selectMsgYouWannaSendBackToAva('No'); ChatBox.typeMsgToAva(`I want to change hotel`); ChatBox.expectMsgReceivedFromAva(`which hotel booking`); ChatBox.typeMsgToAva(`Present as a list`); ChatBox.typeMsgToAva( `I want to change the second hotel from the list to ${LocationUtility.getCityUS()} on the same dates` ); ChatBox.waitUntilAvaStopTyping(); ChatBox.readAvaMsgAndTypeReply('change your hotel booking', 'Yes'); cy.wait(Timeouts.MEDIUM_TIMEOUT_30_SEC.timeout); ChatBox.readAvaMsgAndSelectReply(' refundable', 'hange'); ChatBooking.clickLetsGoButton(false); //TODO Reported problem for test CATI-2746 ChatBox.expectMsgReceivedFromAva( `Unfortunately, I encountered an error during the hotel search and can't see whether a room is available on the days you requested.` ); } ); });