예제 #1
0
        public static void FilterByPriceRange(FilterPage page, int?minPrice, int?maxPrice)
        {
            string url = page.GetDriver().Url;

            SetPrice(page, minPrice, maxPrice).SubmitPriceFilter();
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
        }
        public static void VerifyMakeOrderIsClickable(CheckoutPage page)
        {
            Action <IWebElement> act = (elem) => { };

            WaitingExtensions.DoUntilElementIsDisplayed(act, page.DeliveryBlock, true);
            page.MakeOrderButton.Displayed.Should().BeTrue();
        }
예제 #3
0
        public static FilterPage ClickCheckbox(FilterPage page, string name)
        {
            string url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.MoreIzdButton);
            if (!ConstantCollectionsExtensions.RussianLetters.Contains(name[0]))
            {
                for (int i = 0; i < page.CheckboxIzdSet.Count; i++)
                {
                    if (page.CheckboxIzdSet[i].GetText().IndexOf(name + " (") == 0)
                    {
                        if (page.CheckboxIzdSet[i].GetText().Equals(name + " (0)"))
                        {
                            throw new Exception("No products with such filtering parameters.");
                        }
                        page.CheckboxIzdSet[i].Click();
                        break;
                    }
                }
            }
            else
            {
                int j = page.CheckboxIzdSet.Count;
                int i = 0;
                while (page.CheckboxIzdSet[i].GetText()[0] != name[0])
                {
                    if (name[0] < page.CheckboxIzdSet[j / 2].GetText()[0])
                    {
                        j = (j - i) / 2;
                    }
                    else
                    {
                        i = i + (j - i) / 2;
                    }
                }
                int k = i - 1;
                while (page.CheckboxIzdSet[k].GetText()[0] == name[0] && page.CheckboxIzdSet[k].GetText().IndexOf(name + " (") != 0)
                {
                    k--;
                }
                if (page.CheckboxIzdSet[k].GetText().IndexOf(name + " (") != 0)
                {
                    k = i + 1;
                    while (page.CheckboxIzdSet[k].GetText()[0] == name[0] && page.CheckboxIzdSet[k].GetText().IndexOf(name + " (") != 0)
                    {
                        k++;
                    }
                }

                if (page.CheckboxIzdSet[k].GetText().Equals(name + " (0)"))
                {
                    throw new Exception("No products with such filtering parameters.");
                }
                page.CheckboxIzdSet[k].Click();
            }
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
            return(page);
        }
예제 #4
0
        public static void BuyElement(FilterPage page, int elementIndex)
        {
            var url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.BuyButtonSet[elementIndex]);
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
        }
예제 #5
0
        public static void ClickContinuePurchases(CartPageWithOrders page)
        {
            var url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.ProceedBuying);
            WaitingExtensions.WaitUntilUrlIsChanged(page, url);
        }
예제 #6
0
        public static CheckoutPage InputReceiverData(CheckoutPage page, string name, string phone, string email)
        {
            page.NameAndSurname.SetValue(name);
            page.Phone.SetValue(phone);
            page.Email.SetValue(email);
            Action <IWebElement> act0 = (elem) => { page.ContinueButton.Click(); };

            WaitingExtensions.DoUntilElementIsDisplayed(act0, page.MakeOrderButton, true);
            return(page);
        }
예제 #7
0
 public static void ClickPlusButton(CartPageWithOrders page, int n)
 {
     if (n != 0)
     {
         Action <IWebElement> act0 = (elem) => elem.Click();
         WaitingExtensions.WaitUntilElementAppears(act0, page.AmountPlusButtonsSet[0]);
         for (int i = 0; i < n - 1; i++)
         {
             act0(page.AmountPlusButtonsSet[0]);
         }
     }
 }
예제 #8
0
        public static CheckoutPage InputReceiverData(CheckoutPage page, int howlongIcnwait)
        {
            string name  = "Vasia";
            string phone = "0684360744";
            string email = "*****@*****.**";

            page.NameAndSurname.SetValue(name);
            page.Phone.SetValue(phone);
            page.Email.SetValue(email);
            Action <IWebElement> act0 = (elem) => { page.ContinueButton.Click(); };

            WaitingExtensions.DoUntilElementIsDisplayed(act0, page.MakeOrderButton, true);
            return(page);
        }
        public static FilterPage ClickCheckbox(FilterPage page, string name, int howlongIcnwait)
        {
            string url = page.GetDriver().Url;
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.MoreIzdButton, howlongIcnwait);
            int i = SerchStandurt(page, name);

            if (i == -1)
            {
                throw new Exception("No products with such filtering parameters.");
            }
            page.Publishing[i].Click();
            WaitingExtensions.WaitUntilUrlIsChanged(page, url, howlongIcnwait);
            return(page);
        }
        public static void BuyElement(GoodsItemPage page, int elementIndex)
        {
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.BuyButton);
        }
예제 #11
0
        public static void ProceedToCheckout(BasketPage page, int howlongIcnwait)
        {
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.ProceedAnOrder, howlongIcnwait);
        }
예제 #12
0
        public static void SelectElement(FilterPage page, int elementIndex)
        {
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.ResultSet[elementIndex]);
        }
예제 #13
0
        public static void BuyElement(FilterPage page, int elementIndex, int howlongIcnwait)
        {
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.BuyButtonSet[elementIndex], howlongIcnwait);
        }
예제 #14
0
        public static void ProceedToCheckout(CartPageWithOrders page)
        {
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.ProceedAnOrder);
        }
예제 #15
0
        public static void ClickLinkOfProduct(CartPageWithOrders page, int n)
        {
            Action <IWebElement> act0 = (elem) => elem.Click();

            WaitingExtensions.WaitUntilElementAppears(act0, page.ProductsLinksSet[n]);
        }