//[TestMethod] public void CheckCartOnlinePriceTag() { string expectedTagName = "Online price"; IndexHomePage indexHomePage = new IndexHomePage(Driver, Url); var manufacturers = indexHomePage.TopHeader.GetManufacturerMenuOptionsText(); string secondManufacturer = manufacturers.ElementAt(1); indexHomePage.TopHeader.SetManufacturerDropdown(secondManufacturer); ProductListPage productListPage = indexHomePage.TopHeader.ClickOnSubmit(); var firstItem = productListPage.GetResultItems().FirstOrDefault(); firstItem.ClickOnAddToCart(); //productListPage.IsAppBusy(); //Go back to index page indexHomePage = productListPage.TopHeader.ClickOnLogo(); CartPage cartPage = indexHomePage.UtilityMenu.ClickOnCart(); cartPage.WaitUntilItemsAreDisplayed(); var cartItems = cartPage.GetProductItems(); foreach (var item in cartItems) { //check each item for tag value Assert.AreEqual(expectedTagName, item.GetItemDetail(ProductItemDetailsEnum.PriceTag)); } }
//[TestMethod] public void CheckPriceTagOnCheckoutPage() { string expectedPriceTag = "Online price"; IndexHomePage indexPage = new IndexHomePage(Driver, Url); string firstManufacturer = indexPage.TopHeader.GetManufacturerMenuOptionsText().ElementAtOrDefault(1); indexPage.TopHeader.SetManufacturerDropdown(firstManufacturer); ProductListPage productsListPage = indexPage.TopHeader.ClickOnSubmit(); var firstProductItem = productsListPage.GetResultItems().FirstOrDefault(); firstProductItem.ClickOnAddToCart(); productsListPage.WaitForAppBusy(); indexPage = productsListPage.TopHeader.ClickOnLogo(); CartPage cartPage = indexPage.UtilityMenu.ClickOnCart(); cartPage.WaitUntilItemsAreDisplayed(); SignInRegisterPage signInPage = cartPage.ClickOnProceedToCheckoutButtonAnonymous(); CheckoutPage checkoutPage = signInPage.ClickOnCheckoutAsGuest(); checkoutPage.WaitUntilItemsAreDisplayed(); var productItems = checkoutPage.GetProductItems(); foreach (var product in productItems) { System.Console.WriteLine(product.GetItemDetail(ProductItemDetailsEnum.PriceTag)); Assert.AreEqual(expectedPriceTag, product.GetItemDetail(ProductItemDetailsEnum.PriceTag)); } }
//[TestMethod] public void CheckProductListOnlinePriceTag() { string expectedPriceTag = "Online price"; IndexHomePage indexHomePage = new IndexHomePage(Driver, Url); var manufacturers = indexHomePage.TopHeader.GetManufacturerMenuOptionsText(); string manufacturer = manufacturers.ElementAt(1); indexHomePage.TopHeader.SetManufacturer(manufacturer); ProductListPage productListPage = indexHomePage.TopHeader.ClickOnSubmit(); var productItems = productListPage.GetResultItems(); var incorrectPriceTag = productItems.FirstOrDefault(p => p.GetItemDetail(ProductItemDetailsEnum.PriceTag) != expectedPriceTag); Assert.IsNull(incorrectPriceTag, $"Theres an invalid Price tag on {manufacturer}"); }
//[TestMethod] public void CheckProductDetailOnlinePriceTag() { string expectedPriceTag = "Online price"; IndexHomePage indexPage = new IndexHomePage(Driver, Url); var manufacturers = indexPage.TopHeader.GetManufacturerMenuOptionsText(); //Get the second manufacturer string manufacturer = manufacturers.ElementAtOrDefault(1); indexPage.TopHeader.SetManufacturer(manufacturer); ProductListPage productListPage = indexPage.TopHeader.ClickOnSubmit(); var productItem = productListPage.GetResultItems().FirstOrDefault(); ProductDetailPage productDetailPage = productItem.Click(); string actualPriceTag = productDetailPage.GetProductSection(ProductDetailSections.PriceTag); Assert.AreEqual(expectedPriceTag, actualPriceTag); }