public void ProductPurchaseTest() { var loginPage = new LoginPage(Driver); var homePage = new HomePage(Driver); var productInformationPage = new ProductInformationPage(Driver); var searchResultsPage = new SearchResultsPage(Driver); var myCartPage = new MyCartPage(Driver); var checkoutPage = new CheckoutPage(Driver); loginPage.Login(this.TestData.ValidUser.ValidUsername.Value, this.TestData.ValidUser.ValidPassword.Value); myCartPage.Goto(); myCartPage.RemoveAllItems(); homePage.Search(this.TestData.ProductName.Value); searchResultsPage.ClickRandomProduct(); var productDetails = productInformationPage.ProductInformation(); productInformationPage.AddToCart(); myCartPage.PlaceOrder(); var productDetailsInCheckoutPage = checkoutPage.ProductInformation(); CollectionAssert.AreEqual(productDetails, productDetailsInCheckoutPage); checkoutPage.CompletePurchase(); Assert.AreEqual(checkoutPage.IsPurchaseCompleted(), "Purchase is failed"); }
public void AddProductToCartAndVerifyInfoTest() { var loginPage = new LoginPage(Driver); var homePage = new HomePage(Driver); var productInformationPage = new ProductInformationPage(Driver); var searchResultsPage = new SearchResultsPage(Driver); var myCartPage = new MyCartPage(Driver); loginPage.Login(this.TestData.ValidUser.ValidUsername.Value, this.TestData.ValidUser.ValidPassword.Value); myCartPage.RemoveAllItems(); homePage.Search(this.TestData.ProductName.Value); searchResultsPage.ClickRandomProduct(); var productDetails = productInformationPage.ProductInformation(); productInformationPage.AddToCart(); Assert.IsTrue(myCartPage.IsLoaded(), "Add to Cart functionality is broken"); var productDetailsInMyCartPage = myCartPage.ProductInformation(); CollectionAssert.AreEqual(productDetails, productDetailsInMyCartPage); }