Example #1
0
        public void CheckTheTotalPriceOfTwoIdenticalGoods()
        {
            Logger.Log.Info("CheckTheTotalPriceOfTwoIdenticalGoods");
            expectedProduct = ProductCreator.withCountAndPriceMultiplyedByTwo();
            string      totalPrice = "";
            ProductPage productPageCheckTheTotalPriceOfTwoIdenticalGoods = new ProductPage(driver);

            try
            {
                BasketPage basketPageCheckTheTotalPriceOfTwoIdenticalGoods =
                    productPageCheckTheTotalPriceOfTwoIdenticalGoods.OpenPage(expectedProduct.URL)
                    .AcceptCookies()
                    .AddProductToBasketSeveralTimes(expectedProduct.count)
                    .NavigateToBasket();

                products   = basketPageCheckTheTotalPriceOfTwoIdenticalGoods.GetProducts();
                totalPrice = basketPageCheckTheTotalPriceOfTwoIdenticalGoods.GetTotalPrice();
            }
            catch (Exception ex)
            {
                Logger.ErrorHandler(driver, ex);
            }
            Assert.AreEqual(expectedProduct.name, products[0].name, "invalid name");
            Assert.AreEqual(expectedProduct.color.ToLower(), products[0].color, "invalid color");
            Assert.AreEqual(expectedProduct.size, products[0].size, "invalid size");
            Assert.AreEqual(expectedProduct.item, products[0].item, "invalid item");
            Assert.AreEqual(expectedProduct.personalisation, products[0].personalisation, "invalid personalisation");
            Assert.AreEqual(expectedProduct.personalisationColor, products[0].personalisationColor, "invalid personalisation color");
            Assert.AreEqual(expectedProduct.price, totalPrice, "invalid price");
            Assert.AreEqual(expectedProduct.count, products[0].count, "invalid count");
        }
Example #2
0
        public void CheckTheTotalPriceOfTwoDifferentGoods()
        {
            Logger.Log.Info("CheckTheTotalPriceOfTwoDifferentGoods");
            expectedProducts = new List <Product>();
            expectedProducts.Add(ProductCreator.withManyColors_Black());
            expectedProducts.Add(ProductCreator.withManyColors_ArchiveBeige());
            string      totalPrice = "";
            ProductPage productPageCheckTheTotalPriceOfTwoDifferentGoods = new ProductPage(driver);

            try
            {
                productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[0].URL)
                .AcceptCookies()
                .AddProductToBasket()
                .NavigateToBasket();


                BasketPage basketPageCheckTheTotalPriceOfTwoDifferentGoods =
                    productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[1].URL)
                    .AddProductToBasket()
                    .NavigateToBasket();

                products   = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetProducts();
                totalPrice = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetTotalPrice();
            }
            catch (Exception ex)
            {
                Logger.ErrorHandler(driver, ex);
            }
            Assert.AreEqual(expectedProducts[0].name, products[0].name, "invalid name");
            Assert.AreEqual(expectedProducts[0].color.ToLower(), products[0].color, "invalid color");
            Assert.AreEqual(expectedProducts[0].size, products[0].size, "invalid size");
            Assert.AreEqual(expectedProducts[0].item, products[0].item, "invalid item");
            Assert.AreEqual(expectedProducts[0].personalisation, products[0].personalisation, "invalid personalisation");
            Assert.AreEqual(expectedProducts[0].personalisationColor, products[0].personalisationColor, "invalid personalisation color");
            Assert.AreEqual(expectedProducts[0].count, products[0].count, "invalid count");

            Assert.AreEqual(expectedProducts[1].name, products[1].name, "invalid name");
            Assert.AreEqual(expectedProducts[1].color.ToLower(), products[1].color, "invalid color");
            Assert.AreEqual(expectedProducts[1].size, products[1].size, "invalid size");
            Assert.AreEqual(expectedProducts[1].item, products[1].item, "invalid item");
            Assert.AreEqual(expectedProducts[1].personalisation, products[1].personalisation, "invalid personalisation");
            Assert.AreEqual(expectedProducts[1].personalisationColor, products[1].personalisationColor, "invalid personalisation color");
            Assert.AreEqual(expectedProducts[1].count, products[1].count, "invalid count");

            string productsTotalPrice = "£1,040";

            Assert.AreEqual(productsTotalPrice, totalPrice, "invalid price");
        }
Example #3
0
        public void ThenTotalPriceIsEqualToQuantityTimesBookPrice()
        {
            double expectedTotalPrice = basketPage.GetQuantity() * basketPage.GetProductPrice();

            AssertionsManager.AreEqual(driver, extentTest, expectedTotalPrice, basketPage.GetTotalPrice(), $"Total price is: {basketPage.GetTotalPrice()}");
        }