예제 #1
0
        /// <summary>
        /// This method returns true if filtered Ord Id is equal with Ord no after filter
        /// </summary>
        /// <param name="driver">Webdriver Object to drive the execution</param>
        /// <param name="ordNo">Order no in ord history paased to compare with Ord no in
        /// purchasing view</param>
        /// <returns>Returns true if Ord no in both Display Orders page and
        /// Purch. view page are equal</returns>
        public bool verifyOrdNoINPurchOrderPage(IWebDriver driver, String ordNo)
        {
            bool status = false;

            try
            {
                generalLib.filterDataWithDifferentOption(driver, ordNo, "Contains...", "Order refs");
                generalLib.waitForPageLoad(driver);
                if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                    generalLib.getStatusCode(driver.Url).Equals("Redirect"))
                {
                    DisplayOrdersPage dispOrderPageElements = new DisplayOrdersPage(driver);
                    generalLib.selectByValue(driver, dispOrderPageElements.getActionDropdown(),
                                             "ViewPurchaseOrder");
                    generalLib.clickOnWebElement(driver, dispOrderPageElements.getActionSelectBtn());
                    generalLib.normalWait(1000);
                    if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                        generalLib.getStatusCode(driver.Url).Equals("Redirect"))
                    {
                        if (driver.Url.Contains("htmlInvoice.aspx"))
                        {
                            if (ordNo.Equals(getOrdNoFromPurchOrderPage(driver)))
                            {
                                status = true;
                            }
                        }
                    }
                }
            }
            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);
            }
            driver.Navigate().Back();
            generalLib.normalWait(1000);
            generalLib.openURL(driver, "https://purchasing.uk-plc.net/BuyerDotNet2/ordering/" +
                               "displayorders.aspx");
            generalLib.waitForPageLoad(driver);
            return(status);
        }
예제 #2
0
        /// <summary>
        /// This method returns true if filtered Purchase Id is equal with purchase id in Recpt order page
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="purchId"></param>
        /// <returns></returns>
        public bool verifyPurchOrdInRecptOrderPage(IWebDriver driver, String purchId)
        {
            bool status = false;

            try
            {
                generalLib.filterDataWithDifferentOption(driver, purchId, "Contains", "Order refs");
                generalLib.waitForPageLoad(driver);
                if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                    generalLib.getStatusCode(driver.Url).Equals("Redirect"))
                {
                    DisplayOrdersPage dispOrderPageElements = new DisplayOrdersPage(driver);
                    generalLib.selectByValue(driver, dispOrderPageElements.getActionDropdown(),
                                             "ReceiptAll");
                    generalLib.clickOnWebElement(driver, dispOrderPageElements.getActionSelectBtn());
                    generalLib.normalWait(1000);
                    if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                        generalLib.getStatusCode(driver.Url).Equals("Redirect"))
                    {
                        if (driver.Url.Contains("ActionReceiptWholeOrder.aspx"))
                        {
                            if (purchId.Equals(getPurchIdFromReceiptOrderPage(driver)))
                            {
                                status = true;
                            }
                        }
                    }
                }
            }
            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);
            }
            driver.Navigate().Back();
            generalLib.normalWait(1000);
            return(status);
        }
예제 #3
0
        /// <summary>
        /// This method adds order to favorite from order history page and then click on remove
        /// favorites button
        /// </summary>
        /// <param name="driver">Webdriver Object to drive the execution</param>
        /// <returns>Returns true if successful message appears after removing favorite order</returns>
        public bool removeFavOrdFromFavOrdPage(IWebDriver driver)
        {
            DisplayOrdersPage dispOrdPageElements = new DisplayOrdersPage(driver);
            bool status = false;

            try
            {
                generalLib.selectByValue(driver, dispOrdPageElements.getActionDropdown(), "Favourite");
                generalLib.clickOnWebElement(driver, dispOrdPageElements.getActionSelectBtn());
                generalLib.waitForPageLoad(driver);
                AddToFavouritesPage addToFavPageElements = new AddToFavouritesPage(driver);
                if (generalLib.verifyPresenceOfElement(driver, addToFavPageElements.getFavOrderNameTextBox()))
                {
                    generalLib.enterDataInTextBox(driver, addToFavPageElements.getFavOrderNameTextBox(),
                                                  "Automation Fav Ord Test To Remove");
                    generalLib.clickOnWebElement(driver, addToFavPageElements.getaddToFavouritesBtn());
                    generalLib.normalWait();

                    if (generalLib.getStatusCode(driver.Url).Equals("OK") ||
                        generalLib.getStatusCode(driver.Url).Equals("Redirect"))
                    {
                        FavouritesOrdersPage favOrdPageElements = new FavouritesOrdersPage(driver);

                        if (generalLib.verifyPresenceOfElement(driver, favOrdPageElements.
                                                               getRemoveFavouriteBtn()))
                        {
                            Console.WriteLine("Remove Fav btn is present");
                            generalLib.clickOnWebElement(driver, favOrdPageElements.removeFavouriteBtn);
                            generalLib.normalWait(6000);

                            //MessageCollectionPage messageColPageElements = new
                            //    MessageCollectionPage(driver);
                            //if (generalLib.verifyPresenceOfElement(driver,messageColPageElements.
                            //    getSuccessMsgDiv()))
                            //{
                            //    String successMsg = generalLib.getTextFromElement(driver,
                            //        messageColPageElements.getSuccessMsgText());
                            //    Console.WriteLine("Success Message : " + successMsg);
                            //    if (successMsg.Equals("Favourite order deleted."))
                            //    {
                            //        status = true;
                            //    }

                            status = applicationLib.verifySuccessMessage(driver, "Favourite order deleted.");
                        }
                        else
                        {
                            Console.WriteLine("Success Msg not appeared");
                        }
                    }
                }
            }
            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);
        }