import { User_Type } from '@support-onboard/index';
import { HelpCenter } from '@helpcenter-lib/helpcenter';
import { ChatBox, ChatApiIntercept, ChatBooking, TravelType } from '@chat-lib/index';
import { LocationUtility } from '@utility-lib/location';
import { Hotels } from '@hotel-lib/search';
import { LoginPage } from '@admin-lib/index';

describe('Chat: Invoices and charges', () => {
  it.skip(
    'C7957168: user asks about the invoice for an upcoming trip',
    { tags: ['@tier2'] },
    () => {
      const daysToMove = { daysToMove: 4, daysAfterMovedDays: 5 };
      ChatApiIntercept.interceptChatApis();
      Hotels.prepareCompanyAndUserCreation(User_Type.ADMIN);
      LoginPage.createNewCompanyAndLoginWithUserByType({
        users: [User_Type.ADMIN],
        companySuffix: '-avacsate2etest'
      });
      HelpCenter.visitPage();
      ChatBox.openChatWithAva();
      ChatBox.selectBookTravelFlow(TravelType.HOTEL);
      ChatBooking.bookHotel(LocationUtility.getCityUS(), daysToMove);
      ChatBooking.checkIsChatMinimized();

      ChatBox.openChat();
      ChatBox.closeChat();
      ChatBox.confirmCloseChat();
      ChatBox.closeChat();
      ChatBox.openChatWithAva();
      ChatBox.selectMsgYouWannaSendBackToAva('No');
      ChatBox.readAvaMsgAndSelectReply(
        'What can I help you with today?',
        'Upcoming trip'
      );
      ChatBox.expectMsgReceivedFromAva('How can I help with this booking?');
      ChatBox.readAvaMsgAndSelectReply('I found this booking:', 'Invoice and charges');
      ChatBox.checkIfInvoicePresent();
      ChatBox.validateInvoiceMsgText(
        'A copy of this invoice/receipt is also available to download.'
      );
    }
  );
});
