/// <summary> /// Performs once before all other tests. Buys a group multi-draw ticket /// </summary> // [TestFixtureSetUp] public void Buy_Group_Multi_Draw_Ticket(WayToPay merchant) { // Log in if (merchant != WayToPay.InternalBalance) { _commonActions.Log_In_Front_PageOne(_driverCover.Login, _driverCover.Password); } else { //If pay with internal balance we need to log in with different user _commonActions.Log_In_Front_PageOne(_driverCover.LoginTwo, _driverCover.Password); } _driverCover.NavigateToUrl(_driverCover.BaseUrl + "en/play/eurojackpot/"); //Pay for tickets GroupGamePageObj groupGame = new GroupGamePageObj(_driver); _totalPrice = groupGame.TotalPrice; _drawsToPlay = groupGame.NumberOfDraws; MerchantsObj merchants = groupGame.ClickBuyTicketsButton(); if (merchant != WayToPay.InternalBalance) { merchants.Pay(merchant); } else { CheckoutObj checkout = new CheckoutObj(_driver); checkout.ClickCompleteYourOrderButton(); } }
/// <summary> /// Performs once before all other tests. Buys a raffle ticket /// </summary> private void Buy_Raffle_Ticket(WayToPay merchant) { // Log in if (merchant != WayToPay.InternalBalance) { _commonActions.Log_In_Front_PageOne(_driverCover.Login, _driverCover.Password); } else { //If pay with internal balance we need to log in with different user _commonActions.Log_In_Front_PageOne(_driverCover.LoginTwo, _driverCover.Password); } _driverCover.NavigateToUrl(_driverCover.BaseUrl + "en/raffles/loteria-de-navidad/"); RafflesPageObj rafflePage = new RafflesPageObj(_driver); _totalPrice = rafflePage.TotalPrice; rafflePage.ClickBuyNowButton();// MerchantsObj merchants = new MerchantsObj(_driver); if (merchant != WayToPay.InternalBalance) { merchants.Pay(merchant); } else { CheckoutObj checkout = new CheckoutObj(_driver); checkout.ClickCompleteYourOrderButton(); } }
/// <summary> /// Performs once before all other tests. Buys a group single ticket /// </summary> //[TestFixtureSetUp] public void Buy_Group_One_Draw_Ticket(WayToPay merchant) { // Log in if (merchant != WayToPay.InternalBalance) { _commonActions.Log_In_Front_PageOne(_driverCover.Login, _driverCover.Password); } else { //If pay with internal balance we need to log in with different user _commonActions.Log_In_Front_PageOne(_driverCover.LoginTwo, _driverCover.Password); } _driverCover.NavigateToUrl(_driverCover.BaseUrl + "en/play/el-gordo-de-la-primitiva/"); //Pay for tickets GroupGamePageObj groupGame = new GroupGamePageObj(_driver); //Select single draw groupGame.SelectOneTimeEntryGame(); _totalPrice = groupGame.TotalPrice; MerchantsObj merchants = groupGame.ClickBuyTicketsButton(); if (merchant != WayToPay.InternalBalance) { merchants.Pay(merchant); } else { CheckoutObj checkout = new CheckoutObj(_driver); checkout.ClickCompleteYourOrderButton(); } }
public void Check_Discount_Checkout(string code, double discount) { SetUp(CreateOptions(_device)); // sign up _commonActions.Sign_Up_Mobile(); _commonActions.AddGroupTicketToCart_Front("en/play/euromiliony/"); _commonActions.AddRegularTicketToCart_Front("en/play/el-gordo-de-la-primitiva/"); _commonActions.AddRaffleTicketToCart_Front(_driverCover.BaseUrl + "en/raffles/loteria-de-navidad/"); _driverCover.NavigateToUrl(_driverCover.BaseUrl + "en/carts"); CartObj cart = new CartMobileObj(_driver); cart.ClickProceedToCheckoutButton(); CheckoutObj checkout = new CheckoutObj(_driver); checkout.ApplyCoupon(code); double subTotalPrice = checkout.SubTotalPrice; double price = checkout.TotalPrice; double disc = checkout.DiscountMultiDraw; Assert.AreEqual(Math.Round(subTotalPrice - disc - (subTotalPrice - disc) / 100 * discount, 2), Math.Round(price, 2), "Sorry but the total price is not as expected. Maybe coupon gave a wrong discount. "); }
/// <summary> /// Being in the cart method proceeds to checkout and applies a coupon /// </summary> /// <param name="code"></param> public CheckoutObj ApplyCouponInCart_Web(string code) { CartObj cart = new CartSiteObj(_driver); cart.ClickProceedToCheckoutButton(); CheckoutObj checkout = new CheckoutObj(_driver); checkout.ApplyCoupon(code); return checkout; }