Exemplo n.º 1
0
        public void DashboardNotification_AdminView_ManagerView()
        {
            string notificationNameforAdmin = "";

            if (BrowserName == BrowserNames.Chrome)
            {
                notificationNameforAdmin = "ChromeNotification";
            }
            if (BrowserName == BrowserNames.Firefox)
            {
                notificationNameforAdmin = "FireFoxNotificaton";
            }
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                notificationNameforAdmin = "IENotification";
            }

            ///  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 and waiting load icon disappear and initializing page.
            GCEPPage GCEP = ED.ClickToAdvance(ED.GcepLnk);

            ///  3.From CGEPPage clicking Dashboard Notification Management link
            if (BrowserName == BrowserNames.Chrome)
            {
                Browser.WaitForElement(Bys.GCEPPage.UserManageLnk, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            }
            DashboardNotificationsPage DNP = GCEP.ClickToAdvance(GCEP.DashboardNotificationManageLnk);

            ///  4.On Dashboard notification page searching notification with the same name what we are planning to create if its exist delete and after that,
            ///  clicking create notification button and navigating NotificationCreate page
            DNP.Search(notificationNameforAdmin);
            DNP.DeleteNotification();
            NotificationCreatorPage NCP = DNP.ClickToAdvance(DNP.CreateNotificationBtn);

            ///  5.Creating notification for Admin and Manager with the different name based on browser.
            NCP.NotificationNameTxt.SendKeys(notificationNameforAdmin);
            AssignProgramPage PP = new AssignProgramPage(Browser);

            PP.ChoosingStartDate();
            PP.ChoosingEndDate(1, "MM/dd/yyyy");

            NCP.AdminsRdo.Click();

            string notificationTitleAdmin = NCP.CreateRandomString(12);

            NCP.NotificatioTitleTxt.SendKeys(notificationTitleAdmin);

            NCP.NotificationBodyTxt.SendKeys(NCP.CreateRandomString(38));
            DNP = NCP.ClickToAdvance(NCP.SaveExitBtn);

            string notificationNameforManager = "";

            if (BrowserName == BrowserNames.Chrome)
            {
                notificationNameforManager = "ChromeNotificationManager";
            }
            if (BrowserName == BrowserNames.Firefox)
            {
                notificationNameforManager = "FireFoxNotificatonManager";
            }
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                notificationNameforManager = "IENotificationManager";
            }


            GCEP = DNP.ClickToAdvance(DNP.GMECompetencyEducationProgramLnk);

            DNP = GCEP.ClickToAdvance(GCEP.DashboardNotificationManageLnk);

            DNP.Search(notificationNameforManager);
            DNP.DeleteNotification();

            NCP = DNP.ClickToAdvance(DNP.CreateNotificationBtn);

            NCP.NotificationNameTxt.SendKeys(notificationNameforManager);

            PP = new AssignProgramPage(Browser);
            PP.ChoosingStartDate();
            PP.ChoosingEndDate(1, "MM/dd/yyyy");

            NCP.ManagersRdo.Click();

            string notificationTitleManager = NCP.CreateRandomString(12);

            NCP.NotificatioTitleTxt.SendKeys(notificationTitleAdmin);

            NCP.NotificationBodyTxt.SendKeys(NCP.CreateRandomString(38));
            DNP = NCP.ClickToAdvance(NCP.SaveExitBtn);

            ///  6.Navigating Institutions Page
            GCEP = DNP.ClickToAdvance(DNP.GMECompetencyEducationProgramLnk);
            InstitutionsPage INS = GCEP.ClickToAdvance(GCEP.InstitutionManagLnk);

            ///  7.Searching for institution and navigating Institution GCEP.
            InstitutionsGCEPPage INSGCEP = INS.SearchforInstitutions("Arrowhead Regional Medical Center");

            if (BrowserName == BrowserNames.InternetExplorer)
            {
                Browser.WaitForElement(Bys.AMAPage.GCEPNotificationsBtn, TimeSpan.FromSeconds(90), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                //Thread.Sleep(5000);
            }

            ///  8.If notofications are displayed verify our last created is displayed with (title name is verification) if not displayed click notifications chevron and verify notification is there.
            if (!INSGCEP.NotificationTitlesLbl.Displayed)
            {
                INSGCEP.GCEPNotificationsBtn.Click();
            }
            Assert.True(INSGCEP.VerifyNotificationTitle(INSGCEP.NotificationTitlesLbl, notificationTitleAdmin));

            ///  9.From Institution GCEP Page navigating Program management page searching for program and navigating program manager GCEP page.
            ProgramsPage ProgP = INSGCEP.ClickToAdvance(INSGCEP.InstitutionProgramManagmentLnk);

            ProgP.SearchforProgram("ARMC Faculty");

            ///  10.If notofications are displayed verify our last created is displayed with (title name is verification) if not displayed click notifications chevron and verify notification is there
            if (!GCEP.NotificationTitlesLbl.Displayed)
            {
                GCEP.GCEPNotificationsBtn.Click();
            }
            Assert.True(INSGCEP.VerifyNotificationTitle(INSGCEP.NotificationTitlesLbl, notificationTitleAdmin));

            ///  11.navigating GCEP page Clicking dashboard notification links.
            GCEP.GMECompetencyEducationProgramLnk.Click();
            GCEP.WaitForInitialize();
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                Browser.WaitForElement(Bys.GCEPPage.DashboardNotificationManageLnk, TimeSpan.FromSeconds(90), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            }
            ///  12.Entering dashboard notification page searching for notifications created above and deleting them.
            DNP = GCEP.ClickToAdvance(GCEP.DashboardNotificationManageLnk);
            DNP.Search(notificationNameforAdmin);
            DNP.DeleteNotification();
        }
Exemplo n.º 2
0
        public void DashboardNotification()
        {
            string notificationName = "";

            if (BrowserName == BrowserNames.Chrome)
            {
                notificationName = "ChromeNoteName";
            }
            if (BrowserName == BrowserNames.Firefox)
            {
                notificationName = "FireFoxNoteName";
            }
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                notificationName = "IENoteName";
            }

            ///  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 and waiting load icon disappear
            GCEPPage GCEP = ED.ClickToAdvance(ED.GcepLnk);

            // Assert.False(GCEP.DashBoardDirectiveLbl.Displayed);
            // string NotificationText = GCEP.DashBoardDirectiveLbl.Text;


            ///  3.From CGEPPage clicking Dashboard Notification Management link
            if (BrowserName == BrowserNames.Chrome)
            {
                Browser.WaitForElement(Bys.GCEPPage.UserManageLnk, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            }
            DashboardNotificationsPage DNP = GCEP.ClickToAdvance(GCEP.DashboardNotificationManageLnk);

            ///  4.On Dashboard notification page searching notification with the same name what we are planning to create if its exist delete and after that,
            ///  clicking create notification button and navigating NotificationCreate page
            DNP.Search(notificationName);
            DNP.DeleteNotification();
            NotificationCreatorPage NCP = DNP.ClickToAdvance(DNP.CreateNotificationBtn);

            ///  5.Creating notification each browser will create unique notification and for 3 diffeerent role
            NCP.NotificationNameTxt.SendKeys(notificationName);
            AssignProgramPage PP = new AssignProgramPage(Browser);

            PP.ChoosingStartDate();
            PP.ChoosingEndDate(1, "MM/dd/yyyy");
            if (BrowserName == BrowserNames.Chrome)
            {
                NCP.AdminsRdo.Click();
            }
            else if (BrowserName == BrowserNames.InternetExplorer)
            {
                NCP.ResidentsRdo.Click();                                   // NCP.ManagersRdo.Click();
            }
            else
            {
                NCP.ManagersRdo.Click();                                    // NCP.ResidentsRdo.Click();
            }
            NCP.NotificatioTitleTxt.SendKeys(NCP.CreateRandomString(12));
            NCP.NotificationBodyTxt.SendKeys(NCP.CreateRandomString(38));
            DNP = NCP.ClickToAdvance(NCP.SaveExitBtn);

            ///  6.After creating notification signing out.
            DNP.ClickToAdvance(DNP.SignOutLnk);

            ///  7.Naviagting to login page signing in depends on the browser and since each browser create different notification each browser login with different role.
            LP = Navigation.GoToLoginPage(browser);
            if (BrowserName == BrowserNames.Chrome)
            {
                ED = LP.LoginAsUser("10031301", role.Password);//all notifications are here
            }
            else if (BrowserName == BrowserNames.InternetExplorer)
            {
                ED = LP.LoginAsUser("10021387", role.Password);       //10020462  10031037
            }
            else
            {
                ED = LP.LoginAsUser("10031037", role.Password);        //10021387
            }


            ///  8.Navigatin to GCEP page and verifying notification dashboard is displayed or notification container not empty.
            GCEP = ED.ClickToAdvance(ED.GcepLnk);
            // GCEP.WaitForInitialize();
            if (BrowserName == BrowserNames.Chrome)
            {
                Browser.WaitForElement(Bys.GCEPPage.UserManageLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                Thread.Sleep(1500);
            }
            GCEP.GCEPNotificationsBtn.Click();
            Assert.True(GCEP.DashBoardDirectiveLbl.Displayed, "Dashboard Notification not displayed");
            IList <IWebElement> DashBoardNotificationContainer = GCEP.DashBoardDirectiveLbl.FindElements(By.XPath(".//li"));
            int ResidentDashboardNotificationCount             = DashBoardNotificationContainer.Count;

            Assert.True(DashBoardNotificationContainer.Count >= 1);

            ///  9.Sign out and login as a AMA_Staff navigating to GCEP page
            GCEP.ClickToAdvance(GCEP.SignOutLnk);
            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser(role.Username, role.Password);
            GCEP = ED.ClickToAdvance(ED.GcepLnk);

            ///  10.On GCEP Page clicking  Dashboard Notification Management link and navigating DashboardNotificationPage
            DNP = GCEP.ClickToAdvance(GCEP.DashboardNotificationManageLnk);

            ///  11.On DashboardNotificationPage searching for notification what we created and deleting notification and signing out
            DNP.Search(notificationName);
            DNP.DeleteNotification();
            DNP.ClickToAdvance(DNP.SignOutLnk);

            ///  12.Navigating login page and logging in depends on browser with different Role
            LP = Navigation.GoToLoginPage(browser);
            if (BrowserName == BrowserNames.Chrome)
            {
                ED = LP.LoginAsUser("10031301", role.Password);
            }
            else if (BrowserName == BrowserNames.InternetExplorer)
            {
                ED = LP.LoginAsUser("10021387", role.Password);                 //10031037
            }
            else
            {
                ED = LP.LoginAsUser("10031037", role.Password);                //10021387
            }


            ///  13.Navigating to GCEP page
            GCEP = ED.ClickToAdvance(ED.GcepLnk);
            //GCEP.WaitForInitialize();

            if (BrowserName == BrowserNames.Chrome)
            {
                Browser.WaitForElement(Bys.GCEPPage.UserManageLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                Thread.Sleep(1500);
            }
            // Thread.Sleep(2000);
            ///  14.Verifying that notification is no more exist.
            if (GCEP.GCEPNotificationsBtn.Displayed)
            {
                if (!GCEP.NotificationTitlesLbl.Displayed)
                {
                    GCEP.GCEPNotificationsBtn.Click();
                }

                IList <IWebElement> DashBoardNotificationContainerFinal = GCEP.DashBoardDirectiveLbl.FindElements(By.XPath(".//li"));
                int ResidentDashboardNotificationCountFinal             = DashBoardNotificationContainerFinal.Count;

                Assert.True(ResidentDashboardNotificationCount > ResidentDashboardNotificationCountFinal);
            }
            else
            {
                Assert.True(true, "Dashboard notitfication was deleted not displaying any notofications");
            }
        }