示例#1
0
        public void WhenICreateTheFollowingProductDetails(Table table)
        {
            dynamic     data        = table.CreateDynamicInstance();
            ProductPage productPage = new ProductPage(this._scenarioContext);

            productPage.AddProduct(data.ProductCode, data.ProductDescription);
            productPage.btnSave.Click();
        }
示例#2
0
 internal void AddProductsToCart(int productNumber)
 {
     mainPage.Open();
     for (int i = 1; i <= productNumber; i++)
     {
         mainPage.Open();
         productPage.Open(i);
         productPage.SelectManufacture("Small");
         productPage.AddProduct(i);
     }
 }
        public void Should_Add_Product_And_Get_Order_Page()
        {
            var homePage = loginPage.LoginApplication("*****@*****.**", "automation");

            productPage = homePage.loggedInMenuItemControl.SelectProductAndNavigateToProductPage(NewPhone);
            TotalAmount = productPage.AddProduct();
            var expectedResult = new AlertsType().ProductAddedSuccessfully;
            var actualResult   = productPage.GetAlert();

            Assert.AreEqual(expectedResult, actualResult);

            cartPage = homePage.loggedInMenuItemControl.NavigateToCart();
            Assert.IsTrue(cartPage.IsProductAddedToCart(NewPhone.ProductName));

            orderPage = cartPage.PlaceOrder();
            Assert.IsTrue(orderPage.IsWindowOpened());
        }
        public void Should_Delete_Product()
        {
            int TotalAmount = 0;
            var homePage    = loginPage.LoginApplication("*****@*****.**", "automation");

            productPage = homePage.loggedInMenuItemControl.SelectProductAndNavigateToProductPage(NewMonitor);
            TotalAmount = productPage.AddProduct();
            var expectedResult = new AlertsType().ProductAddedSuccessfully;
            var actualResult   = productPage.GetAlert();

            Assert.AreEqual(expectedResult, actualResult);


            cartPage = homePage.loggedInMenuItemControl.NavigateToCart();
            Assert.IsTrue(cartPage.IsProductAddedToCart(NewNotebook.ProductName));

            cartPage.DeleteProduct();
            Assert.IsTrue(cartPage.IsProductRemovedFromCart(NewNotebook.ProductName));
            Assert.IsFalse(cartPage.IsTotalorderVisible());
        }
        public void DidNotFillRequiredFieldOfOrderPage()
        {
            var homePage = loginPage.LoginApplication("*****@*****.**", "automation");

            productPage = homePage.loggedInMenuItemControl.SelectProductAndNavigateToProductPage(NewPhone);
            TotalAmount = productPage.AddProduct();
            var expectedResult = "Product added.";
            var actualResult   = productPage.GetAlert();

            Assert.AreEqual(expectedResult, actualResult);

            cartPage = homePage.loggedInMenuItemControl.NavigateToCart();
            Assert.AreEqual(expectedResult, actualResult);

            orderPage = cartPage.PlaceOrder();
            orderPage.submitOrderPage();
            var expectedResult2 = new AlertsType().EnterRequiredFields;
            var actualResult2   = orderPage.GetAlert();

            Assert.AreEqual(expectedResult2, actualResult2);
        }
        public void Should_Add_Products_To_Cart_Successfully()
        {
            var homePage = loginPage.LoginApplication("*****@*****.**", "automation");

            var productList = GenerateProductList(NewNotebook, NewPhone);


            foreach (var product in productList)
            {
                productPage  = homePage.loggedInMenuItemControl.SelectProductAndNavigateToProductPage(product);
                TotalAmount += productPage.AddProduct();
                var expectedResult = new AlertsType().ProductAddedSuccessfully;

                var actualResult = productPage.GetAlert();
                Assert.AreEqual(expectedResult, actualResult);

                cartPage = homePage.loggedInMenuItemControl.NavigateToCart();
                Assert.IsTrue(cartPage.IsProductAddedToCart(product.ProductName));
                //verificare daca suma totala corespunde
                Assert.AreEqual(TotalAmount, cartPage.GetTotalPrice);

                homePage.loggedInMenuItemControl.NavigateToHomePage();
            }
        }