public void DeleteProduct(Product addingProduct1, Product addingProduct2)
        {
            HomePage homePage = LoadApplication();

            homePage.AddProductToCart(addingProduct1);
            homePage.AddProductToCart(addingProduct2);

            wait.Until((drv) => {
                return(homePage.GetCartButtonText().Contains(HomePage.TWO_PRODUCT));
            });
            Assert.IsTrue(homePage.GetCartButtonText().Contains(HomePage.TWO_PRODUCT));
            Assert.AreEqual(addingProduct1.Title, homePage.OpenCartButton()
                            .GetProductByName(addingProduct1).GetProductNameText());
            Assert.AreEqual(addingProduct2.Title, homePage.GetCartContainerComponent()
                            .GetProductByName(addingProduct2).GetProductNameText());

            homePage.GetCartContainerComponent().RemoveProduct(addingProduct2);

            wait.Until((drv) => {
                return(homePage.GetCartButtonText().Contains(HomePage.ONE_PRODUCT));
            });
            Assert.IsTrue(homePage.GetCartButtonText().Contains(HomePage.ONE_PRODUCT));

            homePage.OpenCartButton().RemoveProduct(addingProduct1);

            wait.Until((drv) => {
                return(homePage.GetCartButtonText().Contains(HomePage.ZERO_PRODUCT));
            });
            Assert.IsTrue(homePage.GetCartButtonText().Contains(HomePage.ZERO_PRODUCT));
            Assert.IsTrue(homePage.OpenEmptyCartButton().GetInfoMessageText().Length > 0);
        }
        public void CheckTotalSum(Product addingProduct1, Product addingProduct2)
        {
            HomePage homePage = LoadApplication();

            homePage.AddProductToCart(addingProduct1);
            Thread.Sleep(1500);   //Only for presentation
            homePage.AddProductToCart(addingProduct2);
            Thread.Sleep(1500);   //Only for presentation

            WaitCheckOutLink();

            Assert.AreEqual(homePage.OpenCartButton().GetTotalSumProducts(),
                            homePage.GetCartContainerComponent().GetTablePriceTotal());
            Thread.Sleep(1500);   //Only for presentation
        }
        public void PriceInTable(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            Thread.Sleep(1000); // only for presentation
            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartPage = homePage
                               .GotoShoppingCartPage();
            shoppingCartPageUpdate = shoppingCartPage
                                     .UpdateMessage(addingProduct, ShoppingCartData.VALID_CHECK);
            Thread.Sleep(1000); // only for presentation
            Console.WriteLine(shoppingCartPageUpdate.GetTablePriceSubTotal()
                              + " + " + shoppingCartPageUpdate.GetTablePriceEcoTax()
                              + " + " + shoppingCartPageUpdate.GetTablePriceVat() //only for presentation
                              + " == " + shoppingCartPageUpdate.GetTablePriceTotal());
            Assert.IsTrue(shoppingCartPageUpdate.GetTablePriceSubTotal()
                          + shoppingCartPageUpdate.GetTablePriceEcoTax()
                          + shoppingCartPageUpdate.GetTablePriceVat()
                          == shoppingCartPageUpdate.GetTablePriceTotal());

            Console.WriteLine(shoppingCartPageUpdate.GetTablePriceVat() +
                              "==" + ((shoppingCartPageUpdate.GetTablePriceSubTotal() + //only for presentation
                                       "*" + ShoppingCartData.FOR_VAT_1) + "/" + ShoppingCartData.FOR_VAT_2));
            Assert.IsTrue(shoppingCartPageUpdate.GetTablePriceVat()
                          == ((shoppingCartPageUpdate.GetTablePriceSubTotal()
                               * ShoppingCartData.FOR_VAT_1) / ShoppingCartData.FOR_VAT_2));
        }
Example #4
0
        public void CheckCurrencyFormat(Currency currency, string puttern)
        {
            HomePage homePage = LoadHomePage();

            homePage = homePage.ChooseCurrency(currency);
            homePage.AddProductToCart(ProductRepository.GetIPhone());
            cartPage = homePage.GotoShoppingCartPage();
            SelectShippingMethodComponent ShippingMethod = cartPage.ApplySippingAndTaxes(ShippingDetailsRepository.GetUADetails());

            cartPage = ShippingMethod.ApllyShippingMethod();
            Thread.Sleep(2000);                                          // for presentation ONLY
            Total             = cartPage.GetPriceOption("Total:");
            SubTotal          = cartPage.GetPriceOption("Sub-Total:");
            FlatShippingRate  = cartPage.GetPriceOption("Flat Shipping Rate:");
            FixedTestTax      = cartPage.GetPriceOption(TaxRateRepository.GetFixTaxRate().Name + ":");
            PercentageTestTax = cartPage.GetPriceOption(TaxRateRepository.GetPercentageTaxRate().Name + ":");

            StringAssert.IsMatch(puttern, Total);
            StringAssert.IsMatch(puttern, SubTotal);
            StringAssert.IsMatch(puttern, FlatShippingRate);
            StringAssert.IsMatch(puttern, FixedTestTax);
            StringAssert.IsMatch(puttern, PercentageTestTax);

            // for presentation ONLY
            Console.WriteLine(Total);
            Console.WriteLine(SubTotal);
            Console.WriteLine(FlatShippingRate);
            Console.WriteLine(PercentageTestTax);
            Console.WriteLine(FixedTestTax);
        }
        public void AddProduct(Product addingProduct1, Product addingProduct2)
        {
            HomePage homePage = LoadApplication();

            homePage.AddProductToCart(addingProduct1);
            Thread.Sleep(1500);   //Only for presentation
            homePage.AddProductToCart(addingProduct2);
            Thread.Sleep(1500);   //Only for presentation

            WaitCheckOutLink();
            Assert.AreEqual(addingProduct1.Title, homePage.OpenCartButton()
                            .GetProductByName(addingProduct1).GetProductNameText());
            Thread.Sleep(1500);   //Only for presentation
            Assert.AreEqual(addingProduct2.Title, homePage.GetCartContainerComponent()
                            .GetProductByName(addingProduct2).GetProductNameText());

            Assert.IsTrue(homePage.GetCartButtonText().Contains(HomePage.TWO_PRODUCT));
        }
        public void Update(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            ShoppingCartMessage shoppingCartPageUpdate = homePage
                                                         .GotoShoppingCartPage()
                                                         .UpdateMessage(addingProduct, ShoppingCartData.VALID_CHECK);

            Assert.IsTrue(shoppingCartPageUpdate.GetUpdateMessage()
                          .Contains(ShoppingCartData.UPDATE_MESSAGE));
            Thread.Sleep(1000); // only for presentation
        }
        public void UpdateAfterSymbols(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartEmptyPage = homePage
                                    .GotoShoppingCartPage()
                                    .NotUpdateMessage(addingProduct, ShoppingCartData.INVALID_CHECK_SYM);
            Thread.Sleep(1000); // only for presentation
            Assert.AreEqual(ShoppingCartEmptyPage.CART_IS_EMPTY, shoppingCartEmptyPage.GetInfoMessageText());
            homePage = shoppingCartEmptyPage.GoToHomePage();
            Thread.Sleep(1000); // only for presentation
        }
        public void UpdateAfterEmpty(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartEmptyPage = homePage
                                    .GotoShoppingCartPage()
                                    .ClearQuantity(addingProduct);
            Thread.Sleep(1000); // only for presentation
            Assert.AreEqual(ShoppingCartEmptyPage.CART_IS_EMPTY, shoppingCartEmptyPage.GetInfoMessageText());
            homePage = shoppingCartEmptyPage.GoToHomePage();
            Thread.Sleep(1000); // only for presentation
        }
Example #9
0
        public void CheckFixedTaxHasTheSameValueAsInAdminPanel()
        {
            HomePage homePage = LoadHomePage();

            homePage.AddProductToCart(ProductRepository.GetIPhone());
            cartPage = homePage.GotoShoppingCartPage();
            SelectShippingMethodComponent ShippingMethod = cartPage.ApplySippingAndTaxes(ShippingDetailsRepository.GetUADetails());

            cartPage = ShippingMethod.ApllyShippingMethod();
            Thread.Sleep(2000);                                          // for presentation ONLY

            decimal fixedTestTax   = cartPage.GetPriceOptionValue(TaxRateRepository.GetFixTaxRate().Name + ":");
            decimal expectedResult = 2m;

            Assert.AreEqual(expectedResult, fixedTestTax);
        }
Example #10
0
        public void Remove(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            Thread.Sleep(1000); // only for presentation
            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartEmptyPage = homePage
                                    .GotoShoppingCartPage()
                                    .GoToEmptyPage(addingProduct);
            Thread.Sleep(1000); // only for presentation
            Assert.IsTrue(shoppingCartEmptyPage.Equal());
            Assert.AreEqual(ShoppingCartEmptyPage.CART_IS_EMPTY, shoppingCartEmptyPage.GetInfoMessageText());
            homePage = shoppingCartEmptyPage.GoToHomePage();
            Thread.Sleep(1000); // only for presentation
        }
        public void PriceEqual(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            Thread.Sleep(1000); // only for presentation
            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartPage = homePage
                               .GotoShoppingCartPage();
            shoppingCartPageUpdate = shoppingCartPage
                                     .UpdateMessage(addingProduct, ShoppingCartData.VALID_CHECK);
            Thread.Sleep(1000);                                                // only for presentation
            Console.WriteLine(shoppingCartPageUpdate.TotalPrice(addingProduct) //only for presentation
                              + "==" + shoppingCartPageUpdate.GetTablePriceTotal());
            Assert.IsTrue(shoppingCartPageUpdate.TotalPrice(addingProduct)
                          == shoppingCartPageUpdate.GetTablePriceTotal());
        }
        public void Price(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            Thread.Sleep(1000); // only for presentation
            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartPage = homePage
                               .GotoShoppingCartPage();
            Assert.IsTrue(shoppingCartPage
                          .GetShoppingCartTitleText()
                          .Contains(ShoppingCartData.CART_IS_OPEN));

            Assert.AreEqual(shoppingCartPage
                            .UnitPrice(addingProduct),
                            shoppingCartPage
                            .TotalPrice(addingProduct));
        }
        public void PriceAfterUpdate(Product addingProduct)
        {
            HomePage homePage = LoadApplication();

            Thread.Sleep(1000); // only for presentation
            homePage.AddProductToCart(addingProduct);
            Thread.Sleep(1000); // only for presentation
            shoppingCartPage = homePage
                               .GotoShoppingCartPage();
            shoppingCartPageUpdate = shoppingCartPage
                                     .UpdateMessage(addingProduct, ShoppingCartData.VALID_CHECK);
            Thread.Sleep(1000); // only for presentation

            Assert.IsTrue(shoppingCartPageUpdate
                          .GetData(addingProduct) == ShoppingCartData.VALID_CHECK);

            Assert.IsTrue((shoppingCartPageUpdate
                           .UnitPrice(addingProduct) * shoppingCartPageUpdate.GetIntData(addingProduct))
                          == shoppingCartPageUpdate.TotalPrice(addingProduct));
        }