UNPKG

qe-fe-automation

Version:
63 lines (57 loc) 2.09 kB
import { AdminInterceptsApis, LoginPage } from '@admin-lib/index'; import { HotelCheckout, HotelItinerary, Hotels, HotelSearchResults, HotelInterceptApis } from '@hotel-lib/index'; import { LocationUtility, Timeouts, Utility } from '@utility-lib/index'; import { User_Type } from '@support-onboard/index'; const newUserCredentials = Cypress.env('newUser').NEW_USER_PASSWORD; describe('Hotel: One traveller booking - localized', () => { it( 'C353625: de-DE user can book hotel with browser language DE', { tags: ['@tier1'] }, () => { LoginPage.createNewCompanyAndLoginWithUserByType({ users: [User_Type.TRAVELER], locale: 'de-DE' }); LoginPage.clearExistingLoginSession(); AdminInterceptsApis.interceptAdminsApis(); Utility.changeBrowserLanguageTo('de'); LoginPage.visitTALoginPage('Willkommen bei'); cy.task('getDataFromCache', 'userEmail').then((email: any) => { console.log('user: ' + email); LoginPage.loginWithCredentials(email, newUserCredentials); }); cy.wait(Timeouts.SHORT_TIMEOUT_5_SEC.timeout); bookHotel(); } ); }); function bookHotel(): void { HotelInterceptApis.interceptHotelApis(); Hotels.visitHotelSearchPage('Business'); Hotels.selectOneTraveller(); Hotels.setCheckInCheckOutDate(); Hotels.selectRoom(1); Hotels.selectHotelLocation(LocationUtility.getCityUS()); Hotels.searchHotel(); /* Revisit after fixing syncUrl with putDataInCache*/ // HotelSearchResults.selectAvailableRoom(); HotelSearchResults.selectHotel(0); HotelSearchResults.selectRoomOption(); //HotelCheckout.waitToBeLoaded(); HotelCheckout.checkForHotelCheckoutHeading(); HotelCheckout.setTripInfo(); HotelCheckout.acceptHotelBookingPolicy(); HotelCheckout.setPhoneNumber(); HotelCheckout.checkIfProofOfVaccineRequired(); HotelCheckout.acceptAcknowledgement(); HotelCheckout.bookNow(); HotelCheckout.expectHotelBookedSuccessfully('Hotelreservierung bestätigt'); HotelItinerary.waitToBeLoaded(); HotelItinerary.verifyHotelItineraryPage(); }