Exemplo n.º 1
0
        private void ClickEditButton()
        {
            Logger.Info("ClickEditButton");
            WebDriverUtils.WaitForElementToBeVisible(driver, ".//table[@class='xcrud-list table table-striped table-hover']//tr[1]/td[11]/span/a[1]/i");
            WebDriverUtils.WaitForElementToBeClickable(driver, EditButton);

            EditButton.Click();
        }
Exemplo n.º 2
0
        private void ClickAddButton()
        {
            Logger.Info("ClickAddButton");
            WebDriverUtils.WaitForElementToBeVisible(driver, ".//button[@class='btn btn-success']");
            WebDriverUtils.WaitForElementToBeClickable(driver, AddButton);

            AddButton.Click();
        }
Exemplo n.º 3
0
        /*Not required so far.
         * public void AddCouponWithDefinedCode(string percentage, string codevalue)
         * {
         *  ClickAddButton();
         *  FillCouponByPercentageAndDefinedCode(percentage, codevalue);
         *  ClickSubmitCoupon();
         *  SearchCoupon(codevalue);
         *  CouponsPageValidations.ValidateCouponbyPercentage(percentage);
         *  CouponsPageValidations.ValidateCouponbyCouponCode(codevalue);
         * }*/

        public void DeleteCoupon(string value)
        {
            Logger.Info("Delete Coupon");
            WebDriverUtils.WaitForElementToBeClickable(driver, AddButton);

            ClickDeleteButton();
            ConfirmDeleteCoupon();
        }
Exemplo n.º 4
0
        private void ClickSearchButton()
        {
            Logger.Info("clickSearchButton");
            WebDriverUtils.WaitForElementToBeVisible(driver, ".//a[@class='xcrud-search-toggle btn btn-default']");
            WebDriverUtils.WaitForElementToBeClickable(driver, SearchButton);

            SearchButton.Click();
        }
Exemplo n.º 5
0
        public void EditCouponOnMaxUseValue(string MaxUses)
        {
            Logger.Info("EditCouponOnMaxUseValue");
            WebDriverUtils.WaitForElementToBeClickable(driver, AddButton);

            ClickEditButton();
            TypeMaxUsesVal(MaxUses);
            ClickUpdateButton();
        }
Exemplo n.º 6
0
        public void SearchCoupon(string Value)
        {
            Logger.Info("SearchCoupon " + Value);
            WebDriverUtils.WaitForElementToBeClickable(driver, AddButton);

            ClickSearchButton();
            TypeSearchValue(Value);
            ClickGoButton();
        }
Exemplo n.º 7
0
        private void TypeCodeCouponValue(string codecoupon)
        {
            Logger.Info("TypeCodeCouponValue");
            WebDriverUtils.WaitForElementToBeVisible(driver, ".//input[@id='codeadd' and @placeholder='Coupon Code']");
            WebDriverUtils.WaitForElementToBeClickable(driver, ACCouponCodeField);

            ACCouponCodeField.Clear();
            ACCouponCodeField.SendKeys(codecoupon);
        }
Exemplo n.º 8
0
        public String OpenPrintWindow()
        {
            Logger.Info("OpenPrintWindow");
            WebDriverUtils.WaitForElementToBeClickable(driver, AddButton);

            string ParentWindow = ClickPrintButton();

            return(ParentWindow);
        }
Exemplo n.º 9
0
        private void TypePercentageValue(string percentage)
        {
            Logger.Info("TypePercentageValue");
            WebDriverUtils.WaitForElementToBeVisible(driver, ".//form[@id='addcoupon']//input[@id='rate' and @placeholder='Percentage']");
            WebDriverUtils.WaitForElementToBeClickable(driver, ACPercentageField);

            ACPercentageField.Clear();
            ACPercentageField.SendKeys(percentage);
        }
Exemplo n.º 10
0
        private void ClickGenerateButton()
        {
            Logger.Info("ClickGenerateButton");
            WebDriverUtils.WaitForElementToBeVisible(driver, ".//form[@id='addcoupon']//button[@id='add']");
            WebDriverUtils.WaitForElementToBeClickable(driver, GenerateButton);

            GenerateButton.Click();

            WebDriverUtils.WaitForElementHasText(driver);
        }
Exemplo n.º 11
0
 public void GoToMyProfile()
 {
     System.Threading.Thread.Sleep(2000);
     Logger.Info("Click on My profile Arrow");
     WebDriverUtils.WaitForElementToBeClickable(driver, myProfileArrow);
     //wait.Until(ExpectedConditions.ElementToBeClickable(myProfileArrow));
     myProfileArrow.Click();
     Logger.Info("Click on My Profile");
     myProfile.Click();
 }
Exemplo n.º 12
0
 public string CouponPercentageMethod()
 {
     WebDriverUtils.WaitForElementToBeVisible(driver, TableFrameXpath);
     if (CouponsPageValidations.ValidateIfNoElementsFoundExist(driver, NoFoundElementsField))
     {
         //Initialize variables
         WebDriverUtils.WaitForElementToBeClickable(driver, PercentageField);
         string CouponPercentage = WebDriverUtils.GetElementText(PercentageField);
         return(CouponPercentage);
     }
     return(null);
 }
Exemplo n.º 13
0
        public string MaxUsesMethod()
        {
            WebDriverUtils.WaitForElementToBeVisible(driver, TableFrameXpath);

            if (CouponsPageValidations.ValidateIfNoElementsFoundExist(driver, NoFoundElementsField) == true)
            {
                WebDriverUtils.WaitForElementToBeClickable(driver, MaxUsesField);
                string CouponMaxUses = WebDriverUtils.GetElementText(MaxUsesField);
                return(CouponMaxUses);
            }

            return(null);
        }
Exemplo n.º 14
0
        private void ClickUpdateButton()
        {
            Logger.Info("Click Update Button");
            string      number       = CouponId.Text;
            string      Xpath        = ".//div[@id='editCop" + number + "']//button[@id=" + number + "]";
            IWebElement UpdateButton = driver.FindElement(By.XPath(Xpath));

            WebDriverUtils.WaitForElementToBeVisible(driver, Xpath);
            WebDriverUtils.WaitForElementToBeClickable(driver, UpdateButton);

            UpdateButton.Click();
            WebDriverUtils.WaitForInvisibilityOfElementLocated(driver, "//*[@id='editCop" + number + "']");
        }
Exemplo n.º 15
0
        private string ClickPrintButton()
        {
            Logger.Info("ClickPrintButton");
            string ParentWindow = driver.CurrentWindowHandle;

            WebDriverUtils.WaitForElementToBeClickable(driver, PrintButton);
            PrintButton.Click();

            foreach (string window in driver.WindowHandles)
            {
                driver.SwitchTo().Window(window);
            }
            return(ParentWindow);
        }
Exemplo n.º 16
0
        private void TypeMaxUsesVal(string MaxUses)
        {
            Logger.Info("TypeMaxUsesVal");
            string number = CouponId.Text;
            string Xpath  = ".//form[contains(@id,'" + number + "')]//input[@placeholder='Maximum Uses']";

            WebDriverUtils.WaitForElementToBeVisible(driver, "//*[@id='editCop" + number + "']");
            IWebElement MaxUsesField = driver.FindElement(By.XPath(Xpath));

            WebDriverUtils.WaitForElementToBeVisible(driver, Xpath);
            WebDriverUtils.WaitForElementToBeClickable(driver, MaxUsesField);

            MaxUsesField.Clear();
            MaxUsesField.SendKeys(MaxUses);
        }
Exemplo n.º 17
0
        private string ClickSubmitCoupon()
        {
            string CouponCode;

            Logger.Info("ClickSubmitCoupon");

            CouponCode = WebDriverUtils.GetInputText(ACCouponCodeField);

            WebDriverUtils.WaitForElementToBeVisible(driver, ".//div[@class='modal-footer']/button[@id='#']");
            WebDriverUtils.WaitForElementToBeClickable(driver, SubmitButton);

            SubmitButton.Click();

            WebDriverUtils.WaitForInvisibilityOfElementLocated(driver, "//*[@id='ADD_COUPON']");

            return(CouponCode);
        }
Exemplo n.º 18
0
        public bool SearchFieldMethod(string value)
        {
            //Initialize variables
            bool failed;

            WebDriverUtils.WaitForElementToBeVisible(driver, TableFrameXpath);

            if (CouponsPageValidations.ValidateIfNoElementsFoundExist(driver, NoFoundElementsField) == true)
            {
                WebDriverUtils.WaitForElementToBeClickable(driver, CouponCodeField);

                string CouponCode       = WebDriverUtils.GetElementText(CouponCodeField);
                string CouponPercentage = WebDriverUtils.GetElementText(PercentageField);
                string CouponMaxUses    = WebDriverUtils.GetElementText(MaxUsesField);

                if (CouponCode == value)
                {
                    failed = true;
                }
                else
                {
                    if (CouponPercentage == value)
                    {
                        failed = true;
                    }
                    else
                    {
                        if (CouponMaxUses == value)
                        {
                            failed = true;
                        }
                        else
                        {
                            failed = false;
                        }
                    }
                }
            }
            else
            {
                failed = false;
            }
            return(failed);
        }
Exemplo n.º 19
0
        public bool CouponDeletedMethod(string deletevalue)
        {
            //Initialize variables
            bool exists;

            WebDriverUtils.WaitForElementToBeVisible(driver, TableFrameXpath);

            if (CouponsPageValidations.ValidateIfNoElementsFoundExist(driver, NoFoundElementsField) == false)
            {
                exists = false;
                return(exists);
            }
            else
            {
                WebDriverUtils.WaitForElementToBeClickable(driver, CouponId);
                exists = CouponId.Displayed.Equals(deletevalue);
                return(exists);
            }
        }
Exemplo n.º 20
0
 private void ClickGoButton()
 {
     Logger.Info("ClickGoButton");
     WebDriverUtils.WaitForElementToBeClickable(driver, GoButton);
     GoButton.Click();
 }
Exemplo n.º 21
0
 public void GoToCouponsPage()
 {
     WebDriverUtils.WaitForElementToBeClickable(driver, CouponsPage);
     Logger.Info("Click on Coupons Menu");
     CouponsPage.Click();
 }
Exemplo n.º 22
0
        //Starting methods for coupons actions.

        public void goToCouponsPage()
        {
            Logger.Info("goToCouponsPage");
            WebDriverUtils.WaitForElementToBeClickable(driver, CouponsPageButton);
            CouponsPageButton.Click();
        }
Exemplo n.º 23
0
 private void TypeSearchValue(string Value)
 {
     Logger.Info("TypoeSearchValue");
     WebDriverUtils.WaitForElementToBeClickable(driver, SearchField);
     SearchField.SendKeys(Value);
 }