UNPKG

qe-fe-automation

Version:
650 lines (617 loc) 26.5 kB
import { guidRegex, Utility, Timeouts, dateFormatPattern } from '@utility-lib/index'; import { HotelItinerary } from '@hotel-lib/index'; import { localizationData } from '@fixtures/commerce/localization_data'; import { xmlEu } from '@fixtures/commerce/xml/xml_eu'; import { CommerceShared } from '@commerce-shared-lib/index'; const german = localizationData.german; const french = localizationData.french; const germanLanguage = 'German (Deutsch)'; const frenchLanguage = 'French (Français)'; const english = localizationData.english; const xmldata = xmlEu.xmlDataFlight; const cacheKey = xmldata.cacheKey; const hotelInvoiceValidationSelectors = { viewItinerary: '[class^="bookings-hotel-card__view"]', clickInvoiceTab: '.nav-item__wrapper:nth-child(2) span', bookingCard: '.ta-booking-card', viewInvoice: '[qa-id="event-action-view-invoice"]', downloadInvoice: '.action--change-v2', hotelBookingId: '[class="ta-trip-event-hotel-booking__row ta-trip-event-hotel-booking__button-gap"]', totalPrice: '[qaid="hotelItineraryTotalPrice"] span', hotelName: '.ta-trip-event-hotel-details__title', invoiceBookingId: '[data-testid="bookingId"]', invoiceFlightName: '[qaid="provider-name"]', invoiceTotalPrice: '[data-testid="totalTotal"]', invoicePriceTaxRate: '[data-testid="priceTaxRate"]', invoicePriceTax: '[data-testid="priceTax"]', invoiceHotelName: '[data-testid="hotelName"]', hotelCheckoutPageTripFee: '[qaid="hotelCheckoutSummaryTripFee"] .charge-item__amount', totalBookingCharge: '.hotel-in-this-booking__bold .hotel-in-this-booking__breakdown__total--amount', totalBookingChargeCurrency: '.hotel-in-this-booking__bold .hotel-in-this-booking__breakdown__currency', tripFeeSummaryOfCharges: "//*[@title='Trip fee']", menuButton: '[data-qaid="USER_MENU-button"]', languageMenuItem: '[qaid="LANGUAGE-menu-item"]', updateLanguage: '[class="ta-button ta-button--medium-size ta-button--primary-color ta-button--primary-theme"]', hotelType: '[class="ta-trip-event-hotel-booking__column ta-trip-event-hotel-booking__labels"]', invoiceType: '[data-testid="subtitle"]', invoiceTitle: '[data-testid="title"]', invoicePaymentMethodLabel: '[class="payment-label text-left border-bottom pb8"]', invoiceInTotal: '[class="fw-600 font-big"]', invoiceTripFeeDes: '[data-testid="priceDescription"]', downloadInvoiceLink: '[qa-id="event-action-download-invoice"]', checkOut: '.hotel-in-this-booking__breakdown__check-out .hotel-in-this-booking__medium', checkIn: '.hotel-in-this-booking__breakdown__check-in .hotel-in-this-booking__medium', duration: '.hotel-in-this-booking__breakdown__duration .hotel-in-this-booking__medium', noOfGuests: '.hotel-in-this-booking__breakdown__guests .hotel-in-this-booking__medium', noOfRooms: '.hotel-in-this-booking__breakdown__room-nums .hotel-in-this-booking__medium', pricePerNight: 'ta-charge-item[qaid="hotelCheckoutSummaryPriceNight"] .charge-item__amount' }; export class HotelInvoiceValidation { static visitTripsPage() { CommerceShared.visitTripsPage(); } static selectHotelBooking() { cy.allure().logStep(`Select Hotel and View Itinerary :`); cy.intercept( 'GET', new RegExp(`/api/admin/bookings/${guidRegex}/passengers/${guidRegex}/tripItem`) ).as('request'); cy.get(hotelInvoiceValidationSelectors.bookingCard).should('be.visible'); cy.get(hotelInvoiceValidationSelectors.viewItinerary).eq(0).click(); cy.wait('@request') .its('response') .then((response) => { expect(response?.statusCode).to.eq(200); }); } static checkItineraryPageIsVisited() { cy.allure().logStep(` Routing to Itinerary Page :`); cy.url().should( 'include', `/app/user2/trips/${guidRegex}/itinerary?hotelUuid=${guidRegex}` ); } static storeBookingData() { cy.log('Store booking price and fees on Checkout Page'); cy.get(hotelInvoiceValidationSelectors.totalBookingCharge).then((element) => { cy.task('putDataInCache', { key: 'totalBookingCharge', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.totalBookingChargeCurrency).then((element) => { cy.task('putDataInCache', { key: 'totalBookingChargeCurrency', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.checkIn).then((element) => { cy.task('putDataInCache', { key: 'checkIn', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.checkOut).then((element) => { cy.task('putDataInCache', { key: 'checkOut', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.duration).then((element) => { cy.task('putDataInCache', { key: 'duration', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.noOfRooms).then((element) => { cy.task('putDataInCache', { key: 'noOfRooms', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.noOfGuests).then((element) => { cy.task('putDataInCache', { key: 'noOfGuests', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.pricePerNight).then((element) => { const pricePerNight = element .text() .trim() .replace(/[^0-9.]/g, ''); cy.task('putDataInCache', { key: 'pricePerNight', data: pricePerNight }); }); } static storeTripData() { cy.wait(Timeouts.SHORT_TIMEOUT_5_SEC.timeout); cy.reload(); cy.get(hotelInvoiceValidationSelectors.hotelBookingId) .eq(0) .then((element) => { cy.task('putDataInCache', { key: 'bookingID', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.hotelName).then((element) => { cy.task('putDataInCache', { key: 'hotelName', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.totalPrice) .eq(0) .then((element) => { cy.task('putDataInCache', { key: 'totalPrice', data: element.text().trim() }); }); cy.get(hotelInvoiceValidationSelectors.hotelType).then((element) => { cy.task('putDataInCache', { key: 'hotelType', data: element.text().trim() }); }); cy.url().then((url) => { const getUrl = url; cy.log('<<< Hotel Itinerary URL is >>>: ' + getUrl); cy.task('putDataInCache', { key: 'ItineraryURL', data: getUrl }); }); } static downloadInvoicePDF() { cy.allure().logStep(` Download Invoice PDF :`); HotelItinerary.reloadItineraryPage(); cy.wait('@waitForInvoiceSyncStatus'); cy.get(hotelInvoiceValidationSelectors.downloadInvoice) .eq(1) .then((ele) => { cy.wrap(ele).scrollIntoView(); cy.wrap(ele).should('be.visible'); cy.wrap(ele).click(); }); cy.wait(Timeouts.SHORT_TIMEOUT_5_SEC.timeout); } static visitViewInvoicePage() { HotelItinerary.reloadItineraryPage(); cy.reload(); cy.allure().logStep(` Go to view invoice page :`); CommerceShared.visitViewInvoicePage(); } static checkInvoiceBookingId() { cy.allure().logStep(` Check booking Id :`); cy.task<string>('getDataFromCache', 'bookingID').then((hotelBookingId) => { cy.contains(hotelBookingId); }); } static checkInvoiceHotelName() { cy.allure().logStep(` Check Hotel name :`); cy.task<string>('getDataFromCache', 'hotelName').then((hotelName) => { cy.contains(hotelName); }); } static checkInvoiceTotalPrice() { cy.allure().logStep(` Check total price :`); cy.task<string>('getDataFromCache', 'totalPrice').then((totalPrice) => { cy.contains(totalPrice); }); } static checkInvoiceTAFee() { cy.task<string>('getDataFromCache', 'tripFee').then((tripFee) => { cy.allure().logStep(` Check TripActions Fee :`); cy.contains(tripFee); }); } static checkInvoicePriceSalesTaxRate(index: number) { cy.allure().logStep(` ChCheck Invoice Price Tax Rate :`); cy.task('getDataFromCache', 'invoicePriceTaxRate').then((invoicePriceTaxRate) => { Utility.getIframeBody() .find(hotelInvoiceValidationSelectors.invoicePriceTaxRate) .eq(index) .should(($el) => { expect($el.text().trim()).to.equal(invoicePriceTaxRate); }); }); } static checkInvoicePriceSalesTax(index: number) { cy.allure().logStep(` Check Invoice Price Tax :`); cy.task('getDataFromCache', 'invoicePriceTax').then((invoicePriceTax) => { Utility.getIframeBody() .find(hotelInvoiceValidationSelectors.invoicePriceTax) .eq(index) .should(($el) => { expect($el.text().trim()).to.equal(invoicePriceTax); }); }); } static checkTripFeeInCheckoutPageSummary(fee: string) { cy.log('Check fee on Checkout Page'); cy.get(hotelInvoiceValidationSelectors.hotelCheckoutPageTripFee) .should('contain', fee) .should('be.exist'); } static checkBookingTotalPrice() { cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); cy.allure().logStep(` Check Booking Total Price :`); cy.task('getDataFromCache', 'totalBookingChargeCurrency') .then((ele) => { cy.wrap(ele).scrollIntoView(); }) .then((totalPrice) => { cy.find(hotelInvoiceValidationSelectors.totalPrice).should(($el) => { expect($el.text().trim()).to.equal(totalPrice); }); }); } static selectLanguage(language: string) { cy.log('Select Language '); cy.allure().logStep(` Select Language :`); HotelItinerary.reloadItineraryPage(); cy.get(hotelInvoiceValidationSelectors.hotelBookingId).should('be.visible'); cy.get(hotelInvoiceValidationSelectors.menuButton).click(); cy.get(hotelInvoiceValidationSelectors.languageMenuItem).click(); cy.contains(language).click(); cy.get(hotelInvoiceValidationSelectors.updateLanguage).click(); cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); cy.reload(); } static checkInvoiceTripeFeeLocalizationData(language: string) { cy.allure().logStep(` Check trip fee invoice localization data :`); if (language === germanLanguage) { cy.contains(german.TaxInvoice); cy.contains(german.NavanFee); cy.contains(german.NavanTripFee); cy.contains(german.PaymentMethod); cy.contains(german.InTotal); } else if (language === frenchLanguage) { cy.contains(french.TaxInvoice); cy.contains(french.NavanFee); cy.contains(french.PaymentMethod); cy.contains(french.InTotal); } } static checkHotelInvoiceLocalizationData(language: string) { cy.allure().logStep(` Check Hotel Type :`); cy.task<string>('getDataFromCache', 'hotelType').then((hotelType) => { cy.log( ` Check Hotel Type :**********************************************` + hotelType ); if (language === germanLanguage) { if (hotelType.includes(german.TotalPrice)) { cy.contains(german.PayNowHotelReceipt); cy.contains(german.PayNow); cy.contains(german.PaymentMethod); cy.contains(german.InTotal); } else { cy.contains(german.EstimatedHotelCharges); cy.contains(german.PayLater); cy.contains(german.ReservationMethod); cy.contains(german.EstimatedTotal); } } else if (language === frenchLanguage) { if (hotelType.includes(french.TotalPrice)) { cy.contains(french.PayNowHotelReceipt); cy.contains(french.PayNow); cy.contains(french.PaymentMethod); cy.contains(french.InTotal); } else { cy.contains(french.EstimatedHotelCharges); cy.contains(french.PayLater); cy.contains(french.ReservationMethod); cy.contains(french.EstimatedTotal); } } }); } static checkHotelUnchangeabilityData() { cy.allure().logStep(` Check Hotel Unchangeability Invoice content :`); cy.contains(english.Cancelled); cy.contains(english.HotelReceipt); cy.contains(english.PaymentMethod); cy.contains(english.address); cy.contains(english.VAT_Disclosure); cy.contains(english.CorrectionOf); cy.contains(english.CorrectionReceipt); cy.contains(english.CreditNote); cy.contains(english.TaxInvoice); cy.contains(english.TripFeeCancel); } static clickAndDownloadInvoice() { cy.allure().logStep(` Go to view invoice page :`); cy.reload(); cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); cy.get(hotelInvoiceValidationSelectors.downloadInvoiceLink).as('downloadInvoiceLink'); cy.get('@downloadInvoiceLink').scrollIntoView(); cy.get('@downloadInvoiceLink').click(); cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); } static hotelXmlContentValidations() { Utility.getXmlContentFromCache(cacheKey).then((xmlContent: any) => { const xmlDoc = Utility.parseXmlContent(xmlContent); //TransAmtValue is total charges cy.task('getDataFromCache', 'totalBookingCharge').then((totalCharge: any) => { const transAmtElements = xmlDoc.getElementsByTagName('TransAmt'); if (transAmtElements.length >= 2) { const transAmtFirstElement = transAmtElements[0]; const transAmtFirstValue = parseFloat(transAmtFirstElement.textContent || '0'); const transAmtSecondElement = transAmtElements[1]; const transAmtSecondValue = parseFloat( transAmtSecondElement.textContent || '0' ); const totalCharges = transAmtFirstValue + transAmtSecondValue; const strippedAmount = totalCharge.replace(/[^0-9]/g, ''); expect(strippedAmount).to.contains(totalCharges); } else { cy.log('TransAmt is not present in XML'); } //BtchDbTot is total charges const btchDbTotElement = xmlDoc.getElementsByTagName('BtchDbTot')[0]; const btchDbTotValue = parseFloat(btchDbTotElement.textContent || '0'); const strippedAmount = totalCharge.replace(/[^0-9]/g, ''); expect(strippedAmount).to.contains( btchDbTotValue, 'BtchDbTot is equal to total charges' ); //BtchTot is total charges const btchTotElement = xmlDoc.getElementsByTagName('BtchTot')[0]; const btchTotValue = parseFloat(btchTotElement.textContent || '0'); expect(strippedAmount).to.contains( btchTotValue, 'BtchTot is equal to total charges' ); //TravelTranTot is total charges const travelTranDbTotElement = xmlDoc.getElementsByTagName('TravelTranDbTot')[0]; const travelTranDbTotValue = parseFloat( travelTranDbTotElement.textContent || '0' ); expect(strippedAmount).to.contains( travelTranDbTotValue, 'TravelTranDbTot is equal to total charges' ); //TravelTranTot is total charges const travelTranTotElement = xmlDoc.getElementsByTagName('TravelTranTot')[0]; const travelTranTotValue = parseFloat(travelTranTotElement.textContent || '0'); expect(strippedAmount).to.contains( travelTranTotValue, 'TravelTranTot is equal to total charges' ); }); //commodityCdValue for flight is 004 or 009 const commodityCdElement = xmlDoc.getElementsByTagName('CommodityCd')[0]; const commodityCdValue = commodityCdElement.textContent; if (commodityCdValue !== null && commodityCdValue !== undefined) { expect( commodityCdValue.trim() === xmldata.CommodityCdHotel || commodityCdValue === xmldata.CommodityCdTripFee ).to.be.true; } else { cy.log('CommodityCdValue is null or undefined'); } // SuplrNm Value is hotelName cy.task('getDataFromCache', 'hotelName').then((hotelName: any) => { const suplrNmElement = xmlDoc.getElementsByTagName('SuplrNm')[0]; const suplrNmCdValue = suplrNmElement.textContent; if (suplrNmCdValue) { // Remove special characters from hotelName and suplrNmCdValue const cleanHotelName = hotelName.replace(/[^\w\s]/gi, ''); const cleanSuplrNmCdValue = suplrNmCdValue.replace(/[^\w\s]/gi, ''); expect(cleanHotelName).to.include( cleanSuplrNmCdValue, 'SuplrNm is equal to hotelName' ); } else { cy.log('SuplrNm is null or undefined'); } }); //commodityCdValue for trip fee is 004 or 009 const commodityCdElementFee = xmlDoc.getElementsByTagName('CommodityCd')[1]; const commodityCdValueFee = commodityCdElementFee.textContent; if (commodityCdValueFee !== null && commodityCdValueFee !== undefined) { expect( commodityCdValueFee.trim() === xmldata.CommodityCdHotel || commodityCdValueFee === xmldata.CommodityCdTripFee ).to.be.true; } else { cy.log('CommodityCdValue is null or undefined'); } //chkInDtValue Value is YYYYMMDD const chkInDtElement = xmlDoc.getElementsByTagName('ChkInDt')[0]; const chkInDtValue = chkInDtElement.textContent; if (chkInDtValue !== null && chkInDtValue !== undefined) { expect(chkInDtValue.trim()).to.match(dateFormatPattern); } else { cy.log('chkInDtValue is not in YYYYMMDD format'); } //ChkOutDt Value is YYYYMMDD const chkOutDtElement = xmlDoc.getElementsByTagName('ChkOutDt')[0]; const chkOutDtValue = chkOutDtElement.textContent; if (chkOutDtValue !== null && chkOutDtValue !== undefined) { expect(chkOutDtValue.trim()).to.match(dateFormatPattern); } else { cy.log('chkInDtValue is not in YYYYMMDD format'); } cy.task('getDataFromCache', 'duration').then((duration: any) => { //NightCnt Value is duration const noOfNights = parseInt(duration.match(/\d+/)[0], 10); const nightCntElement = xmlDoc.getElementsByTagName('NightCnt')[0] || '0'; const nightCntValue = parseFloat(nightCntElement.textContent || '0'); expect(noOfNights).to.equal(nightCntValue, 'NightCnt is equal to duration'); }); cy.task('getDataFromCache', 'pricePerNight').then((pricePerNight: any) => { //DayRate is price per night const dayRateElement = xmlDoc.getElementsByTagName('DayRate')[0]; const dayRateValue = parseFloat(dayRateElement.textContent || '0'); const dayRate = parseFloat(pricePerNight.replace(/[^0-9]/g, '') || '0'); expect(dayRate).to.equal(dayRateValue, 'DayRate is equal to price per night'); }); }); } static hotelCurrencyCodeXmlContentValidations() { cy.allure().logStep('Get Currency XML content from cache'); Utility.getXmlContentFromCache(cacheKey).then((xmlContent: any) => { const xmlDoc = Utility.parseXmlContent(xmlContent); cy.task('getDataFromCache', 'totalBookingChargeCurrency').then( (hotelCurrency: any) => { //CurrencyCd is currency code const currencyCdElement = xmlDoc.getElementsByTagName('CurrencyCd')[0]; const currencyCdValue = currencyCdElement.textContent; expect(hotelCurrency).to.equal( currencyCdValue, 'CurrencyCd is equal to totalBookingChargeCurrency' ); //TrvlBtchCurrCd is currency code const trvlBtchCurrCdElement = xmlDoc.getElementsByTagName('TrvlBtchCurrCd')[0]; const trvlBtchCurrCdValue = trvlBtchCurrCdElement.textContent; expect(hotelCurrency).to.equal( trvlBtchCurrCdValue, 'TrvlBtchCurrCd is equal to totalBookingChargeCurrency' ); } ); }); } static hotelPaymentXmlContentValidations() { cy.allure().logStep('Get Hotel Payment XML content from cache'); Utility.getXmlContentFromCache(cacheKey).then((xmlContent: any) => { const xmlDoc = Utility.parseXmlContent(xmlContent); //AcctNbr Value is account number const acctNbrElement = xmlDoc.getElementsByTagName('AcctNbr')[0]; const acctNbrdValue = acctNbrElement.textContent; expect(xmldata.AcctNbr).to.equal( acctNbrdValue, 'AcctNbr is equal to account number' ); //CrdExpDt Value is expiry date const crdExpDtElement = xmlDoc.getElementsByTagName('CrdExpDt')[0]; const crdExpDt = crdExpDtElement.textContent; expect(xmldata.AMEXCrdExpDt).to.equal(crdExpDt, 'CrdExpDt is equal to expiry date'); //amexOfcNbrValue is 032581516 const amexOfcNbrElement = xmlDoc.getElementsByTagName('AmexOfcNbr')[0]; const amexOfcNbr = amexOfcNbrElement.textContent; expect(xmldata.AmexOfcNbr).to.equal(amexOfcNbr, 'AmexOfcNbr is equal to 032581516'); //amexAgcyNbrValue is TQ42 const amexAgcyNbrElement = xmlDoc.getElementsByTagName('AmexAgcyNbr')[0]; const amexAgcyNbrValue = amexAgcyNbrElement.textContent; expect(xmldata.AmexAgcyNbr).to.equal( amexAgcyNbrValue, 'AmexAgcyNbr is equal to TQ42' ); }); } static hotelTravelerXmlContentValidations() { cy.allure().logStep('Get hotel Traveler XML content from cache'); Utility.getXmlContentFromCache(cacheKey).then((xmlContent: any) => { const xmlDoc = Utility.parseXmlContent(xmlContent); //TravelDbCrInd Value is D const travelDbCrIndElement = xmlDoc.getElementsByTagName('TravelDbCrInd')[0]; const travelDbCrIndValue = travelDbCrIndElement.textContent; expect(xmldata.TravelDbCrInd).to.equal( travelDbCrIndValue, 'TravelDbCrInd is equal to travelDbCrIndValue' ); //TODO: This is we have defect (showing booker details instead of traveler) once that is fixed we uncomment this code: CM2-8916 //CustRefTx Value is traveler name and it should be present in TvlrFirstNm and TvlrLastNm /* cy.task('getDataFromCache','travelerName').then((travelerName:any)=>{ const custRefTxElement = xmlDoc.getElementsByTagName('CustRefTx')[0]; const custRefTxValue = custRefTxElement.textContent; expect(custRefTxValue).to.equal(travelerName,'CustRefTx is equal to travelerName'); const tvlrFirstNmElement = xmlDoc.getElementsByTagName('TvlrFirstNm')[0]; const tvlrFirstNmValue = tvlrFirstNmElement.textContent; expect(travelerName).to.contains(tvlrFirstNmValue,'TvlrFirstNm is equal to travelerName'); const tvlrLastNmElement = xmlDoc.getElementsByTagName('TvlrLastNm')[0]; const tvlrLastNmValue = tvlrLastNmElement.textContent; expect(travelerName).to.contains(tvlrLastNmValue,'TvlrLastNm is equal to travelerName'); })*/ //travelTranDbCntValue id Debit transaction count const travelTranDbCntElement = xmlDoc.getElementsByTagName('TravelTranDbCnt')[0]; const travelTranDbCntValue = travelTranDbCntElement.textContent; if (travelTranDbCntValue !== null) { expect(parseInt(travelTranDbCntValue)).to.be.at.least( 1, 'TravelTranDbCnt is equal to or greater than 1' ); } else { cy.log('TravelTranDbCnt is not found'); } //travelTranCrCntValue Value is Credit transaction count const travelTranCrCntElement = xmlDoc.getElementsByTagName('TravelTranCrCnt')[0]; const travelTranCrCntValue = travelTranCrCntElement.textContent; expect(xmldata.TravelTranCrCnt).to.equal( travelTranCrCntValue, 'TravelTranCrCnt is equal to travelTranCrCntValue' ); //SettleDbCrInd Value is D const settleDbCrIndElement = xmlDoc.getElementsByTagName('SettleDbCrInd')[0]; const settleDbCrIndValue = settleDbCrIndElement.textContent; expect(xmldata.TravelDbCrInd).to.equal( settleDbCrIndValue, 'SettleDbCrInd is equal to travelDbCrIndValue' ); }); } static HotelBatchXmlContentValidations() { cy.allure().logStep('Get Batch XML content from cache'); Utility.getXmlContentFromCache(cacheKey).then((xmlContent: any) => { const xmlDoc = Utility.parseXmlContent(xmlContent); //BtchSeqNbrValue is 8 digit number const btchSeqNbrElement = xmlDoc.getElementsByTagName('BtchSeqNbr')[0]; const btchSeqNbrValue = btchSeqNbrElement.textContent; if (btchSeqNbrValue !== null && btchSeqNbrValue !== undefined) { expect(btchSeqNbrValue.trim().length).to.equal(8); } else { cy.log('BtchSeqNbrValue is null or undefined'); } // btchCrCnValue is 0 const btchCrCntElement = xmlDoc.getElementsByTagName('BtchCrCnt')[0]; const btchCrCntValue = btchCrCntElement.textContent; expect(xmldata.BtchCrCnt).to.equal( btchCrCntValue, 'BtchCrCnt is equal to btchCrCntValue' ); //TrvlBtchCnt Value is traveler count const trvlBtchCntElement = xmlDoc.getElementsByTagName('TrvlBtchCnt')[0]; const trvlBtchCntValue = trvlBtchCntElement.textContent; if (trvlBtchCntValue !== null) { expect(parseInt(trvlBtchCntValue)).to.be.at.least( 1, 'trvlBtchCntValue is equal to or greater than 1' ); } else { cy.log('trvlBtchCntValue is not found'); } //btchCnt Value is 2 const btchCntElement = xmlDoc.getElementsByTagName('BtchCnt')[0]; const btchCntValue = btchCntElement.textContent; if (btchCntValue !== null) { expect(parseInt(btchCntValue)).to.be.at.least( 1, 'btchCntValue is equal to or greater than 1' ); } else { cy.log('btchCntValue is not found'); } //BtchDbCrInd Value is D const btchDbCrIndElement = xmlDoc.getElementsByTagName('BtchDbCrInd')[0]; const btchDbCrIndValue = btchDbCrIndElement.textContent; expect(xmldata.BtchDbCrInd).to.equal( btchDbCrIndValue, 'BtchDbCrInd is equal to btchDbCrIndValue' ); //BtchCrTot Value is 0 const btchCrTotElement = xmlDoc.getElementsByTagName('BtchCrTot')[0]; const btchCrTotValue = btchCrTotElement.textContent; expect(xmldata.BtchCrCnt).to.equal( btchCrTotValue, 'BtchCrTot is equal to btchCrTotValue' ); }); } }