예제 #1
0
        public void TestCount()
        {
            string InstitutionName = "Temple University Hospital";

            Browser.Navigate().GoToUrl("https://cme.ama-assn.org");
            IWebElement ProdUserNameTxt = Browser.FindElement(By.Id("go_username"));
            IWebElement ProdPasswordTxt = Browser.FindElement(By.Id("go_password"));
            IWebElement ProdLoginBtn    = Browser.FindElement(By.XPath("//input[@value='Sign In']"));

            ProdUserNameTxt.Clear();
            ProdUserNameTxt.SendKeys("jpenderville");
            ProdPasswordTxt.Clear();
            ProdPasswordTxt.SendKeys("password1");   //div[@role='gridcell' and @ng-if='row.entity.Users > 0']/a
            ProdLoginBtn.Click();
            EducationCenterPage ED = new EducationCenterPage(Browser);

            Browser.WaitForElement(Bys.EducationCenterPage.CourseTbl, ElementCriteria.IsEnabled, ElementCriteria.IsVisible);
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            int             countOfCurriculumsOnGcep = Convert.ToInt32(Gcep.TotalCurriculumTmtsCountLnk.Text);
            int             countOfTotalUsers        = Convert.ToInt32(Gcep.TotalUsersCountLnk.Text);
            GCEPUserMngPage GUMP = Gcep.ClickToAdvance(Gcep.UserManageLnk);
            int             CountOfUsersOnUserMngPage = GUMP.GetCountOfUsersFromUserManagementLabel();

            Assert.AreEqual(countOfTotalUsers, CountOfUsersOnUserMngPage, "Counts of Users are not the same");

            Gcep = GUMP.ClickToAdvance(GUMP.AdministrationLnk);
            CurriculumMngPage CMP = Gcep.ClickToAdvance(Gcep.CurriculumTemplatesLnk);
            int countofCurriculumTemplatesFromCurriculumTemplatesPage = CMP.GetCountOfCurriculumonTable("of", "items");

            Assert.AreEqual(countOfCurriculumsOnGcep, countofCurriculumTemplatesFromCurriculumTemplatesPage, "Count of Curriculum Templates are not equals on GCEP page with CurriculumMngPage");
            Gcep = CMP.ClickToAdvance(CMP.AdministrationLnk);
            InstitutionsPage IP = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk);

            IP.Search(InstitutionName);
            string xPathVariableForUserCount         = string.Format("//*[text()='{0}']/../../../../div/div[3]", InstitutionName); //div[@role='gridcell' and contains (text(),'')]/a[@ng-if='row.entity.Users > 0']
            string xPathVariableForProgramCount      = string.Format("//*[text()='{0}']/../../../../div/div[4]", InstitutionName); //div[@role='gridcell' and contains (text(),'')]/a[@ng-if='row.entity.Programs > 0']
            int    usersCountFromInstitutionsPage    = Convert.ToInt32(Browser.FindElement(By.XPath(xPathVariableForUserCount)).Text);
            int    programsCountFromInstitutionsPage = Convert.ToInt32(Browser.FindElement(By.XPath(xPathVariableForProgramCount)).Text);

            InstitutionsGCEPPage IGP = IP.SearchforInstitutions(InstitutionName);
            int usersCountFromInstitutionsGCEPPage    = Convert.ToInt32(IGP.TotalUserCountLnk.Text);
            int programsCountFromInstitutionsGCEPPage = Convert.ToInt32(IGP.TotalProgramCountLnk.Text);

            // Assert.AreEqual(usersCountFromInstitutionsPage, usersCountFromInstitutionsGCEPPage, "Count of user are not equals  on Institutions table with InstitutionGCEP page");
            // Assert.AreEqual(programsCountFromInstitutionsPage, programsCountFromInstitutionsGCEPPage, "Count of programs are not equals on Institutions table with InstitutionGCEP page");

            ProgramsPage PP = IGP.ClickToAdvance(IGP.InstitutionProgramManagmentLnk);
            int          countsOfProgramsOnPP = PP.Grid_GetCountOfItemsOnTable("of", "items");

            // Assert.AreEqual(programsCountFromInstitutionsPage, countsOfProgramsOnPP);

            IGP  = PP.ClickToBreadCrumbContainerToReturnInsGCEP(InstitutionName);
            GUMP = IGP.ClickToAdvance(IGP.InstitutionUserManagementLnk);
            int CountOfUsersOnUserMngPageForIns = GUMP.GetCountOfUsersFromUserManagementLabel();

            //Assert.AreEqual(usersCountFromInstitutionsPage, CountOfUsersOnUserMngPageForIns);

            Assert.True(DataUtils.intsEqual(usersCountFromInstitutionsPage, usersCountFromInstitutionsGCEPPage, CountOfUsersOnUserMngPageForIns));
            Assert.True(DataUtils.intsEqual(countsOfProgramsOnPP, programsCountFromInstitutionsGCEPPage, programsCountFromInstitutionsPage));
            Thread.Sleep(5000);
        }
예제 #2
0
        public void Checking_AllCounts_FromGcep()
        {
            ///  1.Navigate to the login page with valid credentials below
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser(role.Username, role.Password);

            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
            }
            ///  2.click to CGEP link  navigate to Gcep page and waiting load icon disappear and getting count of curriculum templates
            GCEPPage GCEP = ED.ClickToAdvance(ED.GcepLnk);
            int      countOfCurriculumTemplatesFromGCEP = Convert.ToInt32(GCEP.TotalCurriculumTmtsCountLnk.Text);

            ///  3.From GCEP Navigate to Curriculum Template saving count of curriculum on the table and verifying counts of curriculum from GCEP are equals
            CurriculumMngPage CMP = GCEP.ClickToAdvance(GCEP.CurriculumTemplatesLnk);
            int countofCurriculumTemplatesFromPage = CMP.GetCountOfCurriculumonTable("of", "items");

            //string something = CMP.CountTableItemLbl.Text;
            //something = new string(something.Where(x => char.IsDigit(x)).ToArray());
            Assert.AreEqual(countOfCurriculumTemplatesFromGCEP, countofCurriculumTemplatesFromPage);

            /// 4.Navigating back to GCEP
            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.Navigate().Back();
            }
            CMP.GMECompetencyEducationProgramLnk.Click();  //AdministrationLnk.Click();
            GCEP.WaitForInitialize();
            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.GCEPPage.InstitutionManagLnk, ElementCriteria.IsEnabled);
            }

            ///  5.from Gcep navigating to institution managment searching for institution
            InstitutionsPage     Instute = GCEP.ClickToAdvance(GCEP.InstitutionManagLnk);
            InstitutionsGCEPPage InsGcep = Instute.SearchforInstitutions("Albert Einstein Medical Center");

            ///  6.Saving counts of program,user,curriculum template from Institution GCEP
            int totalProgramCountonGCEP = Convert.ToInt32(InsGcep.TotalProgramCountLnk.Text);
            int totalUsersCountonGCEP   = Convert.ToInt32(InsGcep.TotalUserCountLnk.Text);
            int totalCurTempCountonGCEP = Convert.ToInt32(InsGcep.TotalCurriculumTemplatesCountLnk.Text);

            ///  7.Navigating Program Management Page and getting counts of Programs Page and comparing countsof program from Institution GCEP page.
            ProgramsPage PP = InsGcep.ClickToAdvance(InsGcep.InstitutionProgramManagmentLnk);
            int          countsOfProgramsOnPP = PP.Grid_GetCountOfItemsOnTable("of", "items");

            Assert.AreEqual(totalProgramCountonGCEP, countsOfProgramsOnPP);

            ///  8.Navigating to Institution GCEP Page
            InsGcep = PP.ClickToBreadCrumbContainerToReturnInsGCEP("Albert Einstein Medical Center");

            ///  9.From Instution GCEP clicking user management link and navigating GCEP User Management page getting counts of users from User Management table
            ///  verifying counts of users count are equals from Institution GCEP and Users Management Page.
            GCEPUserMngPage GUMP = InsGcep.ClickToAdvance(InsGcep.InstitutionUserManagementLnk);
            int             CountOfUsersOnUserMngPage = GUMP.GetCountOfUsersFromUserManagementLabel();

            Assert.AreEqual(totalUsersCountonGCEP, CountOfUsersOnUserMngPage);

            ///  10.Navigating to Institution GCEP Page
            InsGcep = GUMP.ClickToBreadCrumbContainerToReturnInsGCEP("Albert Einstein Medical Center");

            ///  11.From Institutiom GCEP clicking curriculum templates and navigating Curriculum Mng Page and getting count of curriculum templates and asserting
            ///  counts of curriculum template from Institution GCEP page are equals.
            CMP = InsGcep.ClickToAdvance(InsGcep.InstitutionCurriculumTmpLnk);
            int countOfCurTempFromCurrimMngPage = CMP.Grid_GetCountOfItemsOnTable("of", "items");

            Assert.AreEqual(totalCurTempCountonGCEP, countOfCurTempFromCurrimMngPage);
        }