public void SelectTheProgramCourseFromGlobalHomePage()
 {
     try
     {
         bool announcementClose = GenericHelper.CloseAnnouncementPage();
         if (announcementClose)
         {
             GenericHelper.Logs("Annoucement page has been closed successfully", "Passed");
         }
         else
         {
             GenericHelper.Logs("Annoucement page is still not closed", "Failed");
         }
         string courseName = DatabaseTools.GetCourse(Enumerations.CourseType.ProgramCourse).Trim();
         GenericHelper.WaitUntilElement(By.PartialLinkText(courseName));
         WebDriver.FindElement(By.PartialLinkText(courseName)).SendKeys("");
         WebDriver.FindElement(By.PartialLinkText(courseName)).Click();
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         GenericStepDefinition.ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
         Assert.Fail(string.Format("Exception of type {0} cau" + "ght: {1}", e.GetType(), e.Message));
     }
 }
Exemple #2
0
 //Purpose: To select the course in global home page As Teacher
 public void ClickOnCourseAsTeacher()
 {
     try
     {
         WebDriver.SwitchTo().Window(WebDriver.WindowHandles.First());
         if (GenericHelper.IsElementPresent(By.Id("lightboxid")))
         {
             bool isAnnouncementClose = GenericHelper.CloseAnnouncementPage();
             if (isAnnouncementClose)
             {
                 GenericHelper.Logs("Announcement Pop up has been closed successfully", "Passed");
             }
             else
             {
                 GenericHelper.Logs("Announcement Pop up has not been closed", "Failed");
             }
         }
         GenericHelper.WaitUntilElement(By.ClassName("cssQuickLink"));
         bool isClassPresent = GenericHelper.IsElementPresent(By.ClassName("cssQuickLink"));
         if (isClassPresent)
         {
             WebDriver.FindElement(By.ClassName("cssQuickLink")).Click();
         }
         else
         {
             GenericHelper.Logs("Class not visible to the Teacher, so unable to proceed.", "FAILED");
             Assert.Fail("Class not visible to the Teacher, so unable to proceed.");
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         throw new Exception(e.ToString());
     }
 }
Exemple #3
0
        //Purpose : to Select the class created using template option in Global home page
        public void SelectTemplateClass()
        {
            try
            {
                WebDriver.SwitchTo().Window(WebDriver.WindowHandles.First());
                if (GenericHelper.IsElementPresent(By.Id("lightboxid")))
                {
                    bool isAnnouncementClose = GenericHelper.CloseAnnouncementPage();
                    if (isAnnouncementClose)
                    {
                        GenericHelper.Logs("Announcement Pop up has been closed successfully", "Passed");
                    }
                    else
                    {
                        GenericHelper.Logs("Announcement Pop up has not been closed", "Failed");
                    }
                }
                GenericHelper.WaitUntilElement(By.Id("tblMain"));
                int    classCount = WebDriver.FindElements(By.XPath("//table[@id='tblMain']/tbody/tr")).Count;
                string classname  = string.Empty;
                for (int i = 1; i <= classCount; i++)
                {
                    if (Browser.Equals("IE"))
                    {
                        classname = WebDriver.FindElement(By.XPath("//table[@id='tblMain']/tbody/tr[" + i.ToString(CultureInfo.InvariantCulture) + "]")).GetAttribute("innerText");
                    }
                    if (Browser.Equals("FF") || Browser.Equals("GC"))
                    {
                        classname = WebDriver.FindElement(By.XPath("//table[@id='tblMain']/tbody/tr[" + i.ToString(CultureInfo.InvariantCulture) + "]")).Text;
                    }

                    if (classname.Contains(DatabaseTools.GetClass(Enumerations.ClassType.NovaNETTemplate)))
                    {
                        if (Browser.Equals("FF") || Browser.Equals("IE"))
                        {
                            WebDriver.FindElement(By.XPath("//table[@id='tblMain']/tbody/tr[" + i.ToString(CultureInfo.InvariantCulture) + "]/td/div/table/tbody/tr/td/div/div")).SendKeys("");
                        }
                        WebDriver.FindElement(By.XPath("//table[@id='tblMain']/tbody/tr[" + i.ToString(CultureInfo.InvariantCulture) + "]/td/div/table/tbody/tr/td/div/div")).Click();
                        break;
                    }
                    else if (i == classCount)
                    {
                        GenericHelper.Logs(DatabaseTools.GetClass(Enumerations.ClassType.NovaNETTemplate) + " class not found in global home page", "FAILED");
                    }
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                throw new Exception(e.ToString());
            }
        }
 // Purpose: To Select the Class name the Global Home page
 public void ToSelectClassName()
 {
     WebDriver.SwitchTo().Window(WebDriver.WindowHandles.First());
     if (GenericHelper.IsElementPresent(By.Id("lightboxid")))
     {
         bool isAnnouncementClose = GenericHelper.CloseAnnouncementPage();
         if (isAnnouncementClose)
         {
             GenericHelper.Logs("Announcement Pop up has been closed successfully", "Passed");
         }
         else
         {
             GenericHelper.Logs("Announcement Pop up has not been closed", "Failed");
         }
     }
     GenericHelper.WaitUntilElement(By.ClassName("NNclassesname"));
     WebDriver.FindElement(By.ClassName("NNclassesname")).Click();
 }
 public void WhenIEnrollTheStudentInToTheSection()
 {
     try
     {
         GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent");
         GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent();
         GenericTestStep.StepToCloseStudentHelpTextWindow();
         GenericHelper.SelectWindow("Global Home");
         WebDriver.SwitchTo().DefaultContent();
         GenericHelper.CloseAnnouncementPage();
         GenericTestStep.StepToEnrolStudentToCourse("ProductTypeProg");
         GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
        /// <summary>
        /// this method is for the selection of section name from the global home page
        /// </summary>
        public void ToSelectSectionName()
        {
            bool isAnnouncementClosed = GenericHelper.CloseAnnouncementPage();

            if (isAnnouncementClosed)
            {
                GenericHelper.Logs("Announcement page is closed", "Passed");
            }
            else
            {
                GenericHelper.Logs("Announcement page is not closed", "Passed");
                Assert.Fail("Annoucement Page is not closed");
            }
            int    divNo      = 1;
            string courseName = DatabaseTools.GetSectionName(Enumerations.CourseType.ProgramCourse);

            GenericHelper.SelectWindow("Global Home");
            Assert.AreEqual("Global Home", WebDriver.Title);
            GenericHelper.WaitUntilElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]"));
            IWebElement courseTable = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]"));

            if (!courseTable.Text.Contains(courseName))
            {
                while (!courseTable.Text.Contains(courseName))
                {
                    divNo = divNo + 1;
                    string divdata = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]")).Text;
                    if (divdata.Contains(courseName))
                    {
                        GenericHelper.WaitUntilElement(By.PartialLinkText(courseName));
                        WebDriver.FindElement(By.PartialLinkText(courseName)).SendKeys("");
                        WebDriver.FindElement(By.PartialLinkText(courseName)).Click(); break;
                    }
                }
            }
            else
            {
                GenericHelper.Logs(string.Format("Course '{0}' not found on global home page.", courseName), "FAILED");
                Assert.Fail(string.Format("Course '{0}' not found on global home page.", courseName));
            }
        }
Exemple #7
0
 //Purpose: To select the course in global home page As Student
 public void ClickOnCourseAsStudent()
 {
     try
     {
         WebDriver.SwitchTo().Window(WebDriver.WindowHandles.First());
         if (GenericHelper.IsElementPresent(By.Id("lightboxid")))
         {
             bool isAnnouncementClose = GenericHelper.CloseAnnouncementPage();
             if (isAnnouncementClose)
             {
                 GenericHelper.Logs("Announcement Pop up has been closed successfully", "Passed");
             }
             else
             {
                 GenericHelper.Logs("Announcement Pop up has not been closed", "Failed");
             }
         }
         GenericHelper.WaitUntilElement(By.ClassName("CourseNameFont"));
         bool isClassPresent = GenericHelper.IsElementPresent(By.ClassName("CourseNameFont"));
         if (isClassPresent)
         {
             WebDriver.FindElement(By.ClassName("CourseNameFont")).Click();
             Thread.Sleep(10000);
             if (!WebDriver.Url.Contains("TodaysViewUX"))
             {
                 WebDriver.FindElement(By.ClassName("CourseNameFont")).Click();
                 Thread.Sleep(10000);
             }
         }
         else
         {
             GenericHelper.Logs("Class not visible to the Student, so unable to proceed.", "FAILED");
             Assert.Fail("Class not visible to the Student, so unable to proceed.");
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         throw new Exception(e.ToString());
     }
 }
        /// <summary>
        /// Purpose - To Create Instructor Type Course
        /// </summary>
        /// <param name="courseType"></param>
        public void ToCreateCatalogCourse(string courseType)
        {
            try
            {
                GenericHelper.SelectWindow("Global Home");
                Assert.AreEqual("Global Home", WebDriver.Title);
                bool announcementClose = GenericHelper.CloseAnnouncementPage();
                if (announcementClose)
                {
                    GenericHelper.Logs("Annoucement page has been closed successfully", "Passed");
                }
                else
                {
                    GenericHelper.Logs("Annoucement page is still not closed", "Failed");
                }

                GenericHelper.WaitUntilElement(By.PartialLinkText("Search Catalog"));
                WebDriver.FindElement(By.PartialLinkText("Search Catalog")).Click();
                WebDriver.SwitchTo().DefaultContent();
                // Purpose: Calling Page Class Method
                string courseName = CourseCatalogMainPage.AddCourseInCatalog(courseType);
                if (courseName == null)
                {
                    throw new ArgumentNullException("instructor" + "CourseName is null");
                }
                // Purpose: Calling Page Class Method
                CourseCatalogMainPage.ToVerifyCourseMailError();
                // Purpose: To Verify Course State
                bool isInactiveStatePresent = ToVerifyInactiveCourseState();
                if (isInactiveStatePresent)
                {
                    //Purpose: To Validate Course Created Successfully
                    string isCourseCreated = WebDriver.FindElement(By.Id("tblCourse")).Text;
                    if (isCourseCreated.Contains(courseName))
                    {
                        if (courseType.Equals("ProductTypeProg"))
                        {
                            DatabaseTools.UpdateCourse(Enumerations.CourseType.ProgramCourse, courseName);
                        }
                        if (courseType.Equals("MasterCourse"))
                        {
                            DatabaseTools.UpdateCourse(Enumerations.CourseType.InstructorCourse, courseName);
                        }
                        //Purpose: Update User Enrollment Status in DB
                        DatabaseTools.UpdateUserEnrollStatusTrue(_getSMSInstructor);
                        GenericHelper.Logs(string.Format("Course '{0}' has created successfully and showing in instructor global home page.", courseName), "PASSED");
                    }
                }
                else
                {
                    GenericHelper.Logs("Course has not created successfully and showing in instructor global home page.", "FAILED");
                    Assert.Fail("Course has not created successfully and showing in instructor global home page.");
                }
                if (courseType.Equals("MasterCourse"))
                {
                    string getInstructorCourseID = ToGetInstructorCourseID();
                    if (getInstructorCourseID == null)
                    {
                        throw new ArgumentNullException("getInstruc" + "torID is null");
                    }
                    {
                        //Purpose: Update Enroll Course ID in DB
                        DatabaseTools.UpdateEnrolCourseID(courseName, getInstructorCourseID);
                    }
                }
                if (courseType.Equals("ProductTypeProg"))
                {
                    ToGetProgramSectionID();
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "Failed");
                GenericHelper.WaitUntilElement(By.CssSelector("#btnCancel > span > span"));
                WebDriver.FindElement(By.CssSelector("#btnCancel > span > span")).Click();
                WebDriver.SwitchTo().DefaultContent();
                GenericHelper.SelectWindow("Global Home");
                Assert.Fail(e.ToString());
            }
        }
        /// <summary>
        /// Purpose: To Enrol Student In the Instructor Course
        /// </summary>
        public void ToEnrolTheStudentToCourse(string courseType)
        {
            string courseName  = DatabaseTools.GetCourse(Enumerations.CourseType.InstructorCourse);
            string ProgramName = DatabaseTools.GetSectionName(Enumerations.CourseType.ProgramCourse);

            GenericHelper.SelectWindow("Global Home");
            Assert.AreEqual("Global Home", WebDriver.Title);
            bool announcementClose = GenericHelper.CloseAnnouncementPage();

            if (announcementClose)
            {
                GenericHelper.Logs("Annoucement page has been closed successfully", "Passed");
            }
            else
            {
                GenericHelper.Logs("Annoucement page is still not closed", "Failed");
            }
            GenericHelper.WaitUntilElement(By.Id("_ctl3:_ctl2:_ctl0:_ctl0:_ctl0:btnEnrollCourse"));
            WebDriver.FindElement(By.Id("_ctl3:_ctl2:_ctl0:_ctl0:_ctl0:btnEnrollCourse")).Click();
            WebDriver.SwitchTo().DefaultContent();
            GenericHelper.SelectWindow("Global Home");
            WebDriver.SwitchTo().Frame(1);
            GenericHelper.WaitUntilElement(By.Id("txtCourseID"));
            WebDriver.FindElement(By.Id("txtCourseID")).Clear();
            if (courseType.Equals("MasterCourse"))
            {
                if (_getEnrolInstructorCourseID != null)
                {
                    WebDriver.FindElement(By.Id("txtCourseID")).SendKeys(_getEnrolInstructorCourseID);
                }
            }
            if (courseType.Equals("ProductTypeProg"))
            {
                if (_getEnrolInstructorCourseID != null)
                {
                    WebDriver.FindElement(By.Id("txtCourseID")).SendKeys(_getEnrolSectionCourseID);
                }
            }

            GenericHelper.WaitUntilElement(By.CssSelector("span > span"));
            WebDriver.FindElement(By.CssSelector("span > span")).Click();
            GenericHelper.WaitUntilElement(By.CssSelector("#btnConfirm > span > span"));
            WebDriver.FindElement(By.CssSelector("#btnConfirm > span > span")).Click();
            WebDriver.SwitchTo().DefaultContent();
            GenericHelper.SelectWindow("Global Home");
            IWebElement divData = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody"));

            if (courseType.Equals("MasterCourse") && divData.Text.Contains(courseName))
            {
                GenericHelper.Logs("Enrolled course has been shown on the global home page for student.", "Passed");
                DatabaseTools.UpdateUserEnrollStatusTrue(_getSMSStudent);
            }
            else if (courseType.Equals("ProductTypeProg") && divData.Text.Contains(ProgramName))
            {
                GenericHelper.Logs("Enrolled course has been shown on the global home page for student.", "Passed");
                DatabaseTools.UpdateUserEnrollStatusTrue(_getSMSStudent);
            }

            else
            {
                GenericHelper.Logs("Enrolled course has not been shown on the global home page for student.", "Failed");
                Assert.Fail("Enrolled course has not been shown on the global home page for student.");
            }
        }