コード例 #1
0
        /// <summary>
        /// This method creates quote and returns quote id
        /// </summary>
        /// <param name="driver">Webdriver Object to drive the execution</param>
        /// <param name="quoteType">This is the type of quote to be configured
        /// (Open/Sealed/Negotiated)</param>
        /// <param name="quoteDescription">The text to enter in your reference textbox which appears
        /// in quote description</param>
        /// <returns></returns>
        public String createQuote(IWebDriver driver, String quoteType, String quoteDescription)
        {
            ConfigureQuotePage    configQuotePageElements = new ConfigureQuotePage(driver);
            CommonPageWebElements commonPgElements        = new CommonPageWebElements(driver);
            String quoteId = "";
            // String quoteText = "Automation script "+quoteType+" quote test "
            String quoteText = quoteDescription + "-" + generalLib.getRandomNo(1, 1000);

            generalLib.waitForPageLoad(driver);
            configureQuote(driver, quoteType);
            generalLib.waitForPageLoad(driver);
            generalLib.normalWait(2000);
            searchAndAddSupplierToQuote(driver, "demo");
            generalLib.waitForPageLoad(driver);
            if (applicationLib.verifySuccessMessage(driver, "Suppliers added to quote."))
            {
                generalLib.moveToElementAndClick(driver, configQuotePageElements
                                                 .getQtAddSupplierSaveAndContinueBtn());

                selectQuoteTemplateAndEnterQuoteText(driver, "quote", quoteText);
                generalLib.waitForPageLoad(driver);

                generalLib.clickOnWebElement(driver, configQuotePageElements
                                             .getSaveAndContinueToQuoteSummaryBtn());
                generalLib.waitForPageLoad(driver);

                quoteId = generalLib.getTextFromElement(driver, configQuotePageElements
                                                        .getConfirmAndSendPgQuoteId());

                generalLib.clickOnWebElement(driver, configQuotePageElements.getSendQuoteBtn());
                generalLib.waitForPageLoad(driver);
            }
            return(quoteId);
        }
        /// <summary>
        /// This method verifies the left hand side menu if it is cloesed and returns true if
        /// margin-left value is -290
        /// </summary>
        /// <param name="driver">Webdriver Object to drive the execution</param>
        /// <returns></returns>
        public bool verifyLeftSideMenuClose(IWebDriver driver)
        {
            bool status = false;

            generalLib.normalWait(1000);
            String mrgLeft = new CommonPageWebElements(driver).getMenuAppSidebar()
                             .GetCssValue("margin-left");

            Console.WriteLine("Margin Left : " + mrgLeft);
            if (mrgLeft.Equals("-290px"))
            {
                status = true;
            }
            return(status);
        }
コード例 #3
0
        /// <summary>
        /// This method verifies the navigation to Basket page
        /// </summary>
        /// <param name="driver"></param>
        /// <returns></returns>
        public bool verifyNavigationToBsketOrCheckoutPage(IWebDriver driver, String pageName)
        {
            bool status = false;

            if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                generalLib.getStatusCode(driver.Url).Equals("Redirect"))
            {
                try
                {
                    CommonPageWebElements commenPageElements = new CommonPageWebElements(driver);
                    switch (pageName.ToLower())
                    {
                    case "basket":
                        if (driver.Url.Contains("basket.uk-plc.net/Basket.aspx"))
                        {
                            if (generalLib.getTextFromElement(driver, commenPageElements
                                                              .getBasketChkOutPageHeader()).Equals("Basket"))
                            {
                                status = true;
                            }
                        }
                        break;

                    case "chechout":
                        if (driver.Url.Contains("secure.uk-plc.net/checkout/review.aspx"))
                        {
                            if (generalLib.getTextFromElement(driver, commenPageElements
                                                              .getBasketChkOutPageHeader()).Equals("Checkout"))
                            {
                                status = true;
                            }
                        }
                        break;
                    }
                }
                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);
        }
        public int getTableRowCount(IWebDriver driver)
        {
            int rowCount = 0;

            try
            {
                rowCount = new CommonPageWebElements(driver)
                           .getRowCollection().Count;
            }
            catch (Exception exp)
            {
                Console.WriteLine("`````Exception caught`````");
                generalLib.takeScreenshot(driver, MethodBase.GetCurrentMethod().Name); //Take screenshot and save in SreenShot folder
                generalLib.PrintAllLogs(driver);
                Console.WriteLine(exp.Message);
            }
            return(rowCount);
        }
        /// <summary>
        /// This mehod verifies the presence of header element of the page like: Logo, mydetails section,
        /// Language and timezone dropdown etc.
        /// </summary>
        /// <param name="driver">Webdriver object to drive execution</param>
        //This method verifies the presence of header elements
        public void verifyPresenceOfPageHedearElements(IWebDriver driver)
        {
            CommonPageWebElements commonElements = new CommonPageWebElements(driver);

            Assert.Multiple(() =>
            {
                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getLogoImg()),
                              "Logo is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getMyDetailsLink()),
                              "My details link in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.
                                                                 getAppHeaderUserName()), "Username in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.
                                                                 getAppHeaderCompanyName()), "Company Name in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getDashboardBtn()),
                              "Dashboard btn in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getLogoutBtn()),
                              "LogOut btn in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getViewBasketBtn()),
                              "View Basket btn in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getTimeZoneDropdown()),
                              "Timezone drpdown in header section is not appeared");

                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getLanguageSelectionDropdown()),
                              "language selection drpdown in header section is not appeared");
                Assert.IsTrue(generalLib.verifyPresenceOfElement(driver, commonElements.getMenuSwipeBtn()), "Menu " +
                              "Swipe button is not appeared");
            });
        }