예제 #1
0
        /// <summary>
        /// Creates a new agenda. First it will click on the Competenece Committee tab if we are not on this page, then it opens the Create
        /// New Agenda window, then assigns a user-specified date and clicks Create to create the new agenda
        /// </summary>
        /// <param name="yearsToAdd">However many years you want to add to the current date. If none, enter "0"</param>
        /// <param name="monthsToAdd">However many months you want to add to the current date. If none, enter "0"</param>
        /// <param name="daysToAdd">However many days you want to add to the current date. If none, enter "0"</param>
        public void CreateUpcomingAgendaWithSpecificDate(int yearsToAdd, int monthsToAdd, int daysToAdd)
        {
            // If we are not on the Competence Committee tab, then click on it to go there
            if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled))
            {
                ClickAndWait(CompCommiteeTab);
            }

            ActionsBtn.Click();
            ClickAndWait(CreateNewAgendaLnk);

            Dictionary <string, string> dates = DataUtils.GetDateForCalendarElem(DateTime.Now.AddYears(yearsToAdd).AddMonths(monthsToAdd).AddDays(daysToAdd));

            ElemSet.DatePicker_ChooseDate(Browser, dates["year"], dates["month"], dates["day"]);

            ClickAndWait(CreateNewAgendaFormCreateBtn);
        }
        /// <summary>
        /// Clicks on the Portfolios Under Review tab, clicks on the Record Payment button for a user-specified trainee, fills in the date and
        /// comments fields clicks the Submit button on the confirmation popup window
        /// </summary>
        /// <param name="traineeFullName"></param>
        public void RecordPayment(string traineeFullName)
        {
            ClickAndWait(PortfoliosUnderReviewTab);

            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, PortfoliosUnderReviewTbl, Bys.DiplomaCredentialStaffPage.PortfoliosUnderReviewTblFirstRow,
                                                    traineeFullName, null, "Record Payment");

            this.WaitUntil(Criteria.DiplomaCredentialStaffPage.RecordPaymentFormSubmitBtnVisible);

            RecordPaymentFormDateTxt.SendKeys("09/09/2017");
            RecordPaymentFormDateTxt.SendKeys(Keys.Tab);
            Thread.Sleep(0200);

            RecordPaymentFormCommentsTxt.SendKeys("these are my comments :)");

            ClickAndWait(RecordPaymentFormSubmitBtn);
        }
        /// <summary>
        /// Clicks on the Portfolios Under Review tab, clicks on the Assign Reviewer button for a user-specified trainee, assigns 2 assessors,
        /// clicks the Submit button on the confirmation popup window
        /// </summary>
        /// <param name="traineeFullName"></param>
        public void AssignReviewer(string traineeFullName, string assessor1FullName, string assessor2FullName)
        {
            ClickAndWait(PortfoliosUnderReviewTab);

            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, PortfoliosUnderReviewTbl, Bys.DiplomaCredentialStaffPage.PortfoliosUnderReviewTblFirstRow,
                                                    traineeFullName, null, "Assign Reviewer");

            this.WaitUntil(Criteria.DiplomaCredentialStaffPage.AssignAssessor2AssFormSubmitBtnVisible);
            this.WaitUntil(TimeSpan.FromSeconds(60), Criteria.DiplomaCredentialStaffPage.AssignAssessor2AssFormFirstAssSelElemVisible);
            Thread.Sleep(0200);

            ElemSet.ScrollToSelectElement(Browser, AssignAssessor2AssFormFirstAssSelElem);
            AssignAssessor2AssFormFirstAssSelElem.SelectByText(assessor1FullName);
            AssignAssessor2AssFormSecondAssSelElem.SelectByText(assessor2FullName);

            ClickAndWait(AssignAssessor2AssFormSubmitBtn);
        }
        /// <summary>
        /// Selects "Needs Additional Information" in the Status drop down, clicks on the user-specified milestone,
        /// enters user-specified text into the "Your Reply" text box, clicks Save, then goes back to the Dashboard
        /// </summary>
        /// <param name="milestoneName">The milestone name as it appears in the text of the HTML elementThe exact text of the milestone inside the milestone table</param>
        /// <param name="additionalInfoText">The text you want to enter for the requested or submitted additional infoThe text of your choice</param>
        public void SubmitAdditionalInfo(string milestoneName, string additionalInfoText)
        {
            StatusSelElem.SelectByText("Needs Additional Information");

            this.WaitUntilAny(Criteria.DiplomaTraineePage.MilestonesTblMilestoneNameLinksEnabled);

            ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, MilestonesTbl, Bys.DiplomaTraineePage.MilestonesTblFirstRow, milestoneName, "a", milestoneName, "a");
            WaitForMilestoneFrame();

            YourReplyTxt.SendKeys(additionalInfoText);
            this.WaitUntilAll(Criteria.DiplomaTraineePage.YourReplySaveChangesButtonVisible);

            ClickAndWait(YourReplySaveChangesBtn);

            ClickAndWait(ResubmitBtn);
        }
예제 #5
0
        public dynamic LearnerTestFail()
        {
            WaitForInitialize();
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(125), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            ContinueBtn.Click();

            Thread.Sleep(2000);
            WaitForInitialize();
            ContinueBtn.Click();

            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);
            int i = 0;

            do
            {
                WaitForInitialize();
                Thread.Sleep(0500);
                TestLaunchBtn.Click();
                Thread.Sleep(0500);
                Browser.SwitchTo().Frame(PostTestFrame);
                ElemSet.RdoBtn_ClickMultipleByText(Browser, "B. False", "A. Harmful, abusive", "A. Low grade/poor class evaluation");
                Thread.Sleep(0500);
                TestSubmitBtn.Click();
                Thread.Sleep(0500);
                FrameCloseBtn.Click();
                i++;
            } while (i < 3);

            Thread.Sleep(1000);
            ContinueBtn.Click();
            WaitForInitialize();

            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);

            Thread.Sleep(1000);
            ContinueBtn.Click();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.CertificateCloseBtn, TimeSpan.FromSeconds(35), ElementCriteria.IsEnabled);

            Thread.Sleep(2000);
            CertificateCloseBtn.Click();         //  Browser.Navigate().Refresh();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            return(new GCEPPage(Browser));
        }
예제 #6
0
        /// <summary>
        /// Opens the Set Status form for a given learner on the Agenda table if it is not already opens, then chooses a user-specified
        /// Learner Status and Actions, then clicks the Confirm Status button and waits for the window to close
        /// </summary>
        /// <param name="learnerFullName">The exact text from the cell that your learner exists within</param>
        /// <param name="learnerStatus">The exact text from one of the items in the Learner Status select element</param>
        /// <param name="actions">The exact text from one of the items in the Actions select element</param>
        public void SetStatusOfLearner(string learnerFullName, string learnerStatus, string actions)
        {
            // If the Set Status window is not open, open it
            if (!Browser.Exists(Bys.CBDProgDirectorPage.SetStatusFormLearnerStatusSelElem, ElementCriteria.IsVisible))
            {
                ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, AgendaTbl, Bys.CBDProgDirectorPage.AgendaTbl, learnerFullName, null, "Set Status");
                this.WaitUntilAll(Criteria.CBDProgDirectorPage.SetStatusFormLearnStatusSelElemHasItemsAndIsEnabled,
                                  Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);
            }

            SetStatusFormLearnerStatusSelElem.SelectByText(learnerStatus);
            Thread.Sleep(0200);
            this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementDisappeared, Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide);

            SetStatusFormActionsSelElem.SelectByText(actions);

            ClickAndWait(SetStatusFormConfirmBtn);
        }
예제 #7
0
        /// <summary>
        /// This method scrool to the bottom of the page to load all courses.
        /// </summary>
        public void ScrolltoGetAllCourses()
        {
            int countofRowNoScroll;
            int countofRowFirstScroll;

            do
            {
                List <IWebElement> EnterRow = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowNoScroll = EnterRow.Count;
                //Thread.Sleep(1000);
                ElemSet.ScrollToElement(Browser, FaceBookLnk);

                Thread.Sleep(1000);
                List <IWebElement> EnterRowFirstScroll1 = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowFirstScroll = EnterRowFirstScroll1.Count;
                Thread.Sleep(1000);
            }while (countofRowFirstScroll > countofRowNoScroll);
        }
예제 #8
0
        /// <summary>
        /// Chooses User specified Learner, clicks the Action button, selects Add Notes, fills in the Subject and Notes text box with
        /// a random string, chooses the user-specified radio button  then clicks Submit
        /// </summary>
        /// <param name="learnerFullName">First and last name of the learner</param>
        /// <param name="sharingOption">The exact text of either radio button on the Add Notes form</param>
        public void AddNotes(string learnerFullName, string sharingOption)
        {
            IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody,
                                                                      learnerFullName, "a", "Actions", "span");

            Thread.Sleep(0500);

            IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3);

            ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add Notes");
            Browser.WaitForElement(Bys.CBDProgDirectorPage.AddNotesFormSubjectTxt, ElementCriteria.IsVisible);
            this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);

            AddNotesFormNotesTxt.SendKeys(DataUtils.GetRandomSentence(12));
            ElemSet.RdoBtn_ClickRandom(Browser, "Share This Note");
            AddNotesFormSubjectTxt.SendKeys(DataUtils.GetRandomSentence(12));

            ClickAndWait(AddNotesFormSubmitBtn);
        }
        public void CourseTracker_Resident_ElectiveCourseFail()
        {
            ///  1.Navigate to the login page login as a AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10021378", "password");

            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
            }

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep          = ED.ClickToAdvance(ED.GcepLnk);
            string   CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            string[] CourseyrackernotNull = CourseTracker.Split(' ');
            int      regCoursCount        = Convert.ToInt16(CourseyrackernotNull[2]);
            int      countofRowNoScroll;
            int      countofRowFirstScroll;

            do
            {
                List <IWebElement> EnterRow = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowNoScroll = EnterRow.Count;
                //Thread.Sleep(1000);
                ElemSet.ScrollToElement(Browser, Gcep.FaceBookLnk);

                Thread.Sleep(1000);
                List <IWebElement> EnterRowFirstScroll1 = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowFirstScroll = EnterRowFirstScroll1.Count;
                Thread.Sleep(1000);
            }while (countofRowFirstScroll > countofRowNoScroll);

            //Assert.True(Gcep.VerificationOfChoosenCoursesAssignedForResident(browser, CourseNames), "Course count are not equal");

            string xPathVariable1 = string.Format("//div[@class='activity-info-name']/h4[.='{0}']/../../..//button", "content-2jpg");

            Thread.Sleep(0500);
            IWebElement button1 = browser.FindElement(By.XPath(xPathVariable1));

            ElemSet.ScrollToElement(browser, button1);
        }
예제 #10
0
        /// <summary>
        /// Chooses User specified Learner, clicks the Action button, selects Add Supporting Documentation,
        /// fills in the File Name text box, then clicks Submit
        /// </summary>
        /// <param name="learnerName">First and last name of the learner</param>
        /// <param name="fileLocation">File location</param>
        public void AddSupportDocumentation(string learnerFullName, string fileLocation)
        {
            IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl,
                                                                      Bys.CBDProgDirectorPage.LearnersTblRowBody, learnerFullName, "a", "Actions", "span");

            Thread.Sleep(0500);

            IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3);

            ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add Supporting Documentation");
            Browser.WaitForElement(Bys.CBDProgDirectorPage.AddSupportingDocumentationFormFilelocationTxt, ElementCriteria.IsVisible);
            this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);

            AddSupportingDocumentationFormFilelocationTxt.SendKeys(fileLocation);

            // FileUtils.Upload(AddSupportingDocumentationFormBrowseBtn, @"C:\SeleniumAutoIt\FileUpload.exe", browserName, "C:\\SeleniumAutoIt\\test.txt");

            ClickAndWait(AddSupportingDocumentationFormSubmitBtn);
        }
예제 #11
0
        /// <summary>
        /// TestPass method created specificly for the courses AUTOMATION_001 and _002, _003 it will take a test and faipass with credentials below
        /// GCEP Library Page
        /// </summary>
        /// TODO : remove Threads sleep after flickiring isssue will be fixed

        public dynamic TestPass()
        {
            WaitForInitialize();
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(125), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            ContinueBtn.Click();

            Thread.Sleep(2000);
            WaitForInitialize();
            ContinueBtn.Click();

            //Thread.Sleep(2000);
            //WaitForInitialize();
            //ContinueBtn.Click();

            WaitForInitialize();
            TestLaunchBtn.Click();

            Thread.Sleep(0500);
            Browser.SwitchTo().Frame(PostTestFrame);
            ElemSet.RdoBtn_ClickMultipleByText(Browser, "A. True", "B. Harmful, injurious", "D. All of the above");
            TestSubmitBtn.Click();
            Thread.Sleep(0500);
            FrameCloseBtn.Click();
            Thread.Sleep(0500);

            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(125), ElementCriteria.IsEnabled);

            Thread.Sleep(1000);
            ContinueBtn.Click();
            WaitForInitialize();

            Thread.Sleep(1000);
            ContinueBtn.Click();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.CertificateCloseBtn, TimeSpan.FromSeconds(95), ElementCriteria.IsEnabled);

            Thread.Sleep(4000);
            CertificateCloseBtn.Click();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);

            return(new GCEPPage(Browser));
        }
        public void CourseTracker_Resident_ElectiveCoursePass()
        {
            ///  1.Navigate to the login page login as a AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10021378", "password");

            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
            }

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep          = ED.ClickToAdvance(ED.GcepLnk);
            string   CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            string[] CourseyrackernotNull = CourseTracker.Split(' ');
            int      regCoursCount        = Convert.ToInt16(CourseyrackernotNull[3]);

            Gcep.ScrolltoGetAllCourses();

            string xPathVariable1 = string.Format("//div[@class='activity-info-name']/h4[.='{0}']/../../..//button", "Confidentiality");

            Thread.Sleep(0500);
            IWebElement button1 = browser.FindElement(By.XPath(xPathVariable1));

            ElemSet.ScrollToElement(browser, button1);

            // ElemSet.ScrollToElement(Browser, Browser.FindElement(By.LinkText("AMA TEST")));
            CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, "AUTOMATION_004");

            Gcep = Course.TestPass();
            Gcep.ScrolltoGetAllCourses();

            // Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, "AUTOMATION_003", "View Certificate"), "View Certificet button not visible");

            string CourseTrackerAfterTestCompletion = Gcep.ResidentCourseTrackerLbl.Text;

            string[] courseword3 = CourseTrackerAfterTestCompletion.Split(' ');
            int      CountOfCompletedRegCourseafterPassingTest = Convert.ToInt16(courseword3[3]);

            Assert.True(regCoursCount + 1 == (CountOfCompletedRegCourseafterPassingTest));
        }
        /// <summary>
        /// Clicks on the Portfolios Under Review tab, clicks on the Record Payment button for a user-specified trainee, fills in the date and
        /// comments fields clicks the Submit button on the confirmation popup window
        /// </summary>
        /// <param name="traineeFullName"></param>
        public void RecordPayment(string traineeFullName)
        {
            ClickAndWait(PortfoliosUnderReviewTab);

            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, PortfoliosUnderReviewTbl, Bys.DiplomaCredentialStaffPage.PortfoliosUnderReviewTblFirstRow,
                                                    traineeFullName, "a", "Record Payment", "button");

            this.WaitUntil(Criteria.DiplomaCredentialStaffPage.RecordPaymentFormSubmitBtnVisible);
            // Adding a sleep here because test failed on 1/10/18. When I looked at screenshot, it failed to enter text into the date box. Maybe
            // it needs to wait a little after this button appears. Monitor going forward
            Thread.Sleep(0300);
            RecordPaymentFormDateTxt.SendKeys("09/09/2017");
            RecordPaymentFormDateTxt.SendKeys(Keys.Tab);
            Thread.Sleep(0200);

            RecordPaymentFormCommentsTxt.SendKeys("these are my comments :)");

            ClickAndWait(RecordPaymentFormSubmitBtn);
        }
예제 #14
0
        /// <summary>
        /// Chooses a learner in the learners table, clicks on the Actions button, clicks on Add/Remove Flag, fill in
        /// all of the fields with random data and clicks Remove Flag if a flag is present
        /// </summary>
        /// <param name="learnerFullName"></param>
        public void RemoveFlag(string learnerFullName)
        {
            IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody,
                                                                      learnerFullName, "a", "Actions", "span");

            Thread.Sleep(0500);

            IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3);

            ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add/Remove Flag");
            Browser.WaitForElement(Bys.CBDProgDirectorPage.AddRemoveFlagFormReasonTxt, ElementCriteria.IsVisible);
            this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);

            // If the flag is there, remove it
            if (AddRemoveFlagFormRemoveFlagBtn.Enabled)
            {
                ClickAndWait(AddRemoveFlagFormRemoveFlagBtn);
            }
        }
예제 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="yearsToAdd">However many years you want to add to the current date. If none, enter "0"</param>
        /// <param name="monthsToAdd">However many months you want to add to the current date. If none, enter "0"</param>
        /// <param name="daysToAdd">However many days you want to add to the current date. If none, enter "0"</param>
        public void FinalizeAllUpcomingAgendasOnSpecificDate(int yearsToAdd, int monthsToAdd, int daysToAdd)
        {
            // If we are not on the Competence Committee tab, then click on it to go there
            if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled))
            {
                ClickAndWait(CompCommiteeTab);
            }

            string date = DateTime.Now.AddYears(yearsToAdd).AddMonths(monthsToAdd).AddDays(daysToAdd).ToString("MM/dd/yyyy");
            String upcomingAgendaInstance = string.Format("{0} Upcoming", date);
            int    countOfUpcomingAgendasOnSpecificDate = ElemGet.SelElem_GetCountOfItemsContainingText(MeetingAgendaSelElem, "Upcoming");

            for (int i = 0; i < countOfUpcomingAgendasOnSpecificDate; i++)
            {
                ElemSet.SelElem_SelectItemContainingText(MeetingAgendaSelElem, upcomingAgendaInstance);
                ClickAndWait(FinalizeAgendaBtn);
                ClickAndWait(FinalizeAgendaFormFinalizeBtn);
            }
        }
예제 #16
0
        /// <summary>
        /// Chooses a program from the Program dropdown, clicks on the Learner tab, chooses a user specified Learner,
        /// clicks on the Actions button, clicks on Add/Remove Flag, fill in
        /// all of the fields with random data and clicks Save Flag
        /// </summary>
        /// <param name="program">The text from one of the items in the Program dropdown</param>
        /// <param name="learnerFullName">First and last name of the learner</param>
        public void AddFlag(string program, string learnerFullName)
        {
            SelectProgram(program);

            ClickAndWait(LearnersTab);

            IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl,
                                                                      Bys.CBDProgDeanPage.LearnersTblBodyRow, learnerFullName, "a", "Actions", "span");

            Thread.Sleep(0500);

            IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3);

            ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add/Remove Flag");
            Browser.WaitForElement(Bys.CBDProgDeanPage.AddRemoveFlagFormReasonTxt, ElementCriteria.IsVisible);
            this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);

            AddRemoveFlagFormReasonTxt.SendKeys(DataUtils.GetRandomSentence(10));
            ClickAndWait(AddRemoveFlagFormSaveFlagBtn);
        }
        /// <summary>
        /// Checks the check box in the Portfolios Under Review tab for a user-specified trainee, clicks the Mark Selected Portfolio as Achieved button, checks the
        /// I Attest check box on the Mark Selected Portfolios as Achieved form, then clicks Submbit
        /// </summary>
        /// <param name="traineeFullName"></param>
        public void MarkPortfolioAchieved(string traineeFullName)
        {
            IWebElement row = ElemGet.Grid_GetRowByRowName(PortfoliosUnderReviewTbl, Bys.DiplomaDirectorPage.PortfoliosUnderReviewTblBodyRow, traineeFullName);

            ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "input");
            ClickAndWait(MarkSelectedPortfoliosAsAchievedBtn);

            MarkSelPortAchFormIAttestChk.Click();
            // This failed once or twice, maybe because after I click on the I Atttest chekc box above, the Submit button sometimes
            // takes a long time to enable. So adding a sleep and then a try catch
            Thread.Sleep(0400);
            try
            {
                ClickAndWait(MarkSelPortAchFormSubmitBtn);
            }
            catch
            {
                ClickAndWait(MarkSelPortAchFormSubmitBtn);
            }
        }
        /// <summary>
        /// Fills the Complete Assessment form with random data. TODO: Need to add code to fill in the non-required fields
        /// </summary>
        /// <returns></returns>
        public CompletedAssessmentInfo FillObservationFieldsOnFormToCompleteAssessment()
        {
            Dictionary <string, string> date = DataUtils.GetDateForCalendarElem(DateTime.Today.AddMonths(-1));
            string dateChosen = ElemSet.DatePicker_ChooseDate(Browser, date["year"], date["month"], date["day"]);

            // TODO: See below
            // T
            FillGenericFieldsOnObservationForm();

            string rating = ElemSet.RdoBtn_ClickRandom(Browser, "I needed to be there just in case");

            // TODO: Add dynamic wait logic instead of sleep, only if it is needed though, as I dont think the page loads at this point
            Thread.Sleep(0500);

            int ratingValue = GetAssessmentRating(rating);

            string feedback = DataUtils.GetRandomSentence(40);

            CompleteAssessFormFeedbackTxt.SendKeys(feedback);

            return(new CompletedAssessmentInfo(dateChosen, rating, ratingValue, feedback, DateTime.Now.ToString("MM/dd/yyyy")));
        }
        /// <summary>
        /// Clicks the Actions button inside of a user-specified row, clicks the Accept/Decline button, fills the form and either
        /// clicks the Accept or Decline button
        /// </summary>
        /// <param name="learnerName">The first and last name of the learner with the pending observation request</param>
        /// <param name="acceptOrDecline">Either "Accept" "Decline"</param>
        /// <returns></returns>
        public AcceptDeclineAssignmentFormInfo AcceptOrDeclineAssignment(string learnerName, string formName, string acceptOrDecline)
        {
            ElemSet.Grid_ClickMenuItemInsideButton(Browser, PendingAcceptanceTbl, Bys.CBDObserverPage.PendingAcceptanceTblRowBody, learnerName, formName, "Actions", "Accept/Decline Assignment");

            // Wait until the Accept/Decline assesment window opens
            Browser.WaitForElement(Bys.CBDObserverPage.AccDecAssgnMntFormCommentsTxt, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            Browser.WaitForElement(Bys.RCPPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-hide")
                                   .OR(ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-animate ng-hide")));

            AcceptDeclineAssignmentFormInfo ADFO = FillAcceptDeclineAssignmentForm();

            if (acceptOrDecline == "Accept")
            {
                ClickAndWait(AccDecAssgnMntFormAcceptBtn);
            }
            else
            {   // TOD: Add code for declining assessment
                ClickAndWait(AccDecAssgnMntFormDeclineBtn);
                ClickAndWait(ConfirmFormDeclineAssessYesBtn);
            }
            return(ADFO);
        }
예제 #20
0
        /// <summary>
        /// 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, then clicks the Submit button
        /// </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 void MakeFinalReview(string traineeFullName, bool achieved)
        {
            ClickAndWait(AssessorTab);

            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, AssessorTabTraineeTbl, Bys.PERCredentialStaffPage.AssessorTabTraineeTblFirstRow,
                                                    traineeFullName, "a", "Make Final Review", "button");

            this.WaitUntil(TimeSpan.FromSeconds(10), Criteria.PERCredentialStaffPage.FinalReviewFormAchievedRdoVisible);

            if (achieved)
            {
                FinalReviewFormAchievedRdo.Click();
            }
            else
            {
                FinalReviewFormNotAchievedRdo.Click();
            }

            FinalReviewFormRequestCommentsTxt.SendKeys(DataUtils.GetRandomSentence(12));

            ClickAndWait(FinalReviewFormSubmitBtn);
        }
        /// <summary>
        /// Clicks the Review button for a user-specified Trainee, clicks on the milestone links in the Milestone table, then marks the milestone
        /// as Achieved or Not Achieved, depending on the AllAchieved parameter
        /// </summary>
        /// <param name="traineeFullName">The trainee's first and last nameFirst and last name of the trainee</param>
        /// <param name="AllAchieved">If true, then mark all milestones as achieved, else mark all but 1 milestone as achieved</param>
        public void MarkAllMilestones(string traineeFullName, bool AllAchieved)
        {
            GoToTraineeDashboard(traineeFullName);

            int    countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count;
            string currentMileStoneText        = "";

            // loop through every row on the milestone table
            for (int i = 1; i <= countOfRowsInMilestoneTable; i++)
            {
                currentMileStoneText = MilestonesInMilestonesTblLnks[0].Text;
                ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
                MilestonesInMilestonesTblLnks[0].Click();
                this.WaitUntil(Criteria.DiplomaAssessorPage.MainFrameVisibleAndEnabled);
                Browser.SwitchTo().Frame(MainFrame);
                this.WaitUntil(Criteria.DiplomaAssessorPage.MarkAsAchievedBtnVisible);

                if (AllAchieved == true) // Mark all milestones as achieved if set to true
                {
                    ClickAndWait(MarkAsAchievedBtn);
                    ClickAndWait(MarkAsAchievedFormSubmitBtn);
                }

                else // Mark all milestones except for one as achieved. Mark the last one as not achieved
                {
                    if (i < countOfRowsInMilestoneTable) // If we are not on the last row, mark as achieved. Else mark as not achieved
                    {
                        ClickAndWait(MarkAsAchievedBtn);
                        ClickAndWait(MarkAsAchievedFormSubmitBtn);
                    }
                    else
                    {
                        ClickAndWait(MarkAsNotAchievedBtn);
                        ClickAndWait(MarkAsNotAchievedFormSubmitBtn);
                    }
                }
            }
        }
예제 #22
0
        public dynamic LearnerTestPass()
        {
            Thread.Sleep(15000);
            // Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);
            ContinueBtn.Click();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);
            ContinueBtn.Click();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            // Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);
            Browser.WaitForElement(Bys.CourseTestPage.AssessmentTbl, TimeSpan.FromSeconds(60), ElementCriteria.IsEnabled);
            ContinueBtn.Click();
            TestLaunchBtn.Click();
            Thread.Sleep(0500);
            Browser.SwitchTo().Frame(PostTestFrame);
            ElemSet.RdoBtn_ClickMultipleByText(Browser, "A. True", "B. Harmful, injurious", "D. All of the above");
            TestSubmitBtn.Click();
            Thread.Sleep(0500);
            FrameCloseBtn.Click();
            Thread.Sleep(0500);

            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);
            ContinueBtn.Click();

            // Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            ////Browser.WaitForElement(Bys.CourseTestPage.ContinueBtn, TimeSpan.FromSeconds(25), ElementCriteria.IsEnabled);
            //ContinueBtn.Click();

            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            Browser.WaitForElement(Bys.CourseTestPage.CertificateCloseBtn, TimeSpan.FromSeconds(35), ElementCriteria.IsEnabled);
            CertificateCloseBtn.Click();
            Browser.Navigate().Refresh();
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.IsNotVisible);
            return(new EducationCenterPage(Browser));
        }
        /// <summary>
        /// Clicks the Review button for a user-specified Trainee, selects Under Review in the Status select element,
        /// clicks on the milestone links in the Milestone table, then marks the milestone
        /// as Achieved or Not Achieved, depending on the AllAchieved parameter
        /// </summary>
        /// <param name="traineeFullName">The trainee's first and last nameFirst and last name of the trainee</param>
        /// <param name="AllAchieved">If true, then mark all milestones as achieved, else mark all but 1 milestone as achieved</param>
        public void MarkAllMilestones(string traineeFullName, bool AllAchieved)
        {
            GoToTraineeDashboard(traineeFullName);

            StatusSelElem.SelectByText("Under Review");

            int    countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count;
            string currentMileStoneText        = "";

            // loop through every row on the milestone table
            for (int i = 1; i <= countOfRowsInMilestoneTable; i++)
            {
                StatusSelElem.SelectByText("Under Review");

                currentMileStoneText = MilestonesInMilestonesTblLnks[0].Text;
                ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
                MilestonesInMilestonesTblLnks[0].Click();
                this.WaitUntilAll(Criteria.PERAssessorPage.MarkAsAchievedBtnVisible);

                if (AllAchieved == true) // Mark all milestones as achieved if set to true
                {
                    ClickAndWait(MarkAsAchievedBtn);
                }

                else // Mark all milestones except for one as achieved. Mark the last one as not achieved
                {
                    if (i < countOfRowsInMilestoneTable) // If we are not on the last row, mark as achieved. Else mark as not achieved
                    {
                        ClickAndWait(MarkAsAchievedBtn);
                    }
                    else
                    {
                        ClickAndWait(MarkAsNotAchievedBtn);
                    }
                }
            }
        }
        /// <summary>
        /// Opens the Add Observation window if it is not already open, then chooses a user-specified learner, clicks the Next button,
        /// chooses the EPA radio button, chooses a user-specified stage, epa and observation tool, then completes the observation
        /// </summary>
        /// <param name="learnerFullName">The first and last name of the learner</param>
        /// <param name="observationType">Not implemented yet, just leave this null for now</param>
        /// <param name="stage">The exact text of any stage within the Stage select element on the Add Observation form</param>
        /// <param name="epa">The exact text of any EPA underneath the Stage select element</param>
        /// <param name="observationTool">The exact text of any observation tool underneath the EPAs on this form</param>
        /// <returns>An object that represents the learner, the stage, epa, observation tool, and also the completed observation details</returns>
        // TODO: Implement Narrative observation type. Make another method where the selection of stage, epa and observation tool are random selections (AddRandomObservation).
        public AddedObservationInfo AddObservation(string learnerFullName, string observationType, string stage, string epa, string observationTool)
        {
            //AddObservationObject AOO = new AddObservationObject("", "", "", );

            // If the form is not open, then open it.
            if (!Browser.Exists(Bys.CBDObserverPage.AddObsFormLearnerNameTxt, ElementCriteria.IsVisible))
            {
                ClickAndWait(AddObservationBtn);
            }

            SearchAndSelectLearnerOnAddObservationForm(learnerFullName);
            ClickAndWait(AddObsFormNextBtn);

            ElemSet.RdoBtn_ClickByText(Browser, "EPA/IM Observation");
            ClickAndWait(AddObsFormNextBtn);

            AddObsFormStageSelElem.SelectByText(stage);
            Browser.WaitForElement(Bys.CBDObserverPage.AddObsFormBackBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled, ElementCriteria.HasText);
            this.WaitForInitialize();

            ElemSet.RdoBtn_ClickByText(Browser, epa);
            Browser.WaitForElement(Bys.CBDObserverPage.AddObsFormBackBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled, ElementCriteria.HasText);
            this.WaitForInitialize();

            ElemSet.RdoBtn_ClickByText(Browser, observationTool);
            AddObsFormNextBtn.Click();
            Browser.WaitForElement(Bys.CBDObserverPage.CompleteAssessFormFeedbackTxt, ElementCriteria.IsEnabled, ElementCriteria.IsVisible);
            this.WaitForInitialize();

            // Fill out the observation form and return the values that were chosen
            CompletedAssessmentInfo assessment = FillObservationFieldsOnFormToCompleteAssessment();

            ClickAndWait(CompleteAssessFormSubmitBtn);

            return(new AddedObservationInfo(learnerFullName, stage, observationTool, assessment));
        }
예제 #25
0
        public void Resident_GCEP_SortBy_Progress()
        {
            ///  1.Navigate to the login page login as
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10031193", "password");

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Clicking resident sort by progrees button.
            Gcep.ResidentGCEPSortBYProgressBtn.Click();
            Gcep.WaitForInitialize();

            ///  4.Clicking to Sort By duration button and wait to page reload.
            do
            {
                ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk);
            }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed);

            ///  5.Getting all progress information checking all conditions by AC#28

            Assert.True(Gcep.ResidentCourseProgressVerification(Gcep.ResidentCoutseStatusFailedLbl, Gcep.ResidentCourseStatusLockedLbl));
        }
예제 #26
0
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonorElem)
        {
            if (Browser.Exists(Bys.AssignSummaryPage.NextBtn))
            {
                if (buttonorElem.GetAttribute("id") == NextBtn.GetAttribute("id"))
                {
                    Browser.WaitForElement(Bys.AssignSummaryPage.NextBtn, ElementCriteria.IsEnabled);
                    Thread.Sleep(0500);
                    ElemSet.ScrollToElement(Browser, NextBtn);
                    NextBtn.Click();
                    Browser.WaitForElement(Bys.AMAPage.BreadCrumbLnksContainer, TimeSpan.FromSeconds(90), ElementCriteria.IsEnabled, ElementCriteria.IsVisible);
                    AssignConfirmationPage ACP = new AssignConfirmationPage(Browser);
                    ACP.WaitForInitialize();
                    return(ACP);
                }
            }
            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);
        }
예제 #27
0
        /// <summary>
        /// Clicks the user-specified button, link, tab, etc. 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 void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.CBDProgDeanPage.LearnersTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LearnersTab.GetAttribute("outerHTML"))
                {
                    LearnersTab.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == Browser.FindElement(Bys.RCPPage.CBDTab).GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDProgDeanPage.PageReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddRemoveFlagFormRemoveFlagBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddRemoveFlagFormRemoveFlagBtn.GetAttribute("outerHTML"))
                {
                    AddRemoveFlagFormRemoveFlagBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddRemoveFlagFormSaveFlagBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddRemoveFlagFormSaveFlagBtn.GetAttribute("outerHTML"))
                {
                    AddRemoveFlagFormSaveFlagBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddNotesFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddNotesFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddNotesFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, LogoutLnk);
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddSupportingDocumentationFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddSupportingDocumentationFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddSupportingDocumentationFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            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.");
            }
        }
예제 #28
0
        /// <summary>
        /// Clicks the user-specified element 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 void ClickAndWait(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.PERTraineePage.BackToDashboardBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == BackToDashboardBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAny(TimeSpan.FromSeconds(180), Criteria.PERTraineePage.MilestonesTblMilestoneNameLinksEnabled,
                                      Criteria.PERTraineePage.SubmitPortfolioBtnVisible, Criteria.PERTraineePage.ReviewStageValueLblHasText);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.MilestonesInMilestonesTblLnks))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MilestonesInMilestonesTblLnks[0].GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAll(Criteria.PERTraineePage.EvidenceTblUpdateLinksEnabledAndVisible,
                                      Criteria.PERTraineePage.BackToDashboardBtnVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.ResubmitBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ResubmitBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAll(Criteria.PERTraineePage.ReviewStageValueLblHasText);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.EvidForAchieveFormCloseLnk))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == EvidForAchieveFormCloseLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntil(Criteria.PERTraineePage.UploadedFileLnkVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.YourReplySaveChangesBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == YourReplySaveChangesBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    // Add a better wait here. Note that waiting for the save changes button to not be visible doesnt work for some reason
                    Thread.Sleep(2000);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.DescriptionSaveChangesBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == DescriptionSaveChangesBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAll(Criteria.PERTraineePage.DescriptionSaveChangesButtonNotVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.MarkCompleteBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MarkCompleteBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAll(Criteria.PERTraineePage.MarkCompleteButtonNotVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.SubmitPortfolioFormSubmitBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SubmitPortfolioFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAll(Criteria.PERTraineePage.SubmitPortfolioFormSubmitBtnNotVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.PERTraineePage.SubmitPortfolioBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SubmitPortfolioBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntilAll(Criteria.PERTraineePage.SubmitPortfolioFormSubmitBtnVisible);
                    return;
                }
            }

            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.");
            }
        }
        /// <summary>
        /// Clicks the user-specified element 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 void ClickAndWait(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.CBDLearnerPage.BackBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == BackBtn.GetAttribute("outerHTML"))
                {
                    BackBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectBtn.GetAttribute("outerHTML"))
                {
                    // NOTE: This sometimes does not work in Firefox whenever the tooltip for one of the tabs appears. Firefox
                    // fails to click when a tooltip is covering the button. However, this started working today. If it stops
                    // working again, we will have to implement a workaround in the SwitchTabs method
                    AddReflectBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormContinueBtn);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormContinueBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(360), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormBrowseBtn, ElementCriteria.IsVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithReflectionsTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObservationBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObservationBtn.GetAttribute("outerHTML"))
                {
                    RequestObservationBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.RequestObsFormObsNameTxt);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormObsNameTxt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormSearchBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    // Need to revisit the above 2 lines. For some reason, this needs a tiny static wait to work sometimes
                    //Thread.Sleep(0600);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormSearchBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormSearchBtn.GetAttribute("outerHTML"))
                {
                    // 11/30/17: It failed today. Said "Failed to find any elements By.XPath: //tbody[@aria-label='Select Observer']"
                    // I looked on the screenshot and the radio button never got returned, even though the label beneath it said
                    // "Showing 1-1 of 1". This tells me that this is an application bug. Hopefully this fixes itself when DEV works
                    // on performance improvements. If not, and I see this again, I might have to add some more logic below to keep
                    // clicking or something else
                    // 11/05/17: For some reason, selenium sometimes fails to click this button. So I am adding a Catch and using javascript based click event if this fails
                    try
                    {
                        RequestObsFormSearchBtn.Click();
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.RequestObsFormRdoBtnTbodyVisible,
                                          Criteria.CBDLearnerPage.RequestObsFormFirstRdoVisible);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        // Adding a Sleep here for now until I have time to come back and add some dynamic wait criteria
                        Thread.Sleep(0300);
                    }
                    catch
                    {
                        ((IJavaScriptExecutor)Browser).ExecuteScript("arguments[0].click()", RequestObsFormSearchBtn);
                        this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormRdoBtnTbody, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        // Adding a Sleep here for now until I have time to come back and add some dynamic wait criteria
                        Thread.Sleep(0300);
                    }
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormRequestBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormRequestBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormRequestBtn.Click();
                    this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormOkBtn, ElementCriteria.IsVisible);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormOkBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormOkBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormOkBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, LogoutLnk);
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ViewMoreRptsLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ViewMoreRptsLnk.GetAttribute("outerHTML"))
                {
                    ViewMoreRptsLnk.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.ReportsFormShowBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormShowBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormShowBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormShowBtn.Click();
                    Browser.WaitForElement(Bys.CBDLearnerPage.ReportsFormEPAObservCntChrt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled, ElementCriteria.HasText);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormCloseBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormCloseBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormCloseBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            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.");
            }
        }
예제 #30
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or an element to be visible or enabled
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.ProgramPage.SelfReportActTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SelfReportActTab.GetAttribute("outerHTML"))
                {
                    ElemSet.ClickAfterScroll(Browser, buttonOrLinkElem);
                    this.WaitUntil(Criteria.ProgramPage.SelfReportActTabValidActivityTblBodyVisible);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.ProgramPage.ProgramAdjustmentsTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ProgramAdjustmentsTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.ProgramPage.ProgramAdjustmentsActivityTblBodyRowVisible);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.ProgramPage.DetailsTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == DetailsTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.ProgramPage.DetailsTabStatusValueLblVisible);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.ProgramPage.ProgAdjustTabAddAdjustLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ProgAdjustTabAddAdjustLnk.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.ProgramPage.ProgAdjustTabAddAdjustFormAdjustCodeSelElemVisible);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.ProgramPage.ProgAdjustTabAddAdjustFormAddAdjustBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ProgAdjustTabAddAdjustFormAddAdjustBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.ProgramPage.ProgAdjustTabAddAdjustFormNotExists,
                                      Criteria.ProgramPage.AdjustmentAddedBannerNotExists);
                    // Adding a little sleep here. For some reason, whenever the code proceeds after clicking this button, the next line of code doesnt execute.
                    // For example, Navigate.GoToLoginPage. That code gets past the navigation part, but if you view the test in progress, no URL is entered into
                    // the URL. Another example I have code to click on the "Sites" tab in LTS after this, and the code goes past the Click line, but if you view
                    // the test, it didnt click anything. I have never seen this before. So far, I think it only happened in Debug mode.
                    // Monitor going forward
                    Thread.Sleep(0600);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.ProgramPage.CreditValidationSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreditValidationSubmitBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.ProgramPage.SelfReportActTabValidActivityTblBodyVisible);
                    Thread.Sleep(0500);
                    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);
        }