/// <summary>
        /// If you add an activity which gives you credits, this method can be called to wait for a user-specified label on your application
        /// to get updated with those credits after that activity was added. Once an activity is submitted, a record gets put into a windows service
        /// queue, and then waits for that service to push the activity through, because of this, we need to wait in our code. Note that there
        /// is not database flag to check instead of just randomly refreshing every couple of seconds. Right now, we will refresh every 4 seconds,
        /// 30 times. If your application ever takes longer than that, then increase the For loop below
        /// Note: This method is a workaround to be able to refresh this page. It can be removed when/if defect
        /// https://code.premierinc.com/issues/browse/RCPSC-793 is fixed. If that gets fixed, then
        /// we will remove this method, and just use the regular <see cref="ApplicationUtils.WaitForCreditsToBeApplied(Page, By, string)"/>
        /// </summary>
        /// <param name="Page">The page to refresh</param>
        /// <param name="creditLabelBy">the label which stores the amount of credits that you are waiting to be refreshed</param>
        /// <param name="amountOfCredits">The amount of credits that will show when the windows service is complete</param>
        public static void WaitForCreditsToBeApplied(IWebDriver Browser, Page page, By creditLabelBy, string amountOfCredits)
        {
            MyMOCPage       MP = new MyMOCPage(Browser);
            MyDashboardPage DP = new MyDashboardPage(Browser);

            DP.ClickAndWaitBasePage(DP.MyMOCTab);
            DP.ClickAndWaitBasePage(DP.MyDashboardTab);

            ApplicationUtils.WaitForCreditsToBeApplied(page, creditLabelBy, amountOfCredits);
        }
Exemple #2
0
        /// <summary>
        /// Enters text in the username and password field, clicks the login button, then waits for the URL
        /// of the Dashboard page to load
        /// </summary>
        /// <param name="role">Either "learner", "observer", "program admin", etc.</param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public dynamic LoginAsExistingUser(UserUtils.UserRole role, string userName, string password)
        {
            // Login with a valid user
            UserNameTxt.Clear();
            PasswordTxt.Clear();
            UserNameTxt.SendKeys(userName);
            PasswordTxt.SendKeys(password);
            PasswordTxt.SendKeys(Keys.Tab);
            ClickAndWait(LoginBtn);

            switch (role)
            {
            case UserUtils.UserRole.LR:
                CBDLearnerPage LP = new CBDLearnerPage(Browser);
                LP.WaitForInitialize();

                // Adding these if statements here because sometimes the graph doesnt appear after we login. It only happens about 5 percent of the time,
                // so DEV is not looking into it. So if the graph does not appear, then we will navigate to the already loaded page again
                // UPDATE: Added another if statement to refresh again. This was working perfectly before today (Today I increased the amount of parallel
                // tests, and also started running Firefox again, so the issue is either with Firefox, or with increasing the max parallel setting. The max
                // is set at 16 now, this never was an issue when max was set to 6)
                if (Browser.FindElements(By.Id("EPAChart")).Count == 0)
                {
                    Browser.WaitForElement(Bys.RCPPage.CBDTab, ElementCriteria.IsVisible);
                    ClickAndWaitBasePage(CBDTab);
                    try
                    {
                        LP.WaitUntil(TimeSpan.FromSeconds(60), Criteria.CBDLearnerPage.EPAChartVisibleAndEnabledAndHasText);
                    }
                    catch
                    {
                        if (Browser.FindElements(By.Id("EPAChart")).Count == 0)
                        {
                            Browser.WaitForElement(Bys.RCPPage.CBDTab, ElementCriteria.IsVisible);
                            ClickAndWaitBasePage(CBDTab);
                            LP.WaitUntil(TimeSpan.FromSeconds(60), Criteria.CBDLearnerPage.EPAChartVisibleAndEnabledAndHasText);
                        }
                    }
                }
                return(LP);

            case UserUtils.UserRole.OB:
                CBDObserverPage OP = new CBDObserverPage(Browser);
                OP.WaitForInitialize();
                return(OP);

            case UserUtils.UserRole.PA:
                CBDProgAdminPage PA = new CBDProgAdminPage(Browser);
                PA.WaitForInitialize();
                return(PA);

            case UserUtils.UserRole.PD:
                CBDProgDirectorPage PD = new CBDProgDirectorPage(Browser);
                PD.WaitForInitialize();
                return(PD);

            case UserUtils.UserRole.PGD:
                CBDProgDeanPage page = new CBDProgDeanPage(Browser);
                page.WaitForInitialize();
                return(page);

            case UserUtils.UserRole.CUPER:
                MyDashboardPage PERCUMyDashboardPage = new MyDashboardPage(Browser);
                PERCUMyDashboardPage.WaitForInitialize();
                PERCredentialStaffPage CP = PERCUMyDashboardPage.ClickAndWaitBasePage(PERCUMyDashboardPage.PERAFCTab);
                return(CP);

            case UserUtils.UserRole.CSDiploma:
                DiplomaClinicalSupervisorPage CSP = new DiplomaClinicalSupervisorPage(Browser);
                CSP.WaitForInitialize();
                return(CSP);

            case UserUtils.UserRole.CUDiploma:
                MyDashboardPage DiplomaCUMyDashboardPage = new MyDashboardPage(Browser);
                DiplomaCUMyDashboardPage.WaitForInitialize();
                DiplomaCredentialStaffPage DCUP = DiplomaCUMyDashboardPage.ClickAndWaitBasePage(DiplomaCUMyDashboardPage.MyDiplomaTab);
                return(DCUP);

            case UserUtils.UserRole.DDDiploma:
                DiplomaDirectorPage DD = new DiplomaDirectorPage(Browser);
                DD.WaitForInitialize();
                return(DD);

            case UserUtils.UserRole.FOMDiploma:
                DiplomaFacOfMedicinePage FOMP = new DiplomaFacOfMedicinePage(Browser);
                FOMP.WaitForInitialize();
                return(FOMP);

            case UserUtils.UserRole.MP:
                MyDashboardPage DP = new MyDashboardPage(Browser);
                DP.WaitForInitialize();
                return(DP);

            case UserUtils.UserRole.TraineePER:
                PERTraineePage PTP = new PERTraineePage(Browser);
                PTP.WaitForInitialize();
                return(PTP);

            case UserUtils.UserRole.TraineeDiploma:
                DiplomaTraineePage DTP = new DiplomaTraineePage(Browser);
                DTP.WaitForInitialize();
                return(DTP);

            case UserUtils.UserRole.REF:
                PERRefereePage PERRP = new PERRefereePage(Browser);
                PERRP.WaitForInitialize();
                return(PERRP);

            case UserUtils.UserRole.ASRPER:
                PERAssessorPage AP = new PERAssessorPage(Browser);
                AP.WaitForInitialize();
                return(AP);

            case UserUtils.UserRole.ASRDiploma:
                DiplomaAssessorPage DAP = new DiplomaAssessorPage(Browser);
                DAP.WaitForInitialize();
                return(DAP);
            }

            return(null);
        }
Exemple #3
0
        /// <summary>
        /// Enters text in the username and password field, clicks the login button, then waits for the URL
        /// of the Dashboard page to load
        /// </summary>
        /// <param name="role">Either "learner", "observer", "program admin", etc.</param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public dynamic LoginAsExistingUser(UserUtils.UserRole role, string userName, string password)
        {
            // Login with a valid user
            UserNameTxt.Clear();
            PasswordTxt.Clear();
            UserNameTxt.SendKeys(userName);
            PasswordTxt.SendKeys(password);
            PasswordTxt.SendKeys(Keys.Tab);
            ClickAndWait(LoginBtn);

            switch (role)
            {
            case UserUtils.UserRole.LR:
                CBDLearnerPage LP = new CBDLearnerPage(Browser);
                LP.WaitForInitialize();

                // Adding this if statements here because sometimes the graph doesnt appear after we login. It only happens about 5 percent of the time,
                // so DEV is not looking into it. So if the graph does not appear, then we will navigate to the already loaded page again
                if (Browser.FindElements(By.Id("EPAChart")).Count == 0)
                {
                    Navigation.GoToLearnerPage(Browser);
                    LP.WaitUntil(TimeSpan.FromSeconds(30), Criteria.CBDLearnerPage.EPAChartVisibleAndEnabledAndHasText);
                }
                return(LP);

            case UserUtils.UserRole.OB:
                CBDObserverPage OP = new CBDObserverPage(Browser);
                OP.WaitForInitialize();
                return(OP);

            case UserUtils.UserRole.PA:
                CBDProgAdminPage PA = new CBDProgAdminPage(Browser);
                PA.WaitForInitialize();
                return(PA);

            case UserUtils.UserRole.PD:
                CBDProgDirectorPage PD = new CBDProgDirectorPage(Browser);
                PD.WaitForInitialize();
                return(PD);

            case UserUtils.UserRole.PGD:
                CBDProgDeanPage page = new CBDProgDeanPage(Browser);
                page.WaitForInitialize();
                return(page);

            case UserUtils.UserRole.CUPER:
                MyDashboardPage PERCUMyDashboardPage = new MyDashboardPage(Browser);
                PERCUMyDashboardPage.WaitForInitialize();
                PERCredentialStaffPage CP = PERCUMyDashboardPage.ClickAndWaitBasePage(PERCUMyDashboardPage.PERAFCTab);
                return(CP);

            case UserUtils.UserRole.CSDiploma:
                DiplomaClinicalSupervisorPage CSP = new DiplomaClinicalSupervisorPage(Browser);
                CSP.WaitForInitialize();
                return(CSP);

            case UserUtils.UserRole.CUDiploma:
                MyDashboardPage DiplomaCUMyDashboardPage = new MyDashboardPage(Browser);
                DiplomaCUMyDashboardPage.WaitForInitialize();
                DiplomaCredentialStaffPage DCUP = DiplomaCUMyDashboardPage.ClickAndWaitBasePage(DiplomaCUMyDashboardPage.MyDiplomaTab);
                return(DCUP);

            case UserUtils.UserRole.DDDiploma:
                DiplomaDirectorPage DD = new DiplomaDirectorPage(Browser);
                DD.WaitForInitialize();
                return(DD);

            case UserUtils.UserRole.FOMDiploma:
                DiplomaFacOfMedicinePage FOMP = new DiplomaFacOfMedicinePage(Browser);
                FOMP.WaitForInitialize();
                return(FOMP);

            case UserUtils.UserRole.MP:
                MyDashboardPage DP = new MyDashboardPage(Browser);
                DP.WaitForInitialize();
                return(DP);

            case UserUtils.UserRole.TraineePER:
                PERTraineePage PTP = new PERTraineePage(Browser);
                PTP.WaitForInitialize();
                return(PTP);

            case UserUtils.UserRole.TraineeDiploma:
                DiplomaTraineePage DTP = new DiplomaTraineePage(Browser);
                DTP.WaitForInitialize();
                return(DTP);

            case UserUtils.UserRole.REF:
                PERRefereePage PERRP = new PERRefereePage(Browser);
                PERRP.WaitForInitialize();
                return(PERRP);

            case UserUtils.UserRole.ASRPER:
                PERAssessorPage AP = new PERAssessorPage(Browser);
                AP.WaitForInitialize();
                return(AP);

            case UserUtils.UserRole.ASRDiploma:
                DiplomaAssessorPage DAP = new DiplomaAssessorPage(Browser);
                DAP.WaitForInitialize();
                return(DAP);
            }

            return(null);
        }