예제 #1
0
        public void MultyInstitution_HelpPageVerification()
        {
            ///  1.Navigate to the login page login as Admin with availability manage multy Institutions
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10016185", "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);

            ///  3.Saving all Institutions from drop down in list of strings and Sign Out
            List <string> institutions = ElemGet.SelElem_ListTextToListString(Gcep.InstitutionSelElem);

            Gcep.ClickToAdvance(Gcep.SignOutLnk);

            ///  4.Sign in again as Ama staff searching for all Institution what we saved on previous step.
            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser(role.Username, role.Password);
            Gcep = ED.ClickToAdvance(ED.GcepLnk);
            InstitutionsPage IP = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk);

            ///  5.Getting contact emails for each institution saving them and Sign out.
            List <string> institutionContactEmailAdress = new List <string>();

            institutionContactEmailAdress = HelperMethods.GetTheInstutionsEmail(Browser, institutions);

            ///  6.Login as Admin who manages multyple Institution choosing each Institution and comparing contact email adresses.
            // if(BrowserName == BrowserNames.InternetExplorer) { IP.HeaderMenuDropDown.SendKeys(Keys.Tab); }
            IP.HeaderMenuDropDown.Click();
            IP.SignOutLnk.Click();
            Thread.Sleep(2000);
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                Thread.Sleep(2000);
            }
            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser("10016185", "password");
            Gcep = ED.ClickToAdvance(ED.GcepLnk);
            HelpPage HP = Gcep.ClickToAdvance(Gcep.HelpfromYourInstitutionLnk);

            // HelpPage HP = Gcep.ClickToAdvance(Gcep.HelpLnk);

            ///  7.Verifiying emails are correct on help page for each Institution.
            //Assert.True(HP.AdministrationLnk.Displayed);
            //Assert.True(HP.AdminWatchVideoLnk.Displayed);
            Assert.IsTrue(HelperMethods.ComparingInstitutionEmailsWithHelpContactEmails(Browser, institutions, institutionContactEmailAdress));
        }
예제 #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]);
        }