Пример #1
0
 public void deleteTemplateInSavedRFQPage(IWebDriver driver, String templateName)
 {
     if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
         generalLib.getStatusCode(driver.Url).Equals("Redirect"))
     {
         QuoteHistoryPage qtHistPageElements = new QuoteHistoryPage(driver);
         try
         {
             IReadOnlyCollection <IWebElement> yourReferenceCollection = qtHistPageElements
                                                                         .getYourReferenceInSavedQtTemplate(templateName);
             foreach (var refCollection in yourReferenceCollection)
             {
                 if (generalLib.verifyPresenceOfElement(driver, refCollection))
                 {
                     generalLib.clickOnWebElement(driver, qtHistPageElements
                                                  .getDeleteBtnForRequiredTemplate(templateName));
                     generalLib.clickOKForBrowserPopup(driver);
                     generalLib.normalWait(2000);
                 }
             }
         }
         catch (Exception exp)
         {
             Console.WriteLine("`````Exception caught`````");
             generalLib.takeScreenshot(driver, MethodBase.GetCurrentMethod().Name); //Take screenshot and the file saved in SreenShot folder
             generalLib.PrintAllLogs(driver);
             Console.WriteLine(exp.Message);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// This method clicks on Create quote template in Quote history page, then enter template name in
 /// your reference text box and click on submit button
 /// </summary>
 /// <param name="driver">IWebdriver Object to drive the execution</param>
 /// <param name="descriptionText">Create quote template button is selected based on this
 /// String in description of the quote</param>
 /// <param name="templateName">Template name to enter in your reference text box</param>
 public void createQuoteTemplate(IWebDriver driver, String descriptionText, String templateName)
 {
     if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
         generalLib.getStatusCode(driver.Url).Equals("Redirect"))
     {
         QuoteHistoryPage qtHistoryPgElements = new QuoteHistoryPage(driver);
         try
         {
             generalLib.clickOnWebElement(driver, qtHistoryPgElements
                                          .getCreateQtTemplateForRequiredDescription(descriptionText));
             generalLib.waitForPageLoad(driver);
             generalLib.enterDataInTextBox(driver, qtHistoryPgElements.getQuoteReferenceTextBox(),
                                           templateName);
             generalLib.clickOnWebElement(driver, new CommonPageWebElements(driver).getSubmitBtn());
             generalLib.waitForPageLoad(driver);
         }
         catch (Exception exp)
         {
             Console.WriteLine("`````Exception caught`````");
             generalLib.takeScreenshot(driver, MethodBase.GetCurrentMethod().Name); //Take screenshot and the file saved in SreenShot folder
             generalLib.PrintAllLogs(driver);
             Console.WriteLine(exp.Message);
         }
     }
 }
Пример #3
0
        /// <summary>
        /// This method verifies that if it is redirected to SavedQuoteTemplates.aspx page after creating quote
        /// tempalate and returns true if entered tempalate name appears in List of saved templates
        /// </summary>
        /// <param name="driver">IWebdriver Object to drive the execution</param>
        /// <returns></returns>
        public bool verifyCreateQuoteTemplate(IWebDriver driver)
        {
            bool   status       = false;
            String templateName = "Automation Create Quote Template Test " + generalLib.getRandomNo(1, 999);

            createQuoteTemplate(driver, "Open Quote to test Create template", templateName);
            Console.WriteLine("Template name : " + templateName);
            driver.Navigate().Refresh();
            //driver.Url = "https://purchasing.uk-plc.net/BuyerDotNet2/requestquote/savedquotetemplates.aspx";
            generalLib.normalWait(6000);
            try
            {
                generalLib.waitForPageLoad(driver);
                if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                    generalLib.getStatusCode(driver.Url).Equals("Redirect"))
                {
                    if (applicationLib.verifyNavigationToPage(driver, "SavedQuoteTemplates.aspx",
                                                              "Saved quote templates"))
                    {
                        IReadOnlyCollection <IWebElement> yourRefCollection = new QuoteHistoryPage(driver)
                                                                              .getYourReferenceInSavedQtTemplate("Automation Create Quote Template Test");
                        Console.WriteLine("No of elements in yourRefCollection : " +
                                          yourRefCollection.Count);
                        foreach (var refCollection in yourRefCollection)
                        {
                            Console.WriteLine("Template --> " + refCollection.Text);
                            if (refCollection.Text.Equals(templateName))
                            {
                                status = true;
                                break;
                            }
                            Console.WriteLine("Status-->" + status);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Navigation to Saved quote templates page failed");
                    }
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine("`````Exception caught`````");
                generalLib.takeScreenshot(driver, MethodBase.GetCurrentMethod().Name); //Take screenshot and the file saved in SreenShot folder
                generalLib.PrintAllLogs(driver);
                Console.WriteLine(exp.Message);
            }
            return(status);
        }