public void WhenCustomerDidNotFillOutRequiredFildsOfOrderFormAndAcceptIt_ThenEnterRequiredDataAlertIsShowed()
        {
            var cartPage = NavigationBar.ClickCartLink();

            cartPage.CheckProductsTable();
            var orderWindow = cartPage.PlaceOrder();

            orderWindow.SubmitWindow();

            Assert.IsTrue(orderWindow.IsEnterRequiredDataAlertShowed());
        }
        public void GivenRequiredCustomerData_WhenCustomerFillsOutOrderForm_ThenPurchaseAlertWithInputtedDataIsShowed()
        {
            var cartPage = NavigationBar.ClickCartLink();

            Assert.IsTrue(cartPage.IsCartPageOpened());

            var orderWindow   = cartPage.PlaceOrder();
            var purchaseAlert = orderWindow.FillOutFormAndPurchase(User);

            ValidatePurchaseAlertMessage(purchaseAlert);
        }
        public void GivenProduct_WhenCustomerAddsProductToCartAndConfirmsOrder_ThenOrderWindowIsDisplayed()
        {
            var productPage = TestedPageOrWindow.SelectProductAndOpenProductPage(Products[1]);

            productPage.AddProductToCart();

            Assert.IsTrue(productPage.IsProductAddedAlertShowed());

            var cartPage = NavigationBar.ClickCartLink();

            Assert.IsTrue(cartPage.IsProductAddedToCart(Products[1].ProductName));

            var orderWindow = cartPage.PlaceOrder();

            Assert.IsTrue(orderWindow.IsWindowOpened());
        }
        public void GivenProduct_WhenCustomerAddsProductsToCartAndRemovesThem_ThenTotalOfTheOrderIsNotDisplayed()
        {
            var productPage = TestedPageOrWindow.SelectProductAndOpenProductPage(Products[2]);

            productPage.AddProductToCart();

            Assert.IsTrue(productPage.IsProductAddedAlertShowed());

            var cartPage = NavigationBar.ClickCartLink();

            Assert.IsTrue(cartPage.IsProductAddedToCart(Products[2].ProductName));

            cartPage.RemoveProductFromCart();

            Assert.IsTrue(cartPage.IsProductRemovedFromCart(Products[2].ProductName));
            Assert.IsFalse(cartPage.IsTotalOrderVisible());
        }
        public void GivenListOfProducts_WhenCustomerAddProductsToCart_ThenProductAddedSuccesfullyAlertShowedAndProductIsPresentInCartAndCorrectPriceIsDisplayed()
        {
            CartPage cartPage;
            var      productList = GnerateListOfProducts(Products[0], Products[1]);

            foreach (var product in productList)
            {
                var productPage = TestedPageOrWindow.SelectProductAndOpenProductPage(product);
                productPage.AddProductToCart();

                Assert.IsTrue(productPage.IsProductAddedAlertShowed());

                cartPage = NavigationBar.ClickCartLink();

                Assert.IsTrue(cartPage.IsProductAddedToCart(product.ProductName));
                Assert.IsTrue(CartPage.TotalAmount == cartPage.GetTotalPrice);

                SelectTestedAppPage();
            }
        }
        public void GivenProductAndAllCustomerData_WhenCustomerAddsProductToCartFillsOutOrderFormAndConfirmsIt_ThenPurchaseAlertWithInputtedDataIsShowed()
        {
            var productPage = TestedPageOrWindow.SelectProductAndOpenProductPage(Products[0]);

            productPage.AddProductToCart();

            Assert.IsTrue(productPage.IsProductAddedAlertShowed());

            var cartPage = NavigationBar.ClickCartLink();

            Assert.IsTrue(cartPage.IsProductAddedToCart(Products[0].ProductName));

            var orderWindow = cartPage.PlaceOrder();

            Assert.AreEqual(orderWindow.GetTotalAmountFromOrderWindow(), CartPage.TotalAmount);

            var purchaseAlert = orderWindow.FillOutFormAndPurchase(User);

            ValidatePurchaseAlertMessage(purchaseAlert);
        }
        public void WhenUserOpensCartPage_ThenPageIsOpened()
        {
            var cartPage = NavigationBar.ClickCartLink();

            Assert.IsTrue(cartPage.IsCartPageOpened());
        }