UNPKG

qe-fe-automation

Version:
86 lines (75 loc) 3.65 kB
import { Timeouts } from '@utility-lib/constants'; import { HomePage } from '@rebranded_home_page-lib/home-page'; import { OnboardingGuide } from '@growth-lib/onboarding-guide'; import { FreePricing } from '@growth-lib/free-pricing'; const promoBannerSelectors = { banner: '[data-testid="pricing-ad-banner"]', bannerTitle: '[data-testid="pricing-ad-banner-title"]', learnMoreButtonInBanner: '[data-testid="pricing-ad-banner-cta"]', learnMorePopupTitle: '[data-testid="pricing-ad-banner-title"]', learnMorePopupContent: '[data-testid="companySetup"]', learnMorePopupGotItButton: '.cta > .ta-button-v2', delegateCreateAccountCTA: '[data-testid="createCompanyAccountButton"] > .ta-button-v2', delegatePricingPageCTA: '.price-calculation__trip__start > [data-testid="companySetup"] > .ta-button-v2', createAccountButton: '[data-testid="primaryActionButton"]', rewardsBfoPromoText: '.ta-rewards-history__event-column_description-container > div', rewardsBfoPromoAmount: '.ta-rewards-history__transaction-row > .ta-rewards-history__amount-column', rewardsPromoText: ':nth-child(2) > .ta-rewards-history__event-column > .ta-rewards-history__event-column_container > .ta-rewards-history__event-column_description-container > div', rewardsPromoAmount: ':nth-child(2) > .ta-rewards-history__amount-column' }; export class PromoBanner { static clickTheBannerLearnMoreButton(): void { cy.allure().logStep('Click the promo banner learn more button'); cy.get(promoBannerSelectors.learnMoreButtonInBanner).click(); } static verifyBannerTitle(): void { cy.allure().logStep('Verify promo banner title'); cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); cy.get(promoBannerSelectors.bannerTitle).should('be.visible'); cy.get(promoBannerSelectors.bannerTitle).contains('Get that OOO email ready!'); } static verifyLearnMorePopupTitle(): void { cy.allure().logStep('Verify learn more popup'); cy.get(promoBannerSelectors.learnMorePopupTitle).should('be.visible'); cy.get(promoBannerSelectors.learnMorePopupContent).should('be.visible'); } static verifyLearnMorePopupContent(): void { cy.allure().logStep('Verify learn more popup'); cy.get(promoBannerSelectors.learnMorePopupTitle).should('be.visible'); cy.get(promoBannerSelectors.learnMorePopupContent).should('be.visible'); } static clickGotItInPopup(): void { cy.allure().logStep('Verify learn more popup'); cy.get(promoBannerSelectors.learnMorePopupGotItButton).click(); } static goToBFOTravelAdminPolicyPage(): void { cy.allure().logStep('Go to BFO Travel Admin Policy Page'); cy.visit('/app/company/policy/delegate'); cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); } static BfoClaimAdmin(): void { cy.allure().logStep('BFO Claim Admin'); HomePage.visitHomePage(); cy.get(promoBannerSelectors.createAccountButton).click(); FreePricing.openAdminClaim(); } static verifyRewardsForBFO(): void { cy.allure().logStep('Verify Rewards for BFO'); cy.visit('/app/user2/profile?tab=rewards'); OnboardingGuide.closeOnboardingGuide(); cy.get(promoBannerSelectors.rewardsBfoPromoText).should('be.visible').contains('1stBookingForOthers'); cy.get(promoBannerSelectors.rewardsBfoPromoAmount) .should('be.visible') .invoke('text') .then((text) => { expect(text).to.include('$250.00'); }); } static verifyBannerAndPopupInHomePage(): void { cy.allure().logStep('Verify promo banner and learn more popup on home page'); this.verifyBannerTitle(); this.clickTheBannerLearnMoreButton(); this.clickGotItInPopup(); } }