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(
    'C7917115: user asks about the invoice for an ongoing trip',
    { tags: ['@tier2'] },
    () => {
      const daysToMove = { daysToMove: 0, 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.startNewChatWithAva();
      ChatBox.selectMsgYouWannaSendBackToAva('something else');
      ChatBox.readAvaMsgAndSelectReply('What can I help you with today?', 'Ongoing 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.'
      );
    }
  );
});
