Ejemplo n.º 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);
        }
Ejemplo n.º 2
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 random date and clicks Create to create the new agenda. Returns the agenda name that was created
        /// </summary>
        public string CreateUpcomingAgendaWithRandomDate()
        {
            // 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);
            }

            // First get a list of all existing agendas, so that we can filter these out when we return the new agenda that we create below
            // Note that DEV may redesign creating agendas, and if they do, this wont be needed, because we may then be able to see the
            // agenda name at creation. See JIRA bug RCPSC-547
            List <string> existingAgendas = ElemGet.SelElem_ListTextToListString(MeetingAgendaSelElem);

            // Open the form
            ActionsBtn.Click();
            ClickAndWait(CreateNewAgendaLnk);

            // The calendar control limits a user to have a maximum of 9 agendas on a certain day. So we have to generate a random day,
            // then use it to create an upcoming agenda. We will also handle the situation where we hit the max per day by looping
            // and IF statement

            // First get the amount of days between tomorrow and 3 years from now because this is the furthest the date control will
            // allow you to select. Then use that amount to do the loop
            int daysCount = (DateTime.Now.AddYears(2).AddMonths(11).AddDays(27) - DateTime.Now.AddDays(1)).Days;

            for (int i = 0; i < daysCount; i++)
            {
                // Choose the date and click on Create
                Dictionary <string, string> dates = DataUtils.GetDateForCalendarElem(GetRandomDateForCreateNewAgendaFormDateControl());
                ElemSet.DatePicker_ChooseDate(Browser, dates["year"], dates["month"], dates["day"]);

                ClickAndWait(CreateNewAgendaFormCreateBtn);

                // If the warning message appears, continue in the loop to choose another date, else break
                if (Browser.Exists(Bys.CBDProgDirectorPage.CreateNewAgendaFormMaxNumOfAgendasLbl, ElementCriteria.IsVisible))
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            // Compare the existing agewnda list with the list at this moment and extract the new item that was inserted after we created it above
            List <string> existingAgendasPlusNewAgenda = ElemGet.SelElem_ListTextToListString(MeetingAgendaSelElem);
            List <string> differences = existingAgendasPlusNewAgenda.Except(existingAgendas).ToList();

            return(differences[0]);
        }
Ejemplo n.º 3
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>
        /// 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")));
        }