UNPKG

qe-fe-automation

Version:
60 lines (49 loc) 2.2 kB
import { GrowthInterceptApis } from '@growth-lib/api-intercept'; import { LoginSelfSell } from '@support-growth/login-self-sell'; import { SignUp } from '@growth-lib/sign-up'; import { SignupReason } from '@growth-lib/persona'; import { AmplitudeEvents } from '@growth-lib/amplitude-events'; import { ReferralsUtil } from '@growth-lib/referrals-util'; import { FreePricing } from '@growth-lib/free-pricing'; import { OnboardingGuide } from '@growth-lib/onboarding-guide'; import { Timeouts } from '@utility-lib/constants'; describe('Growth: referrals users', () => { let token: string; let referralCode: string; beforeEach(() => { GrowthInterceptApis.interceptApis(); LoginSelfSell.createNewSelfSellLead({ tag: 'referral-program', referralCode: referralCode }).then((login) => { token = login.token; }); }); it('C6823793: New user will get the option to refer a friend', { tags: ['@tier1'] }, () => { SignUp.signupWithSkipAdmin(token, SignupReason.TRAVEL_AND_EXPENSE_SOLUTION, false); FreePricing.openAdminClaim(); ReferralsUtil.openReferralPage(); ReferralsUtil.verifyReferralTabContent(); ReferralsUtil.getReferralLink().then((link) => { referralCode = (link as string).split('/').pop() as string; }); AmplitudeEvents.expectAmplitudeEventsToBeSent(); }); it('C13711821: sign up as an admin referred user', { tags: ['@tier1'] }, () => { assert(referralCode, 'Referral code is not set'); SignUp.signupWithSkipAdmin(token, SignupReason.TRAVEL_SOLUTION, false); FreePricing.openAdminClaim(); OnboardingGuide.closeOnboardingGuide(); ReferralsUtil.openReferralPage(); ReferralsUtil.verifyReferralTabContent(); ReferralsUtil.checkPendingState(); AmplitudeEvents.expectAmplitudeEventsToBeSent(); }); it('C13712241: sign up as a rogue referred user - check home screen popup', { tags: ['@tier1'] }, () => { assert(referralCode, 'Referral code is not set'); SignUp.signupWithSkipAdmin(token, SignupReason.BOOK_TRIP, false); cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout); ReferralsUtil.verifyRoguePopup(); AmplitudeEvents.expectAmplitudeEventsToBeSent(); }); });