Example #1
0
        /// <summary>
        /// Chooses a learner in the learners table, clicks on the Actions button, clicks on Schedule Progress Meeting, fill in
        /// all of the fields with random data and clicks Submit
        /// </summary>
        /// <param name="learnerFullName"></param>
        public void ScheduleProgressMeeting(string learnerFullName)
        {
            ElemSet.Grid_ClickMenuItemInsideButton(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody, learnerFullName, null, "Actions", "Schedule Progress Meeting");
            Browser.WaitForElement(Bys.CBDProgDirectorPage.SchedProgMeetFormSubjectTxt, ElementCriteria.IsVisible);
            this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);

            ElemSet.ChkBx_ChooseRandom(Browser, UserUtils.ProgAdmin1FullName);

            ElemSet.DatePicker_ChooseDate(Browser, "19", "December", "01");

            SchedProgMeetFormSubjectTxt.SendKeys(DataUtils.GetRandomSentence(10));

            // Generate a random boolean, then use it to randomly check or uncheck the check box and select a recurring meeting or not
            Random gen       = new Random();
            bool   reccuring = gen.Next(100) <= 20 ? true : false;

            if (reccuring)
            {
                SchedProgMeetFormRecurChk.Click();
                Thread.Sleep(0300);
                ElemSet.SelElem_Single_SelectRandomItem(SchedProgMeetFormRecurringSelElem);
            }

            ClickAndWait(SchedProgMeetFormScheduleBtn);
        }
        /// <summary>
        /// The Observation form has required fields that are dynamically different between each form. Because of this, we are going to have to
        /// condition our code to make a selection/TextBoxEnterText whether the controls exist on a form or not. Speaking with Nirav, he said there can
        /// be a maximum of 5 controls on a form. So for example, there can be 4 single select dropdowns and 1 text box. Or 5 multi select
        /// dropdowns. Or 1 text box, 2 multi selects, and 3 single selects. These controls will have IDs as follows: text boxes will have
        /// IDs starting with "Context1freetext" through "Context5freetext". Single select dropdowns will be "Context1" through "Context5",
        /// and  then multi select will be "Context1multiselect" through "Context5multiselect"
        /// </summary>
        private void FillGenericFieldsOnObservationForm()
        {
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric1Txt))
            {
                CompleteAssessFormGeneric1Txt.SendKeys("33");
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric2Txt))
            {
                CompleteAssessFormGeneric2Txt.SendKeys("33");
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric3Txt))
            {
                CompleteAssessFormGeneric3Txt.SendKeys("33");
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric4Txt))
            {
                CompleteAssessFormGeneric4Txt.SendKeys("33");
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric5Txt))
            {
                CompleteAssessFormGeneric5Txt.SendKeys("33");
            }

            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric1SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric1SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric2SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric2SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric3SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric3SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric4SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric4SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric5SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric5SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric6SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric6SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric7SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric7SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric8SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric8SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric9SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric9SelElem);
            }
            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormGeneric10SelElem))
            {
                ElemSet.SelElem_Single_SelectRandomItem(CompleteAssessFormGeneric10SelElem);
            }
        }