コード例 #1
0
 public void AddingProductToCartUser()
 {
     TestAction(() =>
     {
         string currentTestName = "AddingProductToCartUser";
         log.Debug("Starting " + currentTestName + " Test;");
         log.Debug("For user " + user.FirstName + user.LastName + ";");
         HomePage home     = new HomePage(driverForRun, false);
         SignInPage signin = new SignInPage(driverForRun);
         //bool isUserLogedIn = ValidateUser(user);
         Assume.That(signin.Login(user), "Failed login, test will not run");
         SmallSleep(); //moved from ValidateUser()
         var element = driverForRun.FindElement(By.XPath("//button[contains(@class,'d-md-block')]/div[text()=' START BROWSING ']"));
         TestHelper.JSexecutorClick(element, driverForRun);
         Assume.That(ValidateUser(user), "Logged-in account is not a user");
         SmallSleep();
         ProductHandler handler = new ProductHandler(driverForRun, home);
         Product product        = new Product(ProductCategories.Top_deals, 1, driverForRun);
         SmallSleep();
         int counter       = handler.GetContainerCounter(ProductContainer.Cart);
         int prodctsInCart = handler.CountProductsInContainer(ProductContainer.Cart, product);
         Assert.That(prodctsInCart < 1, "Selected product already in cart");
         MidSleep();
         handler.AddProductToContainer(ProductContainer.Cart, InterctionControlSet.Product_Details, product);
         MidSleep();
         Assert.That((prodctsInCart + 1) == handler.CountProductsInContainer(ProductContainer.Cart, product), "Product wasn't added properly");
         Assert.That((counter + 1) == handler.GetContainerCounter(ProductContainer.Cart), "Conter wasn't updated properly");
     });
 }
コード例 #2
0
        public void MovingProductFromCartToWishListUser()
        {
            TestAction(() =>
            {
                string currentTestName = "MovingProductFromCartToWishListUser";
                log.Debug("Starting " + currentTestName + " Test;");
                log.Debug("For user " + user.FirstName + user.LastName + ";");
                HomePage home = new HomePage(driverForRun, false);
                SmallSleep();
                ProductHandler handler = new ProductHandler(driverForRun, home);
                Product product        = new Product(ProductCategories.Top_deals, 2, driverForRun);
                SmallSleep();

                try
                {
                    int counterCart       = handler.GetContainerCounter(ProductContainer.Cart);
                    int prodctsInCart     = handler.CountProductsInContainer(ProductContainer.Cart, product);
                    int counterWishList   = handler.GetContainerCounter(ProductContainer.WishList);
                    int prodctsInWishList = handler.CountProductsInContainer(ProductContainer.WishList, product);
                    Assume.That(prodctsInCart >= 1, "Product not in cart, test will not proceed");
                    Assume.That(prodctsInWishList < 1, "Product already in wishist, test will not proceed");
                    MidSleep();
                    handler.AddProductToContainer(ProductContainer.WishList, InterctionControlSet.Container_Switch, product);
                    MidSleep();
                    Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 1, "Product did not got to WishList");
                    Assert.That(handler.CountProductsInContainer(ProductContainer.Cart, product) == 0, "Product wasn't removed from cart properly");
                    Assert.That((counterCart - 1) == handler.GetContainerCounter(ProductContainer.Cart), "Cart Conter wasn't updated properly");
                    Assert.That((counterWishList + 1) == handler.GetContainerCounter(ProductContainer.WishList), "WishList Conter wasn't updated properly");
                }
                //clean-up
                finally { handler.RemoveProductFromContainer(ProductContainer.WishList, InterctionControlSet.From_container, product); }
            });
        }
コード例 #3
0
 public void AddingProductToCartFromWishListUser()
 {
     TestAction(() =>
     {
         string currentTestName = "AddingProductToCartFromWishListUser";
         log.Debug("Starting " + currentTestName + " Test;");
         log.Debug("For user " + user.FirstName + user.LastName + ";");
         HomePage home = new HomePage(driverForRun, false);
         SmallSleep();
         ProductHandler handler = new ProductHandler(driverForRun, home);
         Product product        = new Product(ProductCategories.Top_deals, 2, driverForRun);
         SmallSleep();
         int counter       = handler.GetContainerCounter(ProductContainer.Cart);
         int prodctsInCart = handler.CountProductsInContainer(ProductContainer.Cart, product);
         Assume.That(prodctsInCart <= 1, "Product already in cart, test will not proceed");
         MidSleep();
         handler.AddProductToContainer(ProductContainer.WishList, InterctionControlSet.Product_Title, product);
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 1, "Product did not got to WishList");
         MidSleep();
         handler.AddProductToContainer(ProductContainer.Cart, InterctionControlSet.Container_Switch, product);
         MidSleep();
         handler.RemoveProductFromContainer(ProductContainer.WishList, InterctionControlSet.From_container, product);
         Assert.That((prodctsInCart + 1) == handler.CountProductsInContainer(ProductContainer.Cart, product), "Product wasn't added properly");
         Assert.That((counter + 1) == handler.GetContainerCounter(ProductContainer.Cart), "Conter wasn't updated properly");
     });
 }
コード例 #4
0
 public void RemovingProductFromWishListContainerTest()
 {
     TestAction(() =>
     {
         string currentTestName = "RemovingProductFromWishListContainerTest";
         log.Debug("Starting " + currentTestName + " Test;");
         log.Debug("For user " + user.FirstName + user.LastName + ";");
         HomePage home = new HomePage(driverForRun, false);
         SmallSleep();
         ProductHandler handler = new ProductHandler(driverForRun, home);
         Product product        = new Product(ProductCategories.Top_deals, 5, driverForRun);
         SmallSleep();
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 1, "Product not in wishlist");
         int counter = handler.GetContainerCounter(ProductContainer.WishList);
         MidSleep();
         handler.RemoveProductFromContainer(ProductContainer.WishList, InterctionControlSet.From_container, product);
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 0, "Product wasn't removed properly to wishlist");
         Assert.That((counter - 1) == handler.GetContainerCounter(ProductContainer.WishList), "Counter wasn't updated properly");
     });
 }
コード例 #5
0
 public void AddingProductToWishListFromProductTitleTest()
 {
     TestAction(() =>
     {
         string currentTestName = "AddingProductToWishListFromProductTitleTest";
         log.Debug("Starting " + currentTestName + " Test;");
         log.Debug("For user " + user.FirstName + user.LastName + ";");
         HomePage home = new HomePage(driverForRun, false);
         SmallSleep();
         ProductHandler handler = new ProductHandler(driverForRun, home);
         Product product        = new Product(ProductCategories.Top_deals, 3, driverForRun);
         SmallSleep();
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 0, "Product alreadty in wishlist");
         int counter = handler.GetContainerCounter(ProductContainer.WishList);
         MidSleep();
         handler.AddProductToContainer(ProductContainer.WishList, InterctionControlSet.Product_Title, product);
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 1, "Product wasn't added properly to wishlist");
         Assert.That((counter + 1) == handler.GetContainerCounter(ProductContainer.WishList), "Counter wasn't updated properly");
     });
 }
コード例 #6
0
 public void RemovingProductFromCartUser()
 {
     TestAction(() =>
     {
         string currentTestName = "RemovingProductFromCartUser";
         log.Debug("Starting " + currentTestName + " Test;");
         log.Debug("For user " + user.FirstName + user.LastName + ";");
         HomePage home = new HomePage(driverForRun, false);
         SmallSleep();
         ProductHandler handler = new ProductHandler(driverForRun, home);
         Product product        = new Product(ProductCategories.Top_deals, 1, driverForRun);
         SmallSleep();
         int counter       = handler.GetContainerCounter(ProductContainer.Cart);
         int prodctsInCart = handler.CountProductsInContainer(ProductContainer.Cart, product);
         Assume.That(prodctsInCart >= 1, "No such product in cart, test will not proceed");
         MidSleep();
         handler.RemoveProductFromContainer(ProductContainer.Cart, InterctionControlSet.From_container, product);
         Assert.That(handler.CountProductsInContainer(ProductContainer.Cart, product) == 0, "Product wasn't removed properly");
         Assert.That((counter - prodctsInCart) == handler.GetContainerCounter(ProductContainer.Cart), "Conter wasn't updated properly");
     });
 }
コード例 #7
0
 public void RemovingProductFromWishListFromProductDetailsTest()
 {
     TestAction(() =>
     {
         string currentTestName = "RemovingProductFromWishListFromProductDetailsTest";
         log.Debug("Starting " + currentTestName + " Test;");
         log.Debug("For user " + user.FirstName + user.LastName + ";");
         HomePage home = new HomePage(driverForRun, false);
         //SignInPage signin = new SignInPage(driverForRun);
         //Assume.That(signin.Login(user), "Failed login, test will not run");
         //Assume.That(ValidateUser(user), "Logged-in account is not a user");
         SmallSleep();
         ProductHandler handler = new ProductHandler(driverForRun, home);
         Product product        = new Product(ProductCategories.Top_deals, 4, driverForRun);
         SmallSleep();
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 1, "Product not in wishlist");
         int counter = handler.GetContainerCounter(ProductContainer.WishList);
         MidSleep();
         handler.RemoveProductFromContainer(ProductContainer.WishList, InterctionControlSet.Product_Details, product);
         Assert.That(handler.CountProductsInContainer(ProductContainer.WishList, product) == 0, "Product wasn't removed properly to wishlist");
         Assert.That((counter - 1) == handler.GetContainerCounter(ProductContainer.WishList), "Counter wasn't updated properly");
     });
 }