import {
  Trips,
  RentalCar,
  RentalCarFilters,
  RentalCarSearchResults,
  RentalCarCheckout
} from '@rentalCar-lib/index';
import { User_Type } from '@support-onboard/index';
import { LocationUtility } from '@utility-lib/index';
import { LoyaltyPrograms } from '@profile-lib/loyalty_programs';
import { RentalCarUtility } from '@rentalcar-modal/index';

describe.skip('Rental Car: with loyalty', () => {
  it('C3340197: Should be able to rent with loyalty', { tags: ['@tier1'] }, () => {
    const loyalty = 'Alamo';
    const policy = 'In-policy';
    const filterType1 = 'agencyFilter';
    const filterType2 = 'moreFilter';
    RentalCarUtility.prepareUsers(User_Type.TRAVELER);
    LoyaltyPrograms.visitProfileLoyaltyPrograms();
    LoyaltyPrograms.addLoyaltyToUser(loyalty, 'car');
    RentalCar.visitRentalCarSearch('Business');
    RentalCar.selectPickUpLocation(LocationUtility.getRentalCarAirportUS());
    RentalCar.setPickUpAndDropOffDate();
    RentalCar.searchRentalCar();
    RentalCarFilters.selectFilterType(filterType1, loyalty);
    RentalCarFilters.selectFilterType(filterType2, policy);
    RentalCarSearchResults.selectCar();
    RentalCarCheckout.waitToBeLoaded();
    RentalCarCheckout.setTripInfo();
    RentalCarCheckout.expectLoyaltyToBeApplied(loyalty);

    RentalCarCheckout.setAcknowledgement();
    RentalCarCheckout.checkOutCar();
    RentalCarCheckout.expectRentalCarBookingSuccessfully('Car confirmed!');

    Trips.visitTripsPage();
    Trips.selectTrip();
    Trips.expectLoyaltyToBeApplied(loyalty);
    Trips.expectDriverNameIsCorrect();
  });
});
