/// <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]); }
/// <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); }