public void GivenCourseAssociationToProgramTypeProductIsAlreadyCreatedIfNotThenCreateAssociation()
 {
     try
     {
         string productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedCoreProgram);
         string isMasterCourseAlreadyAssociatedToProduct = DatabaseTools.GetProductMaterCourseAssociatedStatus(productName);
         if (isMasterCourseAlreadyAssociatedToProduct == null || isMasterCourseAlreadyAssociatedToProduct.Equals("False") || isMasterCourseAlreadyAssociatedToProduct.Equals(""))
         {
             GenericTestStep.StepToBrowsedUrlForPegasusUser("HED CS Admin");
             GenericTestStep.StepToLoggedIntoTheCourseSpaceAsHedCSAdmin();
             GenericTestStep.StepToItShouldShowTheManageProductsPage();
             GenericTestStep.StepToSelectCourseInManageProductsPage("MySpanishLab Master Course");
             GenericTestStep.StepToSelectTheProductInTheRightFrame("HedCoreProgram");
             GenericTestStep.StepToAssociateTheCourseToProduct();
             GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Approved courses programmed successfully.");
             DatabaseTools.UpdateProductMaterCourseAssociatedStatus(productName);
             GenericTestStep.StepToIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
Beispiel #2
0
 //Purpose: To Create Course using ML
 public void CreateCourseUsingML()
 {
     try
     {
         GenericHelper.SelectWindow("Create Course");
         bool isNoCousefoundPresent = GenericHelper.IsElementPresent(By.Id("_ctl0_lblNoCousefound"));
         if (isNoCousefoundPresent)
         {
             GenericHelper.Logs("There are no items present to create course.", "FAILED");
             throw new NoSuchElementException("There are no items present to create course.");
         }
         else
         {
             GenericHelper.Logs("Course has been present to create course by CS Teacher.", "PASSED");
         }
         int    producttablecount = WebDriver.FindElements(By.Id("tblCourseList")).Count;
         string productname       = null;
         for (int i = 1; i <= producttablecount; i++)
         {
             if (Browser.Equals("IE"))
             {
                 productname = WebDriver.FindElement(By.XPath(div_productType + "/TABLE[" + producttablecount.ToString(CultureInfo.InvariantCulture) + "]")).GetAttribute("innerText");
             }
             if (Browser.Equals("FF") || Browser.Equals("GC"))
             {
                 productname = WebDriver.FindElement(By.XPath(div_productType + "/TABLE[" + producttablecount.ToString(CultureInfo.InvariantCulture) + "]")).Text;
             }
             string getProductName = DatabaseTools.GetProduct(Enumerations.ProductInstance.NovaNET);
             if (productname != null && getProductName.Contains(getProductName))
             {
                 int courseCount = WebDriver.FindElements(By.XPath(div_productType + "/TABLE[" + producttablecount.ToString(CultureInfo.InvariantCulture) + "]/tbody/tr[2]/td/table/tbody/tr/td/div" + Table_CourseList)).Count;
                 WebDriver.FindElement(By.XPath(CheckboxCourse(i.ToString(CultureInfo.InvariantCulture), courseCount.ToString(CultureInfo.InvariantCulture)))).Click();
                 GenericHelper.WaitUntilElement(By.Id("btnFinish"));
                 WebDriver.FindElement(By.Id("btnFinish")).Click();
                 bool isCreateCoursePopUpClosed = GenericHelper.IsPopUpClosed(2);
                 if (isCreateCoursePopUpClosed)
                 {
                     GenericHelper.Logs("'Create Course' pop-up window closed successfuly.", "PASSED");
                 }
                 else
                 {
                     GenericHelper.Logs("'Create Course' pop-up window not closed successfuly.", "FAILED");
                     throw new SystemException("'Create Course' pop-up window not closed successfuly.");
                 }
                 break;
             }
             else if (i == producttablecount)
             {
                 GenericHelper.Logs("Create course pop up does not contains required product and course hence unable to select the course.", "FAILED");
             }
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         WebDriver.Close();
         throw new Exception(e.ToString());
     }
 }
 /// <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());
     }
 }
 public void GivenProgramTypeProductIsAlreadyCreatedIfNotThenCreateANewProgramTypeProduct()
 {
     try
     {
         string isProductAlreadyCreated = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedCoreProgram);
         if (isProductAlreadyCreated == null || isProductAlreadyCreated.Equals("False") || isProductAlreadyCreated.Equals(""))
         {
             GenericTestStep.StepToBrowsedUrlForPegasusUser("HED CS Admin");
             GenericTestStep.StepToLoggedIntoTheCourseSpaceAsCSAdmin();
             GenericTestStep.StepToItShouldShowTheManageProductsPage();
             GenericTestStep.StepToClickTheCreateNewProductLink();
             GenericTestStep.StepToCreateHedGeneralTypeProduct("HedCoreProgram");
             GenericTestStep.StepToItShouldDisplaySuccessfulMessage("New product created successfully.");
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         Assert.Fail(e.ToString());
     }
 }
Beispiel #5
0
        //Purpose : To Search and Open the Product
        public void SearchProductAndOpen(string productInstance)
        {
            GenericHelper.SelectWindow("Manage Products");
            GenericHelper.WaitUntilElement(By.Id("ifrmWorkspace"));
            WebDriver.SwitchTo().Frame("ifrmWorkspace");
            GenericHelper.WaitUntilElement(By.Id("ancRightSearch"));
            WebDriver.FindElement(By.Id("ancRightSearch")).Click();
            Thread.Sleep(3000);
            WebDriver.SwitchTo().ActiveElement();
            GenericHelper.WaitUntilElement(By.Id("ifrmRight"));
            WebDriver.SwitchTo().Frame("ifrmRight");
            //Purpose: Get Course From DB Based on Instance
            string productName = string.Empty;

            switch (productInstance)
            {
            case "NovaNET":
                productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.NovaNET);
                break;

            case "DigitalPath":
                productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.DigitalPath);
                break;

            case "HedCoreGeneral":
                productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedCoreGeneral);
                break;

            case "HedCoreProgram":
                productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedCoreProgram);
                break;

            case "HedMilGeneral":
                productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedMilGeneral);
                break;

            case "HedMilProgram":
                productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedMilProgram);
                break;
            }
            GenericHelper.WaitUntilElement(By.Id(("txtProgramName")));
            WebDriver.FindElement(By.Id("txtProgramName")).SendKeys(productName);
            // GenericHelper.WaitUntilElement(By.Id("cmbState"));
            // _iElement = WebDriver.FindElement(By.Id("cmbState"));
            GenericHelper.WaitUntilElement(By.Id("imgBtnSearch"));
            IWebElement imgBtnSearch = WebDriver.FindElement(By.Id("imgBtnSearch"));

            imgBtnSearch.Click();
            bool isManageProgramsGridOpened = GenericHelper.IsElementPresent(By.Id("grdManagePrograms"));

            if (!isManageProgramsGridOpened)
            {
                imgBtnSearch.Click();
            }
            #region Browser Selection
            if (Browser.Equals("FF"))
            {
                if (WebDriver.FindElement(By.Id("grdManagePrograms")).Text.Contains(productName))
                {
                    GenericHelper.Logs("searched product found in 'Manage Product' page", "PASSED");
                }
                else
                {
                    GenericHelper.Logs("searched product not found in 'Manage Product' page", "FAILED");
                }
            }
            if (Browser.Equals("IE"))
            {
                if (WebDriver.FindElement(By.Id("grdManagePrograms")).GetAttribute("innerText").Contains(productName))
                {
                    GenericHelper.Logs("searched product found in 'Manage Product' page", "PASSED");
                }
                else
                {
                    GenericHelper.Logs("searched product not found in 'Manage Product' page", "FAILED");
                }
            }
            #endregion Browser Selection
            GenericHelper.WaitUntilElement(By.PartialLinkText(productName));
            WebDriver.FindElement(By.PartialLinkText(productName)).Click();
            WebDriver.SwitchTo().DefaultContent();
        }
        //Purpose: Method to Select Product For License Creation
        public void SelectProduct(Enumerations.ProductInstance productInstance)
        {
            try
            {
                bool isProductSelectionWindowAppeared = GenericHelper.WaitUtilWindow("Product Selection");
                if (isProductSelectionWindowAppeared)
                {
                    GenericHelper.SelectWindow("Product Selection");
                    GenericHelper.WaitUntilElement(By.Id("ifrmAvailableProd"));
                    WebDriver.SwitchTo().Frame("ifrmAvailableProd");
                    GenericHelper.WaitUntilElement(By.XPath("//label[@class='cssLicenseSearchLbl']"));
                    WebDriver.FindElement(By.XPath("//label[@class='cssLicenseSearchLbl']")).Click();
                    bool isProductTextBoxDisplayed = WebDriver.FindElement(By.Id("txtProduct")).Displayed;
                    if (!isProductTextBoxDisplayed)
                    {
                        GenericHelper.WaitUntilElement(By.XPath("//label[@class='cssLicenseSearchLbl']"));
                        WebDriver.FindElement(By.XPath("//label[@class='cssLicenseSearchLbl']")).Click();
                    }
                    string productName = DatabaseTools.GetProduct(productInstance);
                    if (productName == null)
                    {
                        throw new ArgumentNullException(string.Format("Product Name is {0}, dataconfiguration issue.", "productName"));
                    }
                    GenericHelper.WaitUntilElement(By.Id("txtProduct"));
                    WebDriver.FindElement(By.Id("txtProduct")).SendKeys(productName);
                    GenericHelper.WaitUntilElement(By.Id("Search1"));
                    WebDriver.FindElement(By.Id("Search1")).Click();
                    bool isProductDisplayed = GenericHelper.IsElementPresent(By.PartialLinkText("Select"));
                    if (isProductDisplayed)
                    {
                        GenericHelper.WaitUntilElement(By.PartialLinkText("Select"));
                        GenericHelper.Logs("Product has been found successfully while creating the license.", "PASSED");
                    }
                    else
                    {
                        GenericHelper.Logs("Product has been not found while creating the license.", "FAILED");
                        throw new NoSuchElementException("Product has been not found while creating the license.");
                    }
                    WebDriver.FindElement(By.PartialLinkText("Select")).Click();
                    WebDriver.SwitchTo().DefaultContent();
                    WebDriver.WindowHandles.Any(item => WebDriver.SwitchTo().Window(item).Title == "Product Selection");
                    GenericHelper.WaitUntilElement(By.Id("ImgContinue"));
                    WebDriver.FindElement(By.Id("ImgContinue")).Click();
                    Thread.Sleep(15000);
                    WebDriver.WindowHandles.Any(item => WebDriver.SwitchTo().Window(item).Title == "Create License");

                    new CreateLicensePage().EnterLicenseDetail();

                    WebDriver.Close();
                    GenericHelper.SelectWindow("Organization Management");
                }
                else
                {
                    GenericHelper.Logs("Product selection pop-up not opened for selecting product for licensing.", "FAILED");
                    throw new NoSuchWindowException("Product Selection pop-up not opened for selecting product for licensing.");
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                bool isWindowPresentProductSelection = GenericHelper.IsPopUpWindowPresent("Product Selection");
                if (isWindowPresentProductSelection)
                {
                    GenericHelper.SelectWindow("Product Selection");
                    WebDriver.Close();
                }
                throw new Exception(e.ToString());
            }
        }