UNPKG

qe-fe-automation

Version:
85 lines (80 loc) 3.46 kB
import { LoginPage } from '@admin-lib/index'; import { HomePage } from '@rebranded_home_page-lib/home-page'; import { PersonalHomeScreen } from '../../lib/personal_homescreen'; import { RentalCarInterceptApis } from '@rentalCar-lib/api-intercept'; import { ProfileInterceptApis } from '@profile-lib/api-intercept'; import { User_Type } from '@support-onboard/data_model/user_type'; import { Utility } from '@utility-lib/utility'; import { PersonalTravel } from '../../lib/travel'; import { GuestTravelInfo } from '@profile-lib/guest-travel-info'; import { createGuestDetails } from '@user-lib/factory/guest_user'; import { UserModal } from '@profile-lib/user-modal'; import { Profile } from '../../lib/profile'; describe('Personal Travel: Bookableuser Api', () => { beforeEach(() => { LoginPage.createNewCompanyAndLoginWithUserByType({ users: [User_Type.ADMIN], companySuffix: 'rewardspt' }); cy.task('getDataFromCache', 'userResponse').then((response: any) => { cy.addNewTraveler(response.companyDomain); }); HomePage.verifyMinimizedSearch(); PersonalHomeScreen.switchToPersonalTravel(); RentalCarInterceptApis.interceptRentalCarApis(); ProfileInterceptApis.interceptProfileApis(); GuestTravelInfo.interceptApis(); UserModal.interceptApis(); }); it( 'C13621605: Verify traveler cannot search for business users on personal search landing', { tags: ['@tier1'] }, () => { Utility.selectVertical('car'); PersonalTravel.removeTravelerFromSearch(); PersonalTravel.getDataFromCachedAdminUserAndSearch(); PersonalTravel.verifyNoTravelerInSearch(" Can't find matching traveler. "); } ); it( 'C13621606: Verify traveler cannot search for business guests on personal search landing', { tags: ['@tier1'] }, () => { const guestDetails = createGuestDetails(40, 'FEMALE', 'Business'); cy.task('putDataInCache', { key: 'guestEmail', data: guestDetails.email }); cy.task('getDataFromCache', 'guestEmail').then((email: any) => { GuestTravelInfo.visitPage(); GuestTravelInfo.waitToBeLoaded(); Profile.switchGuestTravelerTab(' Business guest travelers '); Profile.openNewGuestModal(); Profile.createBusinessUser(guestDetails); HomePage.visitHomePage(); PersonalHomeScreen.switchToPersonalTravel(); Utility.selectVertical('car'); PersonalTravel.removeTravelerFromSearch(); PersonalTravel.changeTravelerAtSearch(email); PersonalTravel.verifyNoTravelerInSearch(" Can't find matching traveler. "); }); } ); it( 'C13621607: Verify traveler can search for personal guests on personal search landing', { tags: ['@tier1'] }, () => { const guestDetails = createGuestDetails(30, 'MALE', 'Personal'); cy.task('putDataInCache', { key: 'guestEmail', data: guestDetails.email }); cy.task('getDataFromCache', 'guestEmail').then((email: any) => { GuestTravelInfo.visitPage(); GuestTravelInfo.waitToBeLoaded(); Profile.openNewGuestModal(); Profile.createPersonalUser(guestDetails); HomePage.visitHomePage(); PersonalHomeScreen.switchToPersonalTravel(); Utility.selectVertical('car'); PersonalTravel.removeTravelerFromSearch(); PersonalTravel.changeTravelerAtSearch(email); PersonalTravel.verifyTravelerInSearch(email); }); } ); });