public void Test() { HomePage homePage = new HomePage(driver); //Login to the site LoginPage loginPage = homePage.ClickSignIn(); ProductsPage productsPage = loginPage.SignIn("*****@*****.**", "Password"); Console.WriteLine("Logged in to the site"); //From the Main menu select Dresses > Summer Dresses productsPage.SelectSummerDresses(); Console.WriteLine("Selected Dresses > Summer Dresses"); //Quick View a Dress //Selecting 2 random summer dress's index - one to quick view and add to cart and second one to add to the cart directly int numberOfSummerDresses = productsPage.getNumberOfSummerDresses(); Random rand = new Random(); int randomIndex1 = rand.Next(0, numberOfSummerDresses); int randomIndex2 = rand.Next(0, numberOfSummerDresses); while (randomIndex2 == randomIndex1) { randomIndex2 = rand.Next(0, numberOfSummerDresses); } //Quick viewing a summer dress QuickViewPage quickViewPage = productsPage.QuickViewRandomSummerDress(randomIndex1); Console.WriteLine("Opened dress in Quick view and noted down its details to check them in the summary page"); //Noting down the dress details to assert them in the summary page String expectedModel = quickViewPage.GetDressModel(); String expectedColor = quickViewPage.GetDressColor(); String expectedSize = quickViewPage.GetDressSize(); String expectedPrice = quickViewPage.GetDressPrice(); //Add the dress to cart from quick view productsPage = quickViewPage.ClickAddToCart(); Console.WriteLine("Added first dress to the cart from quick view"); // Continue shopping to add another dress to cart productsPage.ClickContinueShopping(); //Add Another Dress to the Cart productsPage.AddRandomDressToCart(randomIndex2); Console.WriteLine("Added another dress to the cart without quick view"); //Proceed to Checkout SummaryPage summaryPage = productsPage.ClickProceedToCheckout(); //Verify on Summary page correct dress is selected AssertSelectedDressInSummaryPageTable(summaryPage.SummaryTable, expectedModel, expectedColor, expectedSize, expectedPrice); //Delete the second dress that was added to the cart summaryPage.DeleteItemFromSummaryPage(1); //Sign out summaryPage.SignOut(); Console.WriteLine("Signed Out"); }
public void OrderingItems() { //Landing Home Page for Automation Practice HomePage pgHome = new HomePage(); //Click on Quick view on Home Page for first item returns the QuickView Page QuickViewPage pgQuickView = pgHome.quickViewProduct("Faded Short Sleeve T-shirts"); pgQuickView.selectSize("M"); //Selecting size as M on QuickView Page //Clicking on Add to Basket returns the Checkout Page CheckoutPage pgCheckout = pgQuickView.clickAddtoCart(); PropertiesCollection.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(16); //wait for the checkout window to appear string item1ProdPrice = pgCheckout.GetProdPrice(); //returning price of first product string item1ShipPrice = pgCheckout.GetProdShipPrice(); //returning shipping price of first product string item1TotalPrice = pgCheckout.GetProdCartTotal(); //returning total price of first product //Clicking on Continue Shopping returns to HomePPage pgHome = pgCheckout.clickContinueShopping(); //Click on Quick view on Home Page for second item returns the QuickView Page pgQuickView = pgHome.quickViewProduct("Blouse"); pgQuickView.selectSize("S"); //Selecting default on QuickView Page //Clicking on Add to Basket returns the Checkout Page pgCheckout = pgQuickView.clickAddtoCart(); string item2ProdPrice = pgCheckout.GetProdPrice(); //returning price of second product string item2ShipPrice = pgCheckout.GetProdShipPrice(); //returning shipping price of second product string item2TotalPrice = pgCheckout.GetProdCartTotal(); //returning total price of second product //Clicking on Proceed to checkout returns Order Summary Window OrderSummaryPage pgOrderSummary = pgCheckout.clickProceedtoCheckout(); string strItem1Size = pgOrderSummary.getItemSize("Faded Short Sleeve T-shirts"); //returning size of first item product Reporting.AssertTrue("M", strItem1Size, "OrderingItems", "Verify Size"); string strItem1Price = pgOrderSummary.getItemPrice("Faded Short Sleeve T-shirts"); //returning price of first product from order page Reporting.AssertTrue(item1ProdPrice, strItem1Price, "OrderingItems", "Verify first item price"); string strItem2Price = pgOrderSummary.getItemPrice("Blouse"); //returning price of second product from order page Reporting.AssertTrue(item2ProdPrice, strItem2Price, "OrderingItems", "Verify second item price"); string strTotalProductPrice = pgOrderSummary.getTotalProduct(); //returning price of both product from order page string strTotalShippingPrice = pgOrderSummary.getShipping(); //returning price of shipping for product from order page string strTotalAmount = pgOrderSummary.getTotalAmount(); //returning price of shipping and both product from order page //Clicking on Proceed to Checkout returns Sign In Window OrderSignInPage pgSignin = pgOrderSummary.clickProceedToCheckout(); //Signining in the applicatin return Address confirmation window OrderAddressPage pgAddress = pgSignin.SignIn(strEmailAddress, strPassword); //Clicking on Proceed to Checkout returns Shipping In Window OrderShippingPage pgShipping = pgAddress.clickProceedToCheckout(); //Clicking on Proceed to Checkout returns Payment Window OrderPaymentPage pgPayment = pgShipping.clickProceedtoCheckout(); //Select Payment Type as Wire returns confirmation Window OrderConfirmationPage pgConfirmation = pgPayment.clickBankWirePayment(); pgConfirmation.clickConfirmOrder(); //Confirming Paying }