/// <summary>
        /// Logs in as the Credential Staff user, clicks on the Assessors tab if we are not already there, clicks the Make Final Review button for a
        /// user-specified trainee, clicks on either the Achieved or Not Achieved radio button, enters text into Request Comments field, clicks
        /// the Submit button, then logs out
        /// </summary>
        /// <param name="traineeFullName">The trainee's first and last nameThe exact text of the trainee from the Trainee column inside the Trainee table on the Assessor tab</param>
        /// <param name="achieved">true or false depending on if you want to achieve the trainee or not</param>
        public static void AsCredentialStaff_MarkTraineeAsAchievedOrNotAchieved(IWebDriver browser, string traineeFullName, bool achieved)
        {
            LoginPage LP = Navigation.GoToLoginPage(browser);
            PERCredentialStaffPage CP = LP.LoginAsExistingUser(UserUtils.UserRole.CUPER, UserUtils.CredentialStaffPERLogin, "password");

            CP.MakeFinalReview(traineeFullName, achieved);
            CP.Logout();
        }
        /// <summary>
        /// Logs in as the Credential Staff user, clicks on the Assessors tab if we are not already there, clicks the Assign Third Assessor button for a
        /// user-specified trainee, chooses a user-specified third assessor, clicks the Submit button, then logs out
        /// </summary>
        /// <param name="browser">The driver instance</param>
        /// <param name="traineeFullName">The trainee's first and last nameThe exact text of the trainee from the Trainee column inside the Trainee table on the Referee tab</param>
        /// <param name="assessor3FullName">The first and last name of the assessor</param>
        public static void AsCredentialStaff_AssignTraineeTo3rdAssessor(IWebDriver browser, string traineeFullName, string thirdAssessorFullName)
        {
            LoginPage LP = Navigation.GoToLoginPage(browser);
            PERCredentialStaffPage CP = LP.LoginAsExistingUser(UserUtils.UserRole.CUPER, UserUtils.CredentialStaffPERLogin, "password");

            CP.Assign3rdAssessor(traineeFullName, thirdAssessorFullName);
            CP.Logout();
        }
        /// <summary>
        /// Logs in as as the Credential Staff user, clicks on the Referees tab if we are not already there, clicks the Assign Referees button for a
        /// user-specified trainee, chooses a user-specified first and second referee, clicks the Submit button, then logs out
        /// </summary>
        /// <param name="traineeFullName">The trainee's first and last name. The exact text of the trainee from the Trainee column inside the Trainee table on the Referee tab</param>
        /// <param name="referee1FullName">The first and last name of the referee</param>
        /// <param name="referee2FullName">The first and last name of the referee</param>
        public static void AsCredentialStaff_AssignTraineeTo1stAnd2ndRefs(IWebDriver browser, string traineeFullName, string firstRefereeFullName, string secondRefereeFullName)
        {
            LoginPage LP = Navigation.GoToLoginPage(browser);
            PERCredentialStaffPage CP = LP.LoginAsExistingUser(UserUtils.UserRole.CUPER, UserUtils.CredentialStaffPERLogin, "password");

            CP.AssignReferees(traineeFullName, firstRefereeFullName, secondRefereeFullName);
            CP.Logout();
        }
Beispiel #4
0
        /// <summary>
        /// Clicks the user-specified element that exists on every page of RCP, and then waits for a window to close or open,
        /// or a page to load, depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickAndWaitBasePage(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.RCPPage.PERAFCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PERAFCTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    PERCredentialStaffPage page = new PERCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDiplomaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDiplomaTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    DiplomaCredentialStaffPage page = new DiplomaCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDashboardTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDashboardTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyCPDActivitiesTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyCPDActivitiesTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyCPDActivitiesListPage page = new MyCPDActivitiesListPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyMOCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyMOCTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyMOCPage page = new MyMOCPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyHoldingAreaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyHoldingAreaTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    // We dont want wait criteria here, because clicking this tab can be on any role within RCP, so there can be many things to wait for
                    return(null);
                }
            }


            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    LogoutLnk.Click();
                    this.WaitForElement(Bys.RCPPage.LoginLnk, ElementCriteria.IsVisible);
                    return(null);
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, " +
                                    "or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }
Beispiel #5
0
        /// <summary>
        /// Clicks the user-specified element that exists on every page of RCP, and then waits for a window to close or open,
        /// or a page to load, depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The button element</param>
        public dynamic ClickAndWaitBasePage(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.RCPPage.PERAFCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PERAFCTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    PERCredentialStaffPage page = new PERCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDiplomaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDiplomaTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    DiplomaCredentialStaffPage page = new DiplomaCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDashboardTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDashboardTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyCPDActivitiesTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyCPDActivitiesTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyCPDActivitiesListPage page = new MyCPDActivitiesListPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyMOCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyMOCTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyMOCPage page = new MyMOCPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyHoldingAreaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyHoldingAreaTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, " +
                                    "or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }