public void CourseTracker_Resident_ElectiveCoursePass()
        {
            ///  1.Navigate to the login page login as a AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10021378", "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);
            string   CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            string[] CourseyrackernotNull = CourseTracker.Split(' ');
            int      regCoursCount        = Convert.ToInt16(CourseyrackernotNull[3]);

            Gcep.ScrolltoGetAllCourses();

            string xPathVariable1 = string.Format("//div[@class='activity-info-name']/h4[.='{0}']/../../..//button", "Confidentiality");

            Thread.Sleep(0500);
            IWebElement button1 = browser.FindElement(By.XPath(xPathVariable1));

            ElemSet.ScrollToElement(browser, button1);

            // ElemSet.ScrollToElement(Browser, Browser.FindElement(By.LinkText("AMA TEST")));
            CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, "AUTOMATION_004");

            Gcep = Course.TestPass();
            Gcep.ScrolltoGetAllCourses();

            // Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, "AUTOMATION_003", "View Certificate"), "View Certificet button not visible");

            string CourseTrackerAfterTestCompletion = Gcep.ResidentCourseTrackerLbl.Text;

            string[] courseword3 = CourseTrackerAfterTestCompletion.Split(' ');
            int      CountOfCompletedRegCourseafterPassingTest = Convert.ToInt16(courseword3[3]);

            Assert.True(regCoursCount + 1 == (CountOfCompletedRegCourseafterPassingTest));
        }
Example #2
0
        public void Resident_CourseListing_StartNow()
        {
            ///  1.Navigate to the login page login as
            LoginPage           LP = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED = LP.LoginAsUser("10030248", "password");//30248

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Waiting to course tracker to display and verifying all sort by buttons are displayed and enabled
            Browser.WaitForElement(Bys.GCEPPage.ResidentCourseTrackerLbl, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible);
            Assert.True(Gcep.ResidentGCEPSortBYDueDateBtn.Displayed);
            Assert.True(Gcep.ResidentGCEPSortBYDurationBtn.Displayed);
            Assert.True(Gcep.ResidentGCEPSortBYProgressBtn.Displayed);


            ///  4.If Start Now button disabled then scrol down and click show elective courses
            if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled"))
            {
                Gcep.ScrolltoGetAllCourses();
                Gcep.ResidentGcepShowElectiveCourseLnk.Click();
            }

            ///  5.Scrolling down and saving all courses headers.
            Gcep.ScrolltoGetAllCourses();
            List <string> courseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text));


            ///  6.Getting locked courses headers and comparing with all courses headers by due date if its matching removing locked courses headers
            List <string> lockedCourseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (lockedCourseTitlesByDueDate.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDueDate.Count; i++)
                {
                    for (int j = 0; j < lockedCourseTitlesByDueDate.Count; j++)
                    {
                        if (courseTitlesByDueDate[i] == lockedCourseTitlesByDueDate[j])
                        {
                            courseTitlesByDueDate.Remove(courseTitlesByDueDate[i]);
                        }
                    }
                }
            }

            ///  7.Getting completed courses headers and comparing  with all courses headers by due date if its matching removing completed courses headers.
            List <string> completedCourseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (completedCourseTitlesByDueDate.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDueDate.Count; i++)
                {
                    for (int j = 0; j < completedCourseTitlesByDueDate.Count; j++)
                    {
                        if (courseTitlesByDueDate[i] == completedCourseTitlesByDueDate[j])
                        {
                            courseTitlesByDueDate.Remove(courseTitlesByDueDate[i]);
                        }
                    }
                }
            }

            ///  8.After removing locked courses and completed courses headers getting first course header and saving it.Then clicking start now button
            string firstCourseTitleByDueDate = courseTitlesByDueDate[0];

            ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl);
            CourseTestPage CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn);

            ///  9.getting course name header and comparing with our first course header what saved above and navigating back
            string startedCourseTitleByDueDate = CTP.CourseTitleLbl.Text;

            Assert.AreEqual(firstCourseTitleByDueDate, startedCourseTitleByDueDate);
            Browser.Navigate().Back();
            Gcep.WaitForInitialize();

            Gcep.ResidentGCEPSortBYDurationBtn.Click();
            Gcep.WaitForInitialize();
            if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled"))
            {
                Gcep.ScrolltoGetAllCourses();
                Gcep.ResidentGcepShowElectiveCourseLnk.Click();
            }

            Gcep.ScrolltoGetAllCourses();

            List <string> courseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text));

            List <string> lockedCourseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (lockedCourseTitlesByDuration.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDuration.Count; i++)
                {
                    for (int j = 0; j < lockedCourseTitlesByDuration.Count; j++)
                    {
                        if (courseTitlesByDuration[i] == lockedCourseTitlesByDuration[j])
                        {
                            courseTitlesByDuration.Remove(courseTitlesByDuration[i]);
                        }
                    }
                }
            }

            List <string> completedCourseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (completedCourseTitlesByDuration.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDuration.Count; i++)
                {
                    for (int j = 0; j < completedCourseTitlesByDuration.Count; j++)
                    {
                        if (courseTitlesByDuration[i] == completedCourseTitlesByDuration[j])
                        {
                            courseTitlesByDuration.Remove(courseTitlesByDuration[i]);
                        }
                    }
                }
            }

            string firstCourseTitleByDuration = courseTitlesByDuration[0];

            ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl);
            CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn);

            string startedCourseTitleByDuration = CTP.CourseTitleLbl.Text;

            Assert.AreEqual(firstCourseTitleByDuration, startedCourseTitleByDuration);

            Browser.Navigate().Back();
            Gcep.WaitForInitialize();

            Gcep.ResidentGCEPSortBYProgressBtn.Click();
            Gcep.WaitForInitialize();

            if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled"))
            {
                Gcep.ScrolltoGetAllCourses();
                Gcep.ResidentGcepShowElectiveCourseLnk.Click();
            }

            Gcep.ScrolltoGetAllCourses();

            List <string> courseTitlesProgress = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text));

            List <string> lockedCourseTitlesByProgress = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (lockedCourseTitlesByProgress.Count > 0)
            {
                for (int i = 0; i < courseTitlesProgress.Count; i++)
                {
                    for (int j = 0; j < lockedCourseTitlesByProgress.Count; j++)
                    {
                        if (courseTitlesProgress[i] == lockedCourseTitlesByProgress[j])
                        {
                            courseTitlesProgress.Remove(courseTitlesProgress[i]);
                        }
                    }
                }
            }

            List <string> completedCourseTitlesByProgress = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (completedCourseTitlesByProgress.Count > 0)
            {
                for (int i = 0; i < courseTitlesProgress.Count; i++)
                {
                    for (int j = 0; j < completedCourseTitlesByProgress.Count; j++)
                    {
                        if (courseTitlesProgress[i] == completedCourseTitlesByProgress[j])
                        {
                            courseTitlesProgress.Remove(courseTitlesProgress[i]);
                        }
                    }
                }
            }

            string firstCourseTitleByProgress = courseTitlesProgress[0];

            ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl);
            CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn);

            string startedCourseTitleByProgress = CTP.CourseTitleLbl.Text;

            Assert.AreEqual(firstCourseTitleByProgress, startedCourseTitleByProgress);

            Browser.Navigate().Back();
            Gcep.WaitForInitialize();
        }
        public void MemberBenefits()

        {
            ///  1. Navigate to the login page login as a Manager or AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser(role.Username, role.Password);

            ///  2.click to CGEP link to navigate Gcep page and waiting load icon disappear
            GCEPPage          GCEP = ED.ClickToAdvance(ED.GcepLnk);
            MemberBenefitPage MPG  = GCEP.ClickToAdvance(GCEP.MemberBenefitsManagementLnk);

            ElemSet.ScrollToElement(browser, MPG.FaceBookLnk);

            List <string> benefitTitlesAMAlevel_Published = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            GCEP = MPG.ClickToAdvance(MPG.GMECompetencyEducationProgramLnk);
            GCEP.AdminSwitchBtn.Click();
            GCEP.WaitForInitialize();
            GCEP.ScrolltoGetAllCourses();
            ElemSet.ScrollToElement(Browser, GCEP.FaceBookLnk);

            List <string> benefitTitlesResidentlevel = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            Assert.AreEqual(benefitTitlesAMAlevel_Published, benefitTitlesResidentlevel);



            GCEP.GMECompetencyEducationProgramLnk.Click();
            GCEP.WaitForInitialize();
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                Browser.WaitForElement(Bys.GCEPPage.MemberBenefitsManagementLnk, TimeSpan.FromSeconds(90), ElementCriteria.IsEnabled);
            }

            MPG = GCEP.ClickToAdvance(GCEP.MemberBenefitsManagementLnk);
            List <string> benefitTitlesAMAlevel_Not_Published = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 cross-sell-list-item ng-scope']/div[@class='margin-top-bottom-20 margin-bottom-15 ng-binding']")).Select(ow => ow.Text));

            if (benefitTitlesAMAlevel_Published.Count == benefitTitlesAMAlevel_Not_Published.Count)
            {
                MPG.TitleTxt.SendKeys("newBenefit");
                MPG.URLTxt.SendKeys("www.google.com");
                FileUtils.UploadFileUsingSendKeys(Browser, MPG.MembershipFormBrowseHiddenBtn, Bys.MemberBenefitPage.MembershipFormBrowseHiddenBtn, @"C:\upload\physician_save_0.jpg");
                MPG.SaveBtn.Click();
                MPG.WaitForInitialize();
            }
            ElemSet.ScrollToElement(Browser, MPG.PublishBtn);
            Thread.Sleep(500);
            MPG.PublishBtn.Click();
            MPG.WaitForInitialize();
            List <string> benefitTitlesAMAlevel_Published_firstTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            GCEP = MPG.ClickToAdvance(MPG.GMECompetencyEducationProgramLnk);
            GCEP.ClickToAdvance(GCEP.SignOutLnk);

            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser("10031198", "password");
            GCEP = ED.ClickToAdvance(ED.GcepLnk);

            GCEP.ScrolltoGetAllCourses();
            ElemSet.ScrollToElement(Browser, GCEP.FaceBookLnk);

            List <string> benefitTitlesResidentlevel_firstTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            Assert.AreEqual(benefitTitlesAMAlevel_Published_firstTime, benefitTitlesResidentlevel_firstTime);
            // FileUtils.UploadFileUsingSendKeys(Browser, MPG.MembershipFormBrowseHiddenBtn, Bys.MemberBenefitPage.MembershipFormBrowseHiddenBtn, @"C:\upload\physician_save_0.jpg");
            // MPG.ChooseFileBtn.Click();

            GCEP.ClickToAdvance(GCEP.SignOutLnk);

            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser(role.Username, role.Password);
            GCEP = ED.ClickToAdvance(ED.GcepLnk);
            MPG  = GCEP.ClickToAdvance(GCEP.MemberBenefitsManagementLnk);

            IWebElement benefitToDelete = Browser.FindElement(By.XPath("//div[@class = 'margin-top-bottom-20 margin-bottom-15 ng-binding' and contains (text(),'newBenefit')]/..//span[@class='glyphicon glyphicon-remove cursor-pointer']"));

            benefitToDelete.Click();
            Thread.Sleep(500);
            MPG.AcceptBtn.Click();
            MPG.WaitForInitialize();

            MPG.PublishBtn.Click();
            MPG.WaitForInitialize();


            List <string> benefitTitlesAMAlevel_Published_secondTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            GCEP = MPG.ClickToAdvance(MPG.GMECompetencyEducationProgramLnk);
            GCEP.ClickToAdvance(GCEP.SignOutLnk);

            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser("10031198", "password");
            GCEP = ED.ClickToAdvance(ED.GcepLnk);

            GCEP.ScrolltoGetAllCourses();
            ElemSet.ScrollToElement(Browser, GCEP.FaceBookLnk);

            List <string> benefitTitlesResidentlevel_secondTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            Assert.AreEqual(benefitTitlesAMAlevel_Published_secondTime, benefitTitlesResidentlevel_secondTime);


            Thread.Sleep(15000);
        }
Example #4
0
        public void Resident_CompletedCourse_Listing_AcedemicYear()
        {
            int countOfMatchingCoursesFor2018_2019 = 0;
            int countOfMatchingCoursesFor2017_2018 = 0;
            int countOfMatchingCoursesFor2016_2017 = 0;

            ///  1.Navigate to the login page login as
            LoginPage           LP = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED = LP.LoginAsUser("10031194", "password");//30248

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Waiting to course tracker dislay and getting count of courses if there is not any course assigned assign courses
            Gcep.ResidentGCEPCompletedSwitchBtn.Click();

            Browser.WaitForElement(Bys.GCEPPage.ResidentGCEPAcedimicYearSelElem, TimeSpan.FromSeconds(90), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);

            if (!Gcep.ResidentGCEPTranscriptBtn.GetAttribute("class").Contains("disabled"))
            {
                ///  4.Verifying transcript and certificate buttons are displayed and due date,progress and duration buttons are disabled..
                Assert.IsTrue(Gcep.ResidentGCEPTranscriptBtn.Displayed);
                Assert.IsTrue(Gcep.ResidentGCEPCertificatesDownloadBtn.Displayed);
                Assert.AreEqual("disabled", Gcep.ResidentGCEPSortBYDueDateBtn.GetAttribute("class"));
                Assert.AreEqual("disabled", Gcep.ResidentGCEPSortBYDurationBtn.GetAttribute("class"));
                Assert.AreEqual("disabled", Gcep.ResidentGCEPSortBYProgressBtn.GetAttribute("class"));

                ///  5. Scrolling down to get all information about completed courses.
                Gcep.ScrolltoGetAllCourses();

                ///  6.
                List <string> courseCompletionYears = new List <string>();
                List <string> CompletionDateTextRaw = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-xs-12 col-md-2 activity-status-action']/button/../span[@class='completed-date ng-binding']")).Select(iw => iw.Text));
                for (int i = 0; i < CompletionDateTextRaw.Count; i++)
                {
                    courseCompletionYears.Add(CompletionDateTextRaw[i].Remove(0, 11));
                }


                List <string> selectValueAcedemicYearDropdown        = new List <string>(Browser.FindElements(Bys.GCEPPage.ResidentGCEPAcedimicYearSelElem).Select(IWebElement => IWebElement.Text));
                string        selectValueAcedemicYearDropdownTextRaw = selectValueAcedemicYearDropdown[0].ToString();
                string[]      selectedAcademicYear = null;
                if (BrowserName == BrowserNames.InternetExplorer)
                {
                    selectedAcademicYear = new string[] { "2018-2019", "2017-2018", "2016-2017" };
                }
                else
                {
                    string[] separatingChars = { "All Academic Years\r\n", " ", "\r\n" };
                    selectedAcademicYear = selectValueAcedemicYearDropdownTextRaw.Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries);
                }
                if ("2018-2019" == selectedAcademicYear[0])
                {
                    for (int k = 0; k < courseCompletionYears.Count; k++)
                    {
                        if (Convert.ToDateTime("07 / 01 / 2018") <= Convert.ToDateTime(courseCompletionYears[k]) & Convert.ToDateTime(courseCompletionYears[k]) <= Convert.ToDateTime("06 / 30 / 2019"))
                        {
                            countOfMatchingCoursesFor2018_2019++;
                        }
                    }
                }
                if ("2017-2018" == selectedAcademicYear[1])
                {
                    for (int l = 0; l < courseCompletionYears.Count; l++)
                    {
                        if (Convert.ToDateTime("07 / 01 / 2017") <= Convert.ToDateTime(courseCompletionYears[l]) & Convert.ToDateTime(courseCompletionYears[l]) <= Convert.ToDateTime("06 / 30 / 2018"))
                        {
                            countOfMatchingCoursesFor2017_2018++;
                        }
                    }
                }
                if ("2016-2017" == selectedAcademicYear[2])
                {
                    for (int n = 0; n < courseCompletionYears.Count; n++)
                    {
                        if (Convert.ToDateTime("07 / 01 / 2016") <= Convert.ToDateTime(courseCompletionYears[n]) & Convert.ToDateTime(courseCompletionYears[n]) <= Convert.ToDateTime("06 / 30 / 2017"))
                        {
                            countOfMatchingCoursesFor2016_2017++;
                        }
                    }
                }

                Gcep.ResidentGCEPAcedimicYearSelElem.SelectByIndex(1);
                Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                ElemSet.ScrollToElement(Browser, Gcep.FaceBookLnk);

                if (countOfMatchingCoursesFor2018_2019 == 0)
                {
                    Assert.True(Gcep.ResidentNoCourseBeenCompltetLbl.Displayed);
                }
                else
                {
                    IList <IWebElement> CourseRows = Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']"));
                    int countOfCoursesFirstIndex   = CourseRows.Count;
                    Assert.True(countOfMatchingCoursesFor2018_2019 == countOfCoursesFirstIndex);
                }


                Gcep.ResidentGCEPAcedimicYearSelElem.SelectByIndex(2);
                Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                Gcep.ScrolltoGetAllCourses();


                if (countOfMatchingCoursesFor2017_2018 == 0)
                {
                    Assert.True(Gcep.ResidentNoCourseBeenCompltetLbl.Displayed);
                }
                else
                {
                    IList <IWebElement> CourseRows = Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']"));
                    int countOfCoursesSecondIndex  = CourseRows.Count;
                    Assert.True(countOfMatchingCoursesFor2017_2018 == countOfCoursesSecondIndex);
                }

                Gcep.ResidentGCEPAcedimicYearSelElem.SelectByIndex(3);
                Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                Gcep.ScrolltoGetAllCourses();

                if (countOfMatchingCoursesFor2016_2017 == 0)
                {
                    Assert.True(Gcep.ResidentNoCourseBeenCompltetLbl.Displayed);
                }
                else
                {
                    IList <IWebElement> CourseRows = Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']"));
                    int countOfCoursesThirdIndex   = CourseRows.Count;
                    Assert.True(countOfMatchingCoursesFor2016_2017 == countOfCoursesThirdIndex);
                }
            }
        }