Esempio n. 1
0
        public void ShouldBeAbleToBuyRandomProduct()
        {
            // Open brand menu
            PageBase currentPage = new HomePage(_driver);

            ManufacturerPage manufacturerPage = null;
            ProductPage      productPage      = null;

            for (int i = 0; i < 50; i++)
            {
                currentPage = manufacturerPage = OpenRandomManufacturerPage(currentPage);

                if (!manufacturerPage.HasProducts)
                {
                    manufacturerPage = null;
                    continue;
                }

                productPage = OpenRandomProductPage(manufacturerPage);

                if (!productPage.CanAddProductToCart)
                {
                    productPage = null;
                    continue;
                }

                break;
            }

            if (manufacturerPage == null || productPage == null)
            {
                throw new Exception("Could not find available manufacturer and product");
            }

            var orderPage = OrderProductOnProductPage(productPage);

            Assert.AreEqual("Оформление заказа", orderPage.Title);
            Assert.AreEqual("Оформление заказа", orderPage.Header.GetInnerHtml());

            PopulateOrderForm(orderPage);

            if (!SystemRuntime.IsDebug())
            {
                ExcuteOrderOnOrderPage(orderPage);
            }
        }
Esempio n. 2
0
        public void ShouldBeAbleToMakePhoneCallRequestFromHomePage()
        {
            var page = new HomePage(_driver);

            var phoneCallPopup = page.OpenPhoneCallPopup();

            phoneCallPopup.NameImput.SendKeys("Владимир Владимирович");
            phoneCallPopup.PhoneInput.SendKeys("89312853680");
            phoneCallPopup.CommentInput.SendKeys("Я хочу проконсультироваться по поводу нужной мне модели");
            phoneCallPopup.TermCheckbox.Click();

            if (!SystemRuntime.IsDebug())
            {
                phoneCallPopup.SubmitButton.Click();

                Assert.IsEmpty(phoneCallPopup.GetErrorMessages());

                _wait.Until(
                    ExpectedConditions.ElementExists(By.CssSelector("div#popup-call-phone-wrapper>div.popup-center>p")),
                    "Popup with successfull phone call request was not displayed");
            }

            phoneCallPopup.ClosePopup();
        }