public void GivenAuthoredCourseCopyAlreadyCreatedIfNotThenCreateTheAuthoredCourseCopy()
 {
     try
     {
         string isCourseAlreadyCopied = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse);
         if (isCourseAlreadyCopied == null)
         {
             //Purpose: Steps To Create Test Data
             GenericTestStep.StepToBrowsedUrlForPegasusUser("HED WS Admin");
             GenericTestStep.StepToLoggedIntoTheWorkspaceAsHedWsAdmin();
             GenericTestStep.StepToItShouldBeOnPage("Course Enrollment");
             GenericTestStep.StepToIAmOnTheUserCreationPage();
             GenericTestStep.StepToSelectTheCourse("MySpanishLab AuthoredCourse");
             GenericTestStep.StepToClickOnTheCmenuOfCourse();
             GenericTestStep.StepToClickOnTheCourseCMenuOptionLink("Copy as Master Course");
             GenericTestStep.StepToIShouldSeeTheNewPopup("Copy as Master Course");
             GenericTestStep.StepToCopyTheCourseInSameWorkspace("Master");
             GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Copied as master course.");
             GenericTestStep.StepToWaitForTheCourseOutFromAssignToCopyState();
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
        /// <summary>
        /// Purpose: To Get Program Section Course ID
        /// </summary>
        /// <returns></returns>
        public void ToGetProgramSectionID()
        {
            int    divNo      = 1;
            string courseName = DatabaseTools.GetCourse(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)).Click(); break;
                    }
                }

                ManageTemplatePage.ToCreateTemplate();
                new ProgramAdminToolPage().SelectProgramAdminTab("Sections");
                ManageTemplatePage.GetSectionID();
            }
            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));
            }
        }
        public void GivenSMSUserIsAlreadyEnrolledIntoTheProgramIfNotThenEnrollTheSMSUserInProgram()
        {
            try
            {
                string isProgramCourseCreated = DatabaseTools.GetCourse(Enumerations.CourseType.ProgramCourse);
                if (isProgramCourseCreated == null || isProgramCourseCreated.Equals("False") || isProgramCourseCreated.Equals(""))
                {
                    GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsInstructor");
                    GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSInstructor();
                    GenericTestStep.StepToIAmOnThePage("Global Home");
                    GenericTestStep.StepToCreateProgramCourse();
                    GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();

                    GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent");
                    GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent();
                    GenericTestStep.StepToCloseStudentHelpTextWindow();
                    GenericTestStep.StepToIAmOnThePage("Global Home");
                    GenericTestStep.StepToEnrolStudentToCourse("ProductTypeProg");
                    GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                Assert.Fail(e.ToString());
            }
        }
        /// <summary>
        /// Purpose: Get Section ID
        /// </summary>
        /// <returns></returns>
        public void GetSectionID()
        {
            string sectionName = new AddNewSectionPage().AddNewSection();

            WebDriver.SwitchTo().DefaultContent();
            GenericHelper.SelectWindow("Program Administration");
            bool isSuccessMesageDisplayed = GenericHelper.VerifySuccesfullMessage("Section added successfully.");

            if (isSuccessMesageDisplayed)
            {
                GenericHelper.Logs("Section added successful message displayed.", "PASSED");
                DatabaseTools.UpdateSectionName(sectionName);
            }
            else
            {
                GenericHelper.Logs("Section added successful message not displayed.", "FAILED");
                Assert.Fail("Section added successful message displayed.");
            }
            WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle");
            GenericHelper.WaitUntilElement(By.Id("grdTemplateSection"));
            string getSectionID = WebDriver.FindElement(By.XPath("//table[@id = 'grdTemplateSection']/tbody/tr/td[6]")).Text;

            if (getSectionID == null)
            {
                throw new ArgumentNullException("getSectio" + "nID id null");
            }
            WebDriver.SwitchTo().DefaultContent();
            string sectionCourse = DatabaseTools.GetCourse(Enumerations.CourseType.ProgramCourse);

            DatabaseTools.UpdateEnrolCourseID(sectionCourse, getSectionID);
        }
 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));
     }
 }
 public void GivenStudentisalreadypromotedtoTAifnotthenpromotethestudentasTa()
 {
     try
     {
         GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsInstructor");
         GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSInstructor();
         GenericTestStep.StepToIAmOnThePage("Global Home");
         GenericHelper.SelectWindow("Global Home");
         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();
         GenericTestStep.StepToIAmOnThePage("Program Administration");
         GenericHelper.SelectWindow("Program Administration");
         GenericTestStep.StepToNavigateToTheTab("Sections");
         // Will need to change this line as per the authored course
         GenericHelper.SelectWindow("Program Administration");
         string sectionName = DatabaseTools.GetSectionName(Enumerations.CourseType.ProgramCourse).Trim();
         _sectionSearch.ToSearchSection(sectionName);
         _sectionSearch.SelectSectionAfterSearch();
         GenericTestStep.StepToIAmOnThePage("Calendar");
         GenericHelper.SelectWindow("Calendar");
         GenericTestStep.StepToNavigateToTheTab("Enrollments");
         GenericTestStep.StepToIAmOnThePage("Roster");
         _rosterPage.ToGrantTAPrivilege();
         GenericTestStep.StepToIAmOnThePage("Roster");
         GenericTestStep.StepToIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
 public void WhenIGrantthestudentasTa()
 {
     try
     {
         GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSInstructor();
         GenericTestStep.StepToIAmOnThePage("Global Home");
         GenericHelper.SelectWindow("Global Home");
         string courseName = DatabaseTools.GetCourse(Enumerations.CourseType.InstructorCourse).Trim();
         GenericHelper.WaitUntilElement(By.PartialLinkText(courseName));
         WebDriver.FindElement(By.PartialLinkText(courseName)).SendKeys("");
         WebDriver.FindElement(By.PartialLinkText(courseName)).Click();
         GenericTestStep.StepToIAmOnThePage("Calendar");
         // Will need to change this line as per the authored course
         GenericHelper.SelectWindow("Calendar");
         GenericTestStep.StepToNavigateToTheTab("Enrollments");
         GenericTestStep.StepToIAmOnThePage("Roster");
         _rosterPage.ToGrantTAPrivilege();
         GenericTestStep.StepToIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
     }
     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));
     }
 }
        public void ThenUpdateThePreferenceStatusInDBForBDDCC(string course)
        {
            try
            {
                string coursename         = string.Empty;
                bool   ismessagedisplayed = false;
                switch (course)
                {
                case "BDDCC":
                    coursename         = DatabaseTools.GetCourse(Enumerations.CourseType.ContainerCourse);
                    ismessagedisplayed = GenericHelper.VerifySuccesfullMessage("Preferences updated successfully.");
                    break;

                case "BDDEC":
                    coursename         = DatabaseTools.GetCourse(Enumerations.CourseType.EmptyCourse);
                    ismessagedisplayed = GenericHelper.VerifySuccesfullMessage("Preferences updated successfully.");
                    break;
                }
                if (ismessagedisplayed == true)
                {
                    DatabaseTools.UpdateCoursePrferenceStatusTrue(coursename);
                    GenericHelper.Logs("As successful displayed for preference saved, PreferenceStatus as True updated for course" + coursename, "PASSED");
                }
                else
                {
                    DatabaseTools.UpdateCoursePrferenceStatusFalse(coursename);
                    GenericHelper.Logs("As successful not displayed for preference saved, PreferenceStatus as False updated for course" + coursename, "FAILED");
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                throw new Exception(e.ToString());
            }
        }
 public void GivenAuthoredCourseCopyIsAlreadyPublishedIfNotThenPublishTheAuthoredCourseCopy()
 {
     try
     {
         //Purpose: Steps To Create Test Data
         string isCourseAlreadyPublished = DatabaseTools.GetCoursePublishStatus(Enumerations.CourseType.MySpanishLabMasterCourse);
         if (isCourseAlreadyPublished == null || isCourseAlreadyPublished.Equals("False") || isCourseAlreadyPublished.Equals(""))
         {
             string getCopiedCourse = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse);
             if (getCopiedCourse == null)
             {
                 throw new ArgumentNullException("getCo" + "piedCourse is null");
             }
             GenericTestStep.StepToBrowsedUrlForPegasusUser("HED WS Admin");
             GenericTestStep.StepToLoggedIntoTheWorkspaceAsHedWsAdmin();
             GenericTestStep.StepToItShouldBeOnPage("Course Enrollment");
             GenericTestStep.StepToSelectTheCourse("MySpanishLab Authored Master Course");
             GenericTestStep.StepToClickOnTheCmenuOfCourse();
             GenericTestStep.StepToClickOnTheCourseCMenuOptionLink("Publish Master Course");
             GenericTestStep.StepToIShouldSeeTheNewPopup("Publishing Notes");
             GenericTestStep.StepToEnterThePublishingNotes();
             GenericTestStep.StepToClickOnThePublishButton();
             GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Course published successfully.");
             DatabaseTools.UpdateCoursePublishStatusTrue(getCopiedCourse);
             GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
 public void GivenAutohoredCourseIsAlreayApprovedInTheCourseSpaceIfNotThenApproveTheAuthoredCourseInCourseSpace()
 {
     try
     {
         //Purpose: Steps To Create Test Data
         string isCourseAlreadyApproved = DatabaseTools.GetCourseApproveStatus(Enumerations.CourseType.MySpanishLabMasterCourse);
         if (isCourseAlreadyApproved == null || isCourseAlreadyApproved.Equals("False") || isCourseAlreadyApproved.Equals(""))
         {
             string getCopiedCourse = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse);
             GenericTestStep.StepToBrowsedUrlForPegasusUser("HED CS Admin");
             GenericTestStep.StepToLoggedIntoTheCourseSpaceAsHedCSAdmin();
             GenericTestStep.StepToItShouldBeOnPage("Course Enrollment");
             GenericTestStep.StepToNavigateToTheTab("Publishing");
             GenericTestStep.StepToSwitchToTheTab("Manage Products");
             GenericTestStep.StepToItShouldShowTheManageProductsPage();
             GenericTestStep.StepToSelectTheCourseToApprove("MySpanishLab Master Course");
             GenericTestStep.StepToClickedOnTheApproveCourseLink("Approve");
             GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Published course marked as Approved.");
             DatabaseTools.UpdateCourseApproveStatusTrue(getCopiedCourse);
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
        /// <summary>
        /// Purpose: To Enrol Student In the Respective Instructor Course
        /// </summary>
        public void ToEnrolTheStudentToCourseID()
        {
            GenericHelper.SelectWindow("Global Home");
            Assert.AreEqual("Global Home", WebDriver.Title);
            GenericHelper.WaitUntilElement((By.XPath("//a[@id='_ctl3:_ctl2:_ctl0:_ctl0:_ctl0:btnEnrollCourse']/span/span")));
            WebDriver.FindElement(By.XPath("//a[@id='_ctl3:_ctl2:_ctl0:_ctl0:_ctl0:btnEnrollCourse']/span/span")).Click();
            WebDriver.SwitchTo().DefaultContent();
            GenericHelper.SelectWindow("Global Home");
            WebDriver.SwitchTo().Frame(1);
            GenericHelper.WaitUntilElement(By.Id("txtCourseID"));
            WebDriver.FindElement(By.Id("txtCourseID")).Clear();
            WebDriver.FindElement(By.Id("txtCourseID")).SendKeys(_enrolledCourseId);
            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"));
            string      dBcoursename = DatabaseTools.GetCourse(Enumerations.CourseType.InstructorCourse);

            if (divData.Text.Contains(dBcoursename))
            {
                GenericHelper.Logs("Enrolled course has been shown on the global home page for student", "Passed");
            }
        }
 // Purpose: Create a Class Using ML
 public void ToCreateClassUsingML()
 {
     try
     {
         int rowNo = 1;
         WebDriver.WindowHandles.Any(item => WebDriver.SwitchTo().Window(item).Title == "Create Class");
         WebDriver.SwitchTo().Frame("iframeCreateClass");
         Classname = GenericHelper.GenerateUniqueVariable("ClassML");
         DatabaseTools.UpdateClass(Enumerations.ClassType.NovaNETMasterLibrary, Classname);
         WebDriver.FindElement(By.Id("clsClassInformation_txtNewClassName")).SendKeys(Classname);
         WebDriver.SwitchTo().DefaultContent();
         GenericHelper.WaitUntilElement(By.Id("btnNext"));
         WebDriver.FindElement(By.Id("btnNext")).Click();
         WebDriver.SwitchTo().Frame("iframeCreateClass");
         GenericHelper.WaitUntilElement(By.Id("clsClassInformation_rdbChooseProduct"));
         WebDriver.FindElement(By.Id("clsClassInformation_rdbChooseProduct")).Click();
         WebDriver.SwitchTo().DefaultContent();
         WebDriver.FindElement(By.Id("btnNext")).Click();
         Thread.Sleep(2000);
         WebDriver.SwitchTo().Frame("iframeCreateClass");
         string className = WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]")).Text.Trim();
         string dbmlName  = DatabaseTools.GetCourse(Enumerations.CourseType.MasterLibrary).Trim();
         if (className == dbmlName)
         {
             WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]/td/input[@id='selectcheckbox']")).Click();
         }
         while (className != dbmlName)
         {
             rowNo     = rowNo + 1;
             className = WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]")).Text.Trim();
             if (className == dbmlName)
             {
                 WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]/td/input[@id='selectcheckbox']")).Click();
             }
         }
         WebDriver.SwitchTo().DefaultContent();
         WebDriver.FindElement(By.Id("btnNext")).Click();
         GenericHelper.WaitUntilElement(By.Id("btnNext"));
         WebDriver.FindElement(By.Id("btnNext")).Click();
         GenericHelper.WaitUntilElement(By.Id("btnFinish"));
         WebDriver.FindElement(By.Id("btnFinish")).Click();
         GenericHelper.IsPopUpClosed(3);
         ToSearchForAssigned((Enumerations.ClassType.NovaNETMasterLibrary));
         WebDriver.Close();
         GenericHelper.IsPopUpClosed(2);
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         bool isCreateClassWindowPresent = GenericHelper.IsPopUpWindowPresent("Create Class");
         if (isCreateClassWindowPresent)
         {
             GenericHelper.SelectWindow("Create Class");
             WebDriver.Close();
         }
         throw new Exception(e.ToString());
     }
 }
Example #13
0
 public void GivenManualGradedQuestionIsAlreadySubmittedIfNotThenSubmitTheManualGraded()
 {
     try
     {
         string isActivityAlreadySubmitted = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.Essay);
         if (isActivityAlreadySubmitted == null || isActivityAlreadySubmitted.Equals("False") || isActivityAlreadySubmitted.Equals(""))
         {
             GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent");
             GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent();
             GenericTestStep.StepToCloseStudentHelpTextWindow();
             GenericTestStep.StepToItShouldBeOnPage("Global Home");
             GenericTestStep.StepToSelectTheSectionName();
             GenericTestStep.StepToItShouldBeOnPage("Today's View");
             GenericTestStep.StepToNavigateToTheTab("Course Materials");
             GenericTestStep.StepToNavigateInTheEssayTypeActivityFolder();
             if (_activityName != null)
             {
                 GenericTestStep.StepToClickOnTheLink(_activityName);
             }
             GenericTestStep.StepToSubmitEssayTypeActivitybyStudent(_activityName);
             GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
             // To submit grades by teacher
             GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSInstructor();
             GenericTestStep.StepToIAmOnThePage("Global Home");
             GenericHelper.SelectWindow("Global Home");
             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();
             GenericTestStep.StepToIAmOnThePage("Program Administration");
             GenericHelper.SelectWindow("Program Administration");
             GenericTestStep.StepToNavigateToTheTab("Sections");
             GenericHelper.SelectWindow("Program Administration");
             string sectionName = DatabaseTools.GetSectionName(Enumerations.CourseType.ProgramCourse).Trim();
             _SectionSearch.ToSearchSection(sectionName);
             _SectionSearch.SelectSectionAfterSearch();
             GenericTestStep.StepToIAmOnThePage("Calendar");
             GenericHelper.SelectWindow("Calendar");
             GenericTestStep.StepToNavigateToTheTab("Gradebook");
             GenericHelper.SelectWindow("Gradebook");
             _gbDefaultUxPage.SearchActivityByTitle("SAM 0A-33 El mundo hispano.");
             _gbInstructorUXPage.ClickActivityCmenu("SAM 0A-33 El mundo hispano.");
             _gbInstructorUXPage.ClickViewAllSubmissionsLink();
             _viewSubmissionPage.OpenActivityViewSubmissionPage();
             _viewSubmissionPage.GiveSubmissionByTeacher("Teacher");
             GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
        // To select the course from the global home page
        public void ToSelectMasterLibrary(string courseName)
        {
            try
            {
                Thread.Sleep(2000);
                string coursename = string.Empty;
                switch (courseName)
                {
                case "BDDML":
                    // course will be fetched fm db
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.MasterLibrary);
                    break;

                case "BDDCC":
                    // course will be fetched fm db
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.ContainerCourse);
                    break;

                case "BDDEC":
                    // course will be fetched fm db
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.EmptyCourse);
                    break;

                case "BDDMC":
                    // course will be fetched fm db
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.MasterLibrary);
                    break;

                case "Testing":
                    // course will be fetched fm db
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.TestingCourse);
                    break;
                }
                GenericHelper.WaitUntilElement(By.PartialLinkText(coursename));
                WebDriver.FindElement(By.PartialLinkText(coursename)).Click();
                if (!Browser.Equals("GC"))
                {
                    WebDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(120));
                }
                if (Browser.Equals("GC"))
                {
                    Thread.Sleep(120000);
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
            }
        }
 /// <summary>
 /// Purpose: To search Product Type Program
 /// </summary>
 /// <param name="courseType"></param>
 public void ToSearchCourseInCatalog(string courseType)
 {
     try
     {
         GenericHelper.WaitUntilElement(By.Id("spanSearchCatalog"));
         if (courseType.Equals("ProductTypeProg"))
         {
             _catalogDbCourse = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedCoreProgram);
         }
         if (courseType.Equals("MasterCourse"))
         {
             _catalogDbCourse = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse);
         }
         var sw = new Stopwatch();
         sw.Start();
         int minutesToWait  = Int32.Parse(ConfigurationManager.AppSettings["AssignedToCopyInterval"]);
         int courseTableRow = 1;
         // Purpose: To Check if the Course Name is Visible on the Page
         for (int i = 1; !WebDriver.FindElement(By.Id("spanSearchCatalog")).Text.Contains(_catalogDbCourse); i++)
         {
             GenericHelper.WaitUntilElement(By.Id("_ctl3_UCPaging_lnkNext"));
             WebDriver.FindElement(By.Id("_ctl3_UCPaging_lnkNext")).Click();
             GenericHelper.WaitUntilElement((By.Id("spanSearchCatalog")));
         }
         // Purpose: To Search the Course Through Each Rows
         while (sw.Elapsed.Minutes < minutesToWait)
         {
             string searchcourseNameRow = WebDriver.FindElement(By.XPath("//span[@id='spanSearchCatalog']/table/tbody/tr[2]/td/div/table/tbody/tr/td/table[" + courseTableRow + "]")).Text;
             if (searchcourseNameRow.Contains(_catalogDbCourse))
             {
                 WebDriver.FindElement(By.XPath("//span[@id='spanSearchCatalog']/table/tbody/tr[2]/td/div/table/tbody/tr/td/table[" + courseTableRow + "]/tbody/tr/td[3]/div/a/span/span")).SendKeys("");
                 WebDriver.FindElement(By.XPath("//span[@id='spanSearchCatalog']/table/tbody/tr[2]/td/div/table/tbody/tr/td/table[" + courseTableRow + "]/tbody/tr/td[3]/div/a/span/span")).Click();
                 break;
             }
             courseTableRow = courseTableRow + 1;
         }
         sw.Stop();
     }
     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());
     }
 }
Example #16
0
        //Purpose : Method to Perform Show Hide Functionality
        public void ToPerformShowHide()
        {
            WebDriver.SwitchTo().ActiveElement();
            string mlName = DatabaseTools.GetCourse(Enumerations.CourseType.MasterLibrary);

            WebDriver.FindElement(By.Id("_ctl0_InnerPageContent_ucSearchPanel_txtSearch")).SendKeys(mlName);
            WebDriver.FindElement(By.Id("_ctl0_InnerPageContent_ucSearchPanel_cmdSearchGo")).Click();
            WebDriver.SwitchTo().ActiveElement();

            if (WebDriver.FindElement(By.XPath("//table[@id='grdCourseContent']/tbody/tr[2]")).Text.Contains("Shown"))
            {
            }
            {
                GenericHelper.Logs("Show/Hide has been clicked from the Cmenu option", "Passed");
                WebDriver.SwitchTo().DefaultContent();
                return;
            }
        }
        public void GivenGivenTestingCourseCopyAlreadyCreatedIfNotThenCreateTheTestingCourseCopy()
        {
            string isTestingCourseCopyAlreadyCreated = DatabaseTools.GetCourse(Enumerations.CourseType.TestingCourse);

            if (isTestingCourseCopyAlreadyCreated == null || isTestingCourseCopyAlreadyCreated.Equals("False") ||
                isTestingCourseCopyAlreadyCreated.Equals(""))
            {
                GenericTestStep.StepToBrowsedUrlForPegasusUser("HED WS Admin");
                GenericTestStep.StepToLoggedIntoTheWorkspaceAsHedWsAdmin();
                GenericTestStep.StepToIAmOnTheUserCreationPage();
                GenericTestStep.StepToSelectTheCourse("MySpanishLab AuthoredCourse");
                GenericTestStep.StepToClickOnTheCmenuOfCourse();
                GenericTestStep.StepToClickOnTheCourseCMenuOptionLink("Copy as Testing Course");
                GenericTestStep.StepToIShouldSeeTheNewPopup("Copy as Testing Course");
                GenericTestStep.StepToCopyTheCourseInSameWorkspace("Testing");
                GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Copied as test course.");
                GenericTestStep.StepToWaitForTheTestingCourseOutFromAssignToCopyState();
            }
        }
        public void ThenUpdateThePublishStatusOfTheCourseInDB(string course)
        {
            try
            {
                string coursename = string.Empty;
                switch (course)
                {
                case "BDDCC":
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.ContainerCourse);
                    break;

                case "BDDEC":
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.EmptyCourse);
                    break;

                case "BDDML":
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.MasterLibrary);
                    break;

                case "Authored Master Library":
                    coursename = DatabaseTools.GetCourse(Enumerations.CourseType.AuthoredMasterLibrary);
                    break;
                }
                bool ismessagedisplayed = GenericHelper.VerifySuccesfullMessage("Course published successfully.");
                if (ismessagedisplayed == true)
                {
                    DatabaseTools.UpdateCoursePublishStatusTrue(coursename);
                    GenericHelper.Logs("As successful message displayed for course publish, publish status as 'True' updated for course" + coursename, "PASSED");
                }
                else
                {
                    DatabaseTools.UpdateCoursePublishStatusFalse(coursename);
                    GenericHelper.Logs("As successful message not displayed for course publish, publish status as 'False' updated for course" + coursename, "FAILED");
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                throw new Exception(e.ToString());
            }
        }
        /// <summary>
        /// Purpose: To Fetch the Instructor Course ID from the Global Home Page
        /// </summary>
        /// <returns></returns>
        public string ToGetInstructorCourseID()
        {
            int    divNo = 1;
            string courseNameInstructor = DatabaseTools.GetCourse(Enumerations.CourseType.InstructorCourse);

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

            if (!divData.Text.Contains(courseNameInstructor))
            {
                while (!divData.Text.Contains(courseNameInstructor))
                {
                    divNo = divNo + 1;
                    string divdata = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]")).Text;
                    if (divdata.Contains(courseNameInstructor))
                    {
                        WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]")).SendKeys("");
                        string idText = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]/descendant::span[@class='spnActive']")).Text;
                        int    loc    = idText.IndexOf(' ');
                        _enrolledCourseId = idText.Substring(loc).Trim();
                        if (!string.IsNullOrEmpty(_enrolledCourseId))
                        {
                            GenericHelper.Logs(string.Format("Course ID {0} has been fetched successfully", _enrolledCourseId), "Passed");
                        }
                        break;
                    }
                }
            }
            else
            {
                GenericHelper.WaitUntilElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]"));
                WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]")).SendKeys("");
                string idText = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody/tr/td/div[" + divNo + "]/descendant::span[@class='spnActive']")).Text;
                int    loc    = idText.IndexOf(' ');
                _enrolledCourseId = idText.Substring(loc).Trim();
            }
            return(_enrolledCourseId);
        }
Example #20
0
        // Purpose: To Verify Template Processing State
        public static void ToVerifyTemplateInactiveState()
        {
            SelectWindow("Program Administration");
            WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle");
            WaitUntilElement(By.Id("grdTemplateSection$divContent"));
            //To Fetch associated course info
            string associatedCourse = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse);

            if (associatedCourse == null)
            {
                throw new ArgumentNullException("associa" + "tedCourse is null");
            }
            IWebElement templateCourse = WebDriver.FindElement(By.Id("grdTemplateSection$divContent"));

            if (templateCourse == null)
            {
                throw new ArgumentNullException("templat" + "eCourse is null");
            }
            if (templateCourse.Text.Contains(associatedCourse))
            {
                Logs("Associated course has been matched in the template frame", "passed");
            }
            else
            {
                WebDriver.SwitchTo().DefaultContent();
                SelectWindow("Program Administration");
                WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle");
                WaitUntilElement(By.XPath("//IMG[@class='CursorHand']"));
                WebDriver.FindElement(By.XPath("//IMG[@class='CursorHand']")).Click();
                SelectWindow("Add New Template");
                WaitUntilElement(By.Id("btnAddTemplate"));
                WebDriver.FindElement(By.Id("btnAddTemplate")).Click();
                IsPopUpClosed(2);
                WebDriver.SwitchTo().DefaultContent();
                SelectWindow("Program Administration");
                WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle");
                WaitUntilElement(By.Id("grdTemplateSection$divContent"));
            }
            WaitUntilElement(By.XPath("//div[@id='grdTemplateSection$divContent']/table/tbody/tr/td/table/tbody/tr/td[2]"));
            Stopwatch sw = new Stopwatch();

            sw.Start();
            int minutesToWait = Int32.Parse(ConfigurationManager.AppSettings["AssignedToCopyInterval"]);

            while (sw.Elapsed.Minutes < minutesToWait)
            {
                IWebElement assignedToCopyText = WebDriver.FindElement(By.XPath("//div[@id='grdTemplateSection$divContent']/table/tbody/tr/td/table"));
                if (assignedToCopyText.Text.Contains("[Request is Processing") == false)
                {
                    break;
                }
                {
                    WebDriver.SwitchTo().DefaultContent();
                    SelectWindow("Program Administration");
                    WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle");
                    Thread.Sleep(6000);
                    WaitUntilElement(By.PartialLinkText("Search"));
                    WebDriver.FindElement(By.PartialLinkText("Search")).Click();
                    WebDriver.SwitchTo().ActiveElement();
                    WaitUntilElement(By.Id("ddSearchCondition"));
                    new SelectElement(WebDriver.FindElement(By.Id("ddSearchCondition"))).SelectByText("Contains");
                    WaitUntilElement(By.Id("txtSectionDetail"));
                    WebDriver.FindElement(By.Id("txtSectionDetail")).Clear();
                    WebDriver.FindElement(By.Id("txtSectionDetail")).SendKeys(associatedCourse);
                    WaitUntilElement(By.Id("lnkbuttonsearch"));
                    WebDriver.FindElement(By.Id("lnkbuttonsearch")).Click();
                    Thread.Sleep(8000);
                    WebDriver.SwitchTo().DefaultContent();
                    SelectWindow("Program Administration");
                    WaitUntilElement(By.Id("_ctl0_PageContent_ifrmMiddle"));
                    WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle");
                    WaitUntilElement(By.XPath("//div[@id='grdTemplateSection$divContent']/table/tbody/tr/td/table/tbody/tr/td[2]"));
                }
            }
            sw.Stop();
            sw = null;
        }
        /// <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.");
            }
        }