Exemplo n.º 1
0
        // This method verifies affiliates program
        public bool VerifyAffiliateProgramFunctionality(IWebDriver driver, string verificationLevel)
        {
            var    flag = false;
            int    initialAffiliates;
            string registeredUser;
            string affiliateTagURL;
            int    affiliatesAfterUserRegistration;

            UserFunctions        userFunctions           = new UserFunctions(logger);
            AdminFunctions       objAdminFunctions       = new AdminFunctions(logger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                //  This method selects the Affiliate Program link from User Settings page
                SelectAffiliateProgram();
                // Get existing number of affilites for the logged in user
                initialAffiliates = GetnumberOfAffiliates(driver);
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramInitialAffiliates, initialAffiliates));
                // Copy the affiliate tag URL and navigate to the URL
                UserSetFunctions.Click(CopyAffiliateTagButton());
                affiliateTagURL = AffiliateTagDesc().Text;
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramURLCopied, affiliateTagURL));
                userFunctions.LogOut();
                driver.Navigate().GoToUrl(affiliateTagURL);
                // Change the server URL
                userFunctions.LogIn(logger, changeServerOnly: true);

                // Register a new user
                registeredUser = userFunctions.RegisterNewUser(driver);

                // Login as Admin and complete KYC of the registered user
                try
                {
                    objAdminFunctions.AdminLogIn(logger);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCStarted, registeredUser));
                    objAdminCommonFunctions.ClickOnUsersMenuLink();
                    objAdminCommonFunctions.SelectUserFromUserList(driver, registeredUser);
                    // Edit the User Email Verified status to checked
                    objAdminCommonFunctions.EditUserEmailStatus(registeredUser);
                    // Scroll don to User Accounts section and open the user account
                    UserCommonFunctions.ScrollingDownVertical(driver);
                    objAdminCommonFunctions.OpenAccountFromUserPage();
                    // Edit the Verification Level of the user to 3
                    objAdminCommonFunctions.EditUserVerificationLevel(verificationLevel);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCSuccess, registeredUser));
                    objAdminCommonFunctions.UserMenuBtn();
                    objAdminFunctions.AdminLogOut();
                }
                catch (Exception)
                {
                    logger.TakeScreenshot();
                    logger.LogCheckPoint(String.Format(LogMessage.KYCFailure, registeredUser));
                    throw;
                }

                // Login as the user and verify the number of affiliates
                userFunctions.LogIn(logger, Const.USER12);
                SelectAffiliateProgram();
                affiliatesAfterUserRegistration = GetnumberOfAffiliates(driver);
                // The number of affiliates should increase by 1 -> Return true
                if ((affiliatesAfterUserRegistration - initialAffiliates) == 1)
                {
                    flag = true;
                    logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramFinalAffiliates, affiliatesAfterUserRegistration));
                }
            }
            catch (NoSuchElementException)
            {
                logger.TakeScreenshot();
                throw;
            }
            catch (Exception)
            {
                logger.TakeScreenshot();
                throw;
            }
            return(flag);
        }
Exemplo n.º 2
0
        // This method verifies affiliates program
        public bool VerifyAffiliateProgramFunctionality(IWebDriver driver, string verificationLevel)
        {
            var    flag = false;
            int    initialAffiliates;
            string registeredUser;
            string affiliateTagURL;

            UserFunctions        userFunctions           = new UserFunctions(logger);
            AdminFunctions       objAdminFunctions       = new AdminFunctions(logger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                SelectAffiliateProgram();
                initialAffiliates = GetnumberOfAffiliates(driver);
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramInitialAffiliates, initialAffiliates));
                UserSetFunctions.Click(CopyAffiliateTagButton());
                affiliateTagURL = AffiliateTagDesc().Text;
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramURLCopied, affiliateTagURL));
                userFunctions.LogOut();
                driver.Navigate().GoToUrl(affiliateTagURL);
                userFunctions.LogIn(logger, changeServerOnly: true);

                // Register a new user
                registeredUser = userFunctions.RegisterNewUser(driver);

                // Login as Admin and complete KYC of the registered user
                try
                {
                    objAdminFunctions.AdminLogIn(logger);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCStarted, registeredUser));
                    objAdminCommonFunctions.ClickOnUsersMenuLink();
                    objAdminCommonFunctions.SelectUserFromUserList(driver, registeredUser);
                    objAdminCommonFunctions.EditUserEmailStatus(registeredUser);
                    UserCommonFunctions.ScrollingDownVertical(driver);
                    objAdminCommonFunctions.OpenAccountFromUserPage();
                    objAdminCommonFunctions.EditUserVerificationLevel(verificationLevel);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCSuccess, registeredUser));
                    objAdminCommonFunctions.UserMenuBtn();
                    objAdminFunctions.AdminLogOut();
                }
                catch (Exception e)
                {
                    logger.TakeScreenshot();
                    logger.LogCheckPoint(String.Format(LogMessage.KYCFailure, registeredUser));
                    throw e;
                }

                // Login as the user and verify the number of affiliates
                userFunctions.LogIn(logger, Const.USER12);
                SelectAffiliateProgram();
                int affiliatesAfterUserRegistration = GetnumberOfAffiliates(driver);
                if ((affiliatesAfterUserRegistration - initialAffiliates) == 1)
                {
                    flag = true;
                    logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramFinalAffiliates, affiliatesAfterUserRegistration));
                }
            }
            catch (NoSuchElementException ex)
            {
                logger.TakeScreenshot();
                throw ex;
            }
            catch (Exception e)
            {
                logger.TakeScreenshot();
                throw e;
            }
            return(flag);
        }