コード例 #1
0
        public void SecondTestCase()
        {
            Home HomeWebPage = new Home(Driver, Wait);

            HomeWebPage.SearchFor("Samsung Galaxy S20 FE 5G");
            Assert.IsTrue(Driver.Title.Contains("Samsung Galaxy S20 FE 5G"));

            SearchFor SearchForWebPage     = new SearchFor(Driver, Wait);
            var       selectedProductPrice = SearchForWebPage.GetPriceOfFirstItemOfSearchResult();

            SearchForWebPage.ClickOnFirstItemOfSearchResult();

            DetailProduct DetailProductWebPage = new DetailProduct(Driver, Wait);
            var           detailProductPrice   = DetailProductWebPage.GetPriceOfProduct();

            DetailProductWebPage.ClickOnFirstItemOfSearchResult();

            Assert.AreEqual(selectedProductPrice, detailProductPrice);

            if (DetailProductWebPage.VerifyCartCounter() == true)
            {
                DetailProductWebPage.ClickOnCartIcon();
                Cart CartWebPage = new Cart(Driver, Wait);
                var  cartDetailPriceOfProduct = CartWebPage.GetPriceOfProduct();

                Assert.AreEqual(selectedProductPrice, cartDetailPriceOfProduct);
                CartWebPage.ClickOnDeleteItemLink();

                if (CartWebPage.VerifyEmptyCartOperation() == false)
                {
                    Assert.Fail("There was an error when system tried to empty cart");
                }
            }
            else
            {
                Assert.Fail("Product is not added to cart.");
            }
        }