Ejemplo n.º 1
0
        public void NavigateToFileVerifyBackForwardAndRefreshTest()
        {
            Browser.Navigate.ToFile($@"{BasePath}\{AmazonHome}"); // VerifyBase Navigate.ToFile().
            var originalUrl = Browser.Url;

            CartButton.Click();
            var nextUrl = Browser.Url;

            Browser.Verify.Contains("cart", nextUrl);

            Browser.Navigate.Back();

            Browser.Verify.Equal(originalUrl, Browser.Url); // VerifyBase Navigate.Back().

            Browser.Navigate.Forward();

            Browser.Verify.Equal(nextUrl, Browser.Url); // VerifyBase Navigate.Forward().

            var cartButton = CartButton;

            Browser.Verify.True(cartButton.Displayed);

            Browser.Navigate.Refresh();

            Assert.Throws <StaleElementReferenceException>(() => cartButton.Displayed); // VerifyBase Navigate.Refresh().
        }
Ejemplo n.º 2
0
        public void RemoveFromCart()
        {
            if (!CanRemoveFromCart())
            {
                throw new InvalidElementStateException();
            }

            CartButton.Click();
        }
Ejemplo n.º 3
0
        public void AddToCart()
        {
            if (!CanAddToCart())
            {
                throw new InvalidElementStateException();
            }

            CartButton.Click();
        }
        void ReleaseDesignerOutlets()
        {
            if (CartButton != null)
            {
                CartButton.Dispose();
                CartButton = null;
            }

            if (ChatButton != null)
            {
                ChatButton.Dispose();
                ChatButton = null;
            }

            if (MyLibraryButton != null)
            {
                MyLibraryButton.Dispose();
                MyLibraryButton = null;
            }

            if (NotificationsButton != null)
            {
                NotificationsButton.Dispose();
                NotificationsButton = null;
            }

            if (ProfileButton != null)
            {
                ProfileButton.Dispose();
                ProfileButton = null;
            }

            if (ProfileButton2 != null)
            {
                ProfileButton2.Dispose();
                ProfileButton2 = null;
            }

            if (ProfilePic != null)
            {
                ProfilePic.Dispose();
                ProfilePic = null;
            }

            if (ProfilePicButton != null)
            {
                ProfilePicButton.Dispose();
                ProfilePicButton = null;
            }
        }
Ejemplo n.º 5
0
 private async void TypeCart(CartButton obj)
 {
     if (current != null)
     {
         current.IsSelected = false;
     }
     current            = obj;
     current.IsSelected = true;
     foreach (var item in ToolbarTitle)
     {
         if (item != obj)
         {
             item.IsSelected = false;
         }
     }
     if (obj.Type == CartEnum.Pending_Orders)
     {
         await NavigationService.NavigateAsync(Routes.ShippingReview);
     }
 }
        public void ValidateProductsChosen()
        {
            Helper.ScrollToSeeTheRightButton(_driver, FirstBlouse);
            FirstBlouse.Click();
            _driver.SwitchTo().Frame(_driver.FindElement(By.XPath("//iframe[@src='http://automationpractice.com/index.php?id_product=2&controller=product&content_only=1']")));
            FirstBlouseBigImage.Click();
            Helper.ScrollToSeeTheRightButton(_driver, AddToCartButton);
            AddToCartButton.Click();
            Thread.Sleep(2000);
            ContinueShoppingButton.Click();

            Actions     actions = new Actions(_driver);
            IWebElement target  = DressesTab;

            actions.MoveToElement(target).Perform();
            SummerDressesSubMenu.Click();
            Helper.ScrollToSeeTheRightButton(_driver, ThirdDress);
            ThirdDress.Click();
            _driver.SwitchTo().Frame(_driver.FindElement(By.XPath("//iframe[@src='http://automationpractice.com/index.php?id_product=7&controller=product&content_only=1']")));
            ThirdDressBigImage.Click();
            Helper.ScrollToSeeTheRightButton(_driver, AddToCartButton);
            AddToCartButton.Click();
            Thread.Sleep(3000);
            ContinueShoppingButton.Click();

            Helper.ScrollToSeeTheRightButton(_driver, TshirtsTab);
            TshirtsTab.Click();
            Helper.ScrollToSeeTheRightButton(_driver, FirstTshirt);
            FirstTshirt.Click();
            _driver.SwitchTo().Frame(_driver.FindElement(By.XPath("//iframe[@src='http://automationpractice.com/index.php?id_product=1&controller=product&content_only=1']")));
            FirstTshirtBigImage.Click();
            Helper.ScrollToSeeTheRightButton(_driver, AddToCartButton);
            AddToCartButton.Click();
            Thread.Sleep(3000);
            CheckoutButton.Click();
            Helper.ScrollToSeeTheRightButton(_driver, CartButton);
            CartButton.Click();
        }
Ejemplo n.º 7
0
    void AddItem(Item item)
    {
        if (itemsInCart.ContainsKey(item))
        {
            itemsInCart[item] += 1;
        }
        else
        {
            itemsInCart.Add(item, 1);
            CartButton newCartButton = Instantiate(cartButton, cartPanel).GetComponent <CartButton>();
            cartButtons.Add(item, newCartButton);
            cartButtons[item].Init(item);
        }

        cartButtons[item].UpdateInfo(item, itemsInCart[item]);

        totalPrice += item.price;

        if (OnAddInCart != null)
        {
            OnAddInCart(item, totalPrice);
        }
    }
Ejemplo n.º 8
0
 public void ClickCartButton()
 {
     CartButton.Click();
 }