Ejemplo n.º 1
0
        public void CompletePurchaseTest()
        {
            var homePageInstance = HomePage.NavigateTo(this.Driver);

            Thread.Sleep(3000);


            Assert.IsFalse(homePageInstance.IsCartVisible(), "Is cart visible");

            var albumList = homePageInstance.GetAlbums2();

            Assert.IsTrue(albumList.Count > 0);

            albumList.First().Click();

            Thread.Sleep(3000);

            var albumPageInstance = AlbumPage.NavigateTo(this.Driver);

            albumPageInstance.AddToCartButton.Click();


            Thread.Sleep(3000);

            Assert.IsTrue(homePageInstance.IsCartVisible(), "Is cart visible");


            var carPageInstance = CartPage.NavigateTo(this.Driver);

            Thread.Sleep(3000);

            carPageInstance.CheckOutButton.Click();

            Thread.Sleep(3000);

            var orderPageInstance = OrderPage.NavigateTo(this.Driver);

            orderPageInstance.FirstName.SendKeys("sdfdsf");

            orderPageInstance.LastName.SendKeys("sdfdsf");

            orderPageInstance.City.SendKeys("sdfdsf");
            orderPageInstance.Country.SendKeys("sdfdsf");
            orderPageInstance.Phone.SendKeys("sdfdsf");
            orderPageInstance.Address.SendKeys("sdfdsf");
            orderPageInstance.State.SendKeys("sdfdsf");

            orderPageInstance.PostalCode.SendKeys("sdfdsf");

            orderPageInstance.Email.SendKeys("*****@*****.**");

            orderPageInstance.PromoCode.SendKeys("FREE");


            orderPageInstance.ButtonSubmit.Click();

            Thread.Sleep(3000);

            Assert.IsTrue(this.Driver.Url.Contains("http://qaf2017demo1-001-site1.dtempurl.com/Checkout/Complete/"));

            Thread.Sleep(3000);
        }
Ejemplo n.º 2
0
 public void WhenIGoToTheShoppingCartPage()
 {
     Thread.Sleep(1000); //TODO: Get rid of this later when I figure out how to get WebDriver to wait for DOM changes/page loads
     _cartPage = CartPage.NavigateTo(_driver);
 }
Ejemplo n.º 3
0
 public void WhenNavigeerNaarDeWinkelwagenpagina()
 {
     _cartPage = Browser.GotoCart();
 }
Ejemplo n.º 4
0
 public PurchaseFirstVersionFacade(MainPage mainPage, CartPage cartPage, CheckoutPage checkoutPage)
 {
     _mainPage     = mainPage;
     _cartPage     = cartPage;
     _checkoutPage = checkoutPage;
 }
Ejemplo n.º 5
0
 public CartController(ScenarioContext scenarioContext) : base(scenarioContext)
 {
     _driver  = scenarioContext["DRIVER"] as IWebDriver;
     cartPage = new CartPage();
     wait     = scenarioContext["WAIT"] as WebDriverWait;
 }
 public void ThenIOpenTheCart()
 {
     _cartPage = _navBarPage.openCart();
 }
Ejemplo n.º 7
0
        public void E2E02()
        {
            IndexPage indexPage = new IndexPage(driver, url);

            Login(indexPage);

            //Click on a Top Level Category (e.g.Hardware & Supplies)
            CatalogItemsPage catalogItemsPage = indexPage.Header.ClickOnCategory("Hardware & Supplies");

            Assert.IsTrue(catalogItemsPage.CheckIfYourPriceIsDisplayed(), "Your price is not diplayed");

            //Product list views
            catalogItemsPage.AddToCartElementByIndex(0);
            catalogItemsPage.ClickOnListViewIcon();
            catalogItemsPage.AddToCartElementByIndex(2);
            Assert.IsTrue(catalogItemsPage.ListViewDisplayed(), "The product view was not updated to List view(stack view).");

            //Page Navigation
            catalogItemsPage = catalogItemsPage.ClickOnNextPage();
            Assert.AreEqual("2", catalogItemsPage.GetActualPageListNumber(), "The page list number must be '2'.");
            catalogItemsPage.AddToCartElementByIndex(0);
            catalogItemsPage = catalogItemsPage.ClickOnLastPage();
            Assert.AreEqual(catalogItemsPage.GetLastPageListNumber(), catalogItemsPage.GetActualPageListNumber(), "Last page must be diplayed.");
            catalogItemsPage.AddToCartElementByIndex(0);

            //Category Navigation
            catalogItemsPage = catalogItemsPage.ClickOnSubCategory("Buzzers");
            catalogItemsPage.AddToCartFirstItemInCatalog();

            //Cart & Save for Later
            CartPage cartPage = catalogItemsPage.Header.ClickOnViewCart();

            Assert.AreEqual(5, cartPage.GetNumberOfItemsInCart(), "Must be 5 items in cart");
            Assert.IsTrue(cartPage.TotalAmountIsCorrect(), "The total amount doesn't reflect the sum of the items total.");
            cartPage.SelectAllItems();
            Assert.AreEqual(cartPage.GetNumberOfItemsInCart(), cartPage.GetNumberOfSelectedItems(), "Not all items were selected.");
            cartPage.MoveSelectedToSaveLater();
            Assert.AreEqual(0, cartPage.GetNumberOfItemsInCart(), "All items must be moved to 'Save for later' tab");
            cartPage.ClickOnSavedForLater();
            cartPage.SelectItemsByIndex(0);
            cartPage.SelectItemsByIndex(1);
            cartPage.SelectItemsByIndex(2);
            cartPage.MoveSelectedToCart();
            cartPage.ClickIndividualMoveToCartByIndex(1);
            cartPage.ClickOnCartTab();
            Assert.AreEqual(4, cartPage.GetNumberOfItemsInCart(), "Number of items in cart must be 4.");
            Assert.IsTrue(cartPage.InventoryAvailabilityIsDisplayed(), "Inventory availability must be displayed.");
            cartPage.SelectItemsByIndex(0);
            cartPage.SelectItemsByIndex(1);
            cartPage.ClickRemoveSelectedItems();
            cartPage.RemoveIndividualItemByIndex(0);
            Assert.AreEqual(1, cartPage.GetNumberOfItemsInCart(), "Number of items in cart must be 1.");

            //Checkout and continue shopping
            CheckoutPage checkoutPage = cartPage.ProceedToCheckOut();

            checkoutPage.UserInfoIsPopulated();
            AddressModel addressModel = GetAddressModel();

            checkoutPage.SetAddressElement(AddressInputs.StreetAddress, addressModel.street);
            checkoutPage.SetAddressElement(AddressInputs.City, addressModel.city);
            checkoutPage.SetAddressElement(AddressInputs.State, addressModel.state);
            checkoutPage.SetAddressElement(AddressInputs.Postal, addressModel.postal);
            checkoutPage.SetAddressElement(AddressInputs.ATTN, "Tundra Restaurant Supply");
            checkoutPage.NextStep();
            OrderConfirmationPage orderConfirmationPage = checkoutPage.PlaceOrderSubmitClick();

            orderConfirmationPage.ClickOnContinueShoppingButton(ContinueShoppingButtons.ContinueShopping);
        }
Ejemplo n.º 8
0
        public void AddAddressChecktoutoMyAccount()
        {
            var indexPage = new IndexPage(driver, url);

            var testData = new
            {
                user         = dataFactory.CreateLoginAccount(),
                country      = (string)testContext.DataRow["Country"],
                countryShort = (string)testContext.DataRow["CountryShort"],
                address      = (string)testContext.DataRow["StreetAddress"],
                state        = (string)testContext.DataRow["State"],
                city         = (string)testContext.DataRow["City"],
                zipCode      = testContext.DataRow["ZipCode"].ToString(),
                apt          = testContext.DataRow["Apt"].ToString(),
                firstname    = (string)testContext.DataRow["FirstName"],
                lastname     = (string)testContext.DataRow["LastName"],
                company      = (string)testContext.DataRow["Company"],
                phonenumber  = testContext.DataRow["PhoneNumber"].ToString(),
                attn         = testContext.DataRow["ATTN"].ToString(),
            };

            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(testData.user.Email, testData.user.Password);

            var manufacturesItems = indexPage.Header.GetManufacturerOptions();

            manufacturerOption = manufacturesItems.ElementAtOrDefault(2).webElement.Text;

            indexPage.Header.SelectManufacturer(manufacturerOption);

            CatalogItemsPage catalogItemPage = indexPage.Header.ClickOnSearchButton();

            catalogItemPage.AddtoCartbuttonInCatalog();

            Thread.Sleep(5000);

            CartPage CartMainPage = catalogItemPage.Header.ClickOnViewCart();

            //Waiting For Loading Cart
            Thread.Sleep(7000);

            //Click no Proceed to checkout button
            CheckoutPage checkoutPage = CartMainPage.ProceedToCheckOut();

            Thread.Sleep(5000);

            //checkoutPage.SelectAddressRadioButton(AddressSelectOptions.New);

            Thread.Sleep(5000);

            checkoutPage.SetAddressElement(AddressInputs.ATTN, testData.attn);

            checkoutPage.SetAddressElement(AddressInputs.StreetAddress, testData.address);

            checkoutPage.SetAddressElement(AddressInputs.Apt, testData.apt);

            checkoutPage.SetAddressElement(AddressInputs.City, testData.city);

            checkoutPage.SetAddressElement(AddressInputs.State, testData.state);

            checkoutPage.SetAddressElement(AddressInputs.Postal, testData.zipCode);

            checkoutPage.ClickShippingButton();

            Thread.Sleep(5000);

            //checkoutPage.SelectBillingRadioButton(BillingSelectOptions.Existing);
            PaymentOptionModel cardToken = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077"
            };

            checkoutPage.SetBillingElement(BillingInputs.CardHolderName, cardToken.HolderName);
            checkoutPage.SetBillingElement(BillingInputs.CardNumber, cardToken.CardNumber);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationMonth, cardToken.ExpirationMont);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationYear, cardToken.ExpirationYear);
            checkoutPage.SetBillingElement(BillingInputs.CVV, cardToken.Cvv);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInBillingDropDown();

            Assert.IsTrue(checkoutPage.BillingButtonIsEnable(), "Proceed to Review and Place Your Order button is not available");

            Thread.Sleep(5000);

            checkoutPage.BillingSubmitClick();

            Assert.IsTrue(checkoutPage.PlaceOrderButtonIsEnable(), "Place Your Order button is not available");

            Thread.Sleep(5000);

            //checkoutPage.PlaceOrderSubmitClick();
            OrderConfirmationPage orderpage = checkoutPage.PlaceOrderSubmitClick();

            Assert.IsTrue(checkoutPage.OrderConfirmationText(), "Order Confirmation text is not available");

            //CheckoutPage checkoutPage = CartMainPage.ProceedToCheckOut();

            indexPage = orderpage.ContinueShoppingClick();

            //AddressesHomePage addresspage = indexPage.Header.ClickOnAddresses();

            //var dropdownItems = addresspage.GetAddressesDropdownItems(AccessLevel.User).ToList();

            ////just created address data
            //string createdAddress = string.IsNullOrEmpty(testData.apt) ?
            //    $"{testData.address}, {testData.city} {testData.countryShort} {testData.zipCode}"
            //    :
            //    $"{testData.address}, {testData.apt}, {testData.city} {testData.countryShort} {testData.zipCode}";

            ////search the address in the user level dropdown
            //string expectedAddress = dropdownItems.FirstOrDefault(x => x.Contains(createdAddress));

            //Assert.IsNotNull(expectedAddress, "Address is not found in dropdown");
        }
Ejemplo n.º 9
0
        public void E2E03()
        {
            //Content
            IndexPage indexPage = new IndexPage(driver, url);

            Login(indexPage);

            //Shopping lists
            OfferingProductsPage offeringProductsPage = indexPage.ClickOnProductSpotlightDealsByIndex(0);

            offeringProductsPage.ClickOnAddToList();
            Assert.AreEqual(1, offeringProductsPage.AddListModal.GetOptionsFromChooseListModal().Count,
                            "There must be just 1 option.");
            Assert.AreEqual("My List", offeringProductsPage.AddListModal.GetOptionsFromChooseListModal()[0].webElement.Text,
                            "The option must be 'My List'");
            offeringProductsPage.AddListModal.CloseAddToListModal();
            offeringProductsPage.ClickOnAddToList();
            offeringProductsPage.AddListModal.ClickOnAddToListModal();
            offeringProductsPage.AddListModal.IsSuccessMessageInModal();
            offeringProductsPage.AddListModal.CloseAddToListModal();

            //Shopping lists
            offeringProductsPage.ChangeQuantity(2);
            offeringProductsPage.UpdateAmountQuantity();
            int amountQuantityBeforeAdd = offeringProductsPage.GetAmountQuantity();

            offeringProductsPage.AddToCartFirstProduct();
            offeringProductsPage.UpdateAmountQuantity();
            int amountQuantityAfterAdd = offeringProductsPage.GetAmountQuantity();

            Assert.IsTrue(offeringProductsPage.AumontQuantityIncremented(amountQuantityBeforeAdd, amountQuantityAfterAdd),
                          "Quantity did not increment.");
            offeringProductsPage.ScrollToTop();
            offeringProductsPage.WaitForAppBusy(3);
            offeringProductsPage.Header.SetSearchFieldText("Amana");
            CatalogItemsPage catalogItemsPage = offeringProductsPage.Header.ClickOnSearchButton();

            catalogItemsPage.AddToListByIndex(0);
            catalogItemsPage.AddToListByIndex(1);
            catalogItemsPage.AddToListByIndex(2);
            ListSummaryPage listSummaryPage = catalogItemsPage.AddToListByIndex(3, visitList: true);

            Assert.AreEqual(5, listSummaryPage.NumberOfItemsInList(), "Quantity must be 5.");
            listSummaryPage.SelectByIndex(0);
            listSummaryPage.SelectByIndex(1);
            listSummaryPage.ClickOnRemoveSelected();
            Assert.AreEqual(3, listSummaryPage.NumberOfItemsInList(), "Quantity must be 3.");
            listSummaryPage.RemoveIndividualByIndex(0);
            Assert.AreEqual(2, listSummaryPage.NumberOfItemsInList(), "Quantity must be 2.");
            // if different in cart is true, it clicks on a different index
            listSummaryPage.ClickOnAddToCartByIndex(1, differentInCart: true);
            //*******************
            ListHomePage listHomePage = listSummaryPage.ClickOnBreadCrumbLists();

            listHomePage.ClickCreateaNewList();
            listHomePage.SendListName("new list");
            listHomePage.ClickCreateListButton();
            Assert.IsTrue(listHomePage.SuccessListCreated(), "List was not created");
            listHomePage.CloseModal();
            catalogItemsPage = listHomePage.Header.ClickOnCategory("Hardware & Supplies");
            listSummaryPage  = catalogItemsPage.AddToListByIndex(0, visitList: true, list: "new list");
            Assert.AreEqual(1, listSummaryPage.NumberOfItemsInList(), "There must be 1 item.");
            listHomePage = listSummaryPage.ClickOnBreadCrumbLists();
            Assert.AreEqual(2, listHomePage.GetNumberOfLists());

            //Create new payment method at checkout
            CartPage cartPage = listHomePage.Header.ClickOnViewCart();

            Assert.AreEqual(2, cartPage.GetNumberOfItemsInCart());
            cartPage.GetQuantityInput();
            Assert.IsTrue(cartPage.IsQuantityInCartItem(2), "One of the quantity items must be 1.");
            CheckoutPage checkoutPage = cartPage.ProceedToCheckOut();

            checkoutPage.UserInfoIsPopulated();
            AddressModel addressModel = GetAddressModel();

            checkoutPage.SetAddressElement(AddressInputs.StreetAddress, addressModel.street);
            checkoutPage.SetAddressElement(AddressInputs.City, addressModel.city);
            checkoutPage.SetAddressElement(AddressInputs.State, addressModel.state);
            checkoutPage.SetAddressElement(AddressInputs.Postal, addressModel.postal);
            checkoutPage.SetAddressElement(AddressInputs.ATTN, "Tundra Restaurant Supply");
            checkoutPage.NextStep();
            checkoutPage.ClickEditAction(EditActions.SecureBillingInformation);
            checkoutPage.ClickOnAssingNewCard();
            SetCreditCard(checkoutPage);
            checkoutPage.NextStep();
            OrderConfirmationPage orderConfirmationPage = checkoutPage.PlaceOrderSubmitClick();

            orderConfirmationPage.ClickOnContinueShoppingButton(ContinueShoppingButtons.ContinueShopping);
        }
Ejemplo n.º 10
0
        public void E2E01()
        {
            //Search & Price
            IndexPage indexPage = new IndexPage(driver, url);

            indexPage.Header.SetSearchFieldText("103-1035");
            CatalogItemsPage catalogItemsPage = indexPage.Header.ClickOnSearchButton();

            //Add product to the cart from the result page
            Assert.IsTrue(catalogItemsPage.IsListPriceDisplayed(), "There is no numeric price shown.");
            int quantityBeforeAdd = catalogItemsPage.Header.GetCartQuantity();

            catalogItemsPage.AddToCartElementByIndex(0);
            int quantityAfterAdd = catalogItemsPage.Header.GetCartQuantity();

            Assert.IsTrue(quantityAfterAdd > quantityBeforeAdd, "The item quantity did no increment");

            //Click on the product to go to the Product Detail Page
            OfferingProductsPage offeringProductsPage = catalogItemsPage.ClickOnFirstItemInCatalog();

            Assert.IsTrue(offeringProductsPage.ListPriceLabelforANON(), "List price tag not shown.");
            Assert.IsTrue(offeringProductsPage.NumericPriceDisplayed(), "No numeric price diplayed.");
            offeringProductsPage.UpdateAmountQuantity();
            int amountQuantityBeforeAdd = offeringProductsPage.GetAmountQuantity();

            //Add product to the cart from Product Detail Page and click on cart
            offeringProductsPage.AddToCartFirstProduct();
            offeringProductsPage.UpdateAmountQuantity();
            int amountQuantityAfterAdd = offeringProductsPage.GetAmountQuantity();

            Assert.IsTrue(offeringProductsPage.AumontQuantityIncremented(amountQuantityBeforeAdd, amountQuantityAfterAdd),
                          "Quantity did not incremented.");
            CartPage cartPage = offeringProductsPage.ClickOnCart();

            Assert.AreEqual(1, cartPage.NumberOfItemsInCart(), "Should be just one product in cart.");
            Assert.AreEqual(2, cartPage.GetQuantityInput(), "Quantity must be 2.");

            //Checkout
            cartPage.ProceedToCheckOut();
            CheckoutPage     checkoutPage     = cartPage.CheckoutAsGuest();
            ContactInfoModel contactInfoModel = new ContactInfoModel();

            contactInfoModel.FirstName   = "Jesus Carlos";
            contactInfoModel.LastName    = "Acosta Rocha";
            contactInfoModel.Email       = "*****@*****.**";
            contactInfoModel.Company     = "Softtek";
            contactInfoModel.PhoneNumber = "6681596072";
            checkoutPage.SetContactElement(ContactInputs.FirstName, contactInfoModel.FirstName);
            checkoutPage.SetContactElement(ContactInputs.LastName, contactInfoModel.LastName);
            checkoutPage.SetContactElement(ContactInputs.Email, contactInfoModel.Email);
            checkoutPage.SetContactElement(ContactInputs.Company, contactInfoModel.Company);
            checkoutPage.SetContactElement(ContactInputs.PhoneNumber, contactInfoModel.PhoneNumber);
            checkoutPage.NextStep();
            AddressModel addressModel = GetAddressModel();

            checkoutPage.SetAddressElement(AddressInputs.StreetAddress, addressModel.street);
            checkoutPage.SetAddressElement(AddressInputs.City, addressModel.city);
            checkoutPage.SetAddressElement(AddressInputs.State, addressModel.state);
            checkoutPage.SetAddressElement(AddressInputs.Postal, addressModel.postal);
            checkoutPage.NextStep();
            SetCreditCard(checkoutPage);
            checkoutPage.NextStep();

            //Confirmation page and continue shopping
            OrderConfirmationPage orderConfirmationPage = checkoutPage.PlaceOrderSubmitClick();

            orderConfirmationPage.ClickOnContinueShoppingButton(ContinueShoppingButtons.PrintOrderConfirmation);
            Assert.AreEqual(2, driver.WindowHandles.Count, "Printable Order Confirmation Not Shown.");
            driver.SwitchTo().DefaultContent();
            orderConfirmationPage.ClickOnContinueShoppingButton(ContinueShoppingButtons.ContinueShopping);
        }
Ejemplo n.º 11
0
 public CartPageViewModel(Cart cart, CartPage currentPage)
 {
     Cart = cart;
     CurrentPage = currentPage;
 }
Ejemplo n.º 12
0
 public void WhenUserClickGoToCheckout()
 {
     cartPage = basePage.GetCartPage();
     cartPage.ClickGoToCheckOutButton();
     cartPage.ClickContinueAsGuestButton();
 }
Ejemplo n.º 13
0
 public void ThenUserChecksItemVisibilityInCart()
 {
     cartPage = basePage.GetCartPage();
     cartPage.WaitForPageLoadComplete(DEFAULT_TIME);
     Assert.IsTrue(cartPage.ItemInCartVisibility());
 }
 public static CartAssertions Should(this CartPage instance) => new CartAssertions(instance);
 public CartAssertions(CartPage value) : base(value)
 {
 }
Ejemplo n.º 16
0
        public void OnlyContactInformationadded()
        {
            var indexPage = new IndexPage(driver, url);

            var testData = new
            {
                //Make sure to change name of email
                user = dataFactory.CreateLoginAccount(),
            };

            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(testData.user.Email, testData.user.Password);

            indexPage.Header.SelectManufacturer(manufacturerOption);

            indexPage.Header.SetSearchFieldText(searchField);

            CatalogItemsPage catalogItemPage = indexPage.Header.ClickOnSearchButton();

            catalogItemPage.AddtoCartbuttonInCatalog();

            Thread.Sleep(5000);

            CartPage CartMainPage = catalogItemPage.Header.ClickOnViewCart();

            //Waiting For Loading Cart
            Thread.Sleep(7000);

            //Click no Proceed to checkout button
            CheckoutPage checkoutPage = CartMainPage.ProceedToCheckOut();

            Thread.Sleep(5000);

            checkoutPage.SelectAddressRadioButton(AddressSelectOptions.Existing);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInAddressDropDown();

            checkoutPage.ClickShippingButton();

            Thread.Sleep(5000);

            PaymentOptionModel cardToken = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077"
            };

            checkoutPage.SetBillingElement(BillingInputs.CardHolderName, cardToken.HolderName);
            checkoutPage.SetBillingElement(BillingInputs.CardNumber, cardToken.CardNumber);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationMonth, cardToken.ExpirationMont);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationYear, cardToken.ExpirationYear);
            checkoutPage.SetBillingElement(BillingInputs.CVV, cardToken.Cvv);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInBillingDropDown();

            Assert.IsTrue(checkoutPage.BillingButtonIsEnable(), "Proceed to Review and Place Your Order button is not available");

            Thread.Sleep(5000);

            checkoutPage.BillingSubmitClick();

            Assert.IsTrue(checkoutPage.PlaceOrderButtonIsEnable(), "Place Your Order button is not available");

            Thread.Sleep(5000);

            OrderConfirmationPage orderpage = checkoutPage.PlaceOrderSubmitClick();

            Assert.IsTrue(checkoutPage.OrderConfirmationText(), "Order Confirmation text is not available");
        }
 public CartSteps(CartPage cartPage, ScenarioContext scenarioContext)
 {
     _cartPage        = cartPage;
     _scenarioContext = scenarioContext;
 }
Ejemplo n.º 18
0
        public void E2ETestwithContactInfoandAddressUser()
        {
            var indexPage = new IndexPage(driver, url);

            var testData = new
            {
                //Make sure to change name of email
                user         = dataFactory.CreateLoginAccount(),
                country      = (string)testContext.DataRow["Country"],
                countryShort = (string)testContext.DataRow["CountryShort"],
                address      = (string)testContext.DataRow["StreetAddress"],
                state        = (string)testContext.DataRow["State"],
                city         = (string)testContext.DataRow["City"],
                zipCode      = testContext.DataRow["ZipCode"].ToString(),
                apt          = testContext.DataRow["Apt"].ToString(),
                firstname    = (string)testContext.DataRow["FirstName"],
                lastname     = (string)testContext.DataRow["LastName"],
                company      = (string)testContext.DataRow["Company"],
                phonenumber  = testContext.DataRow["PhoneNumber"].ToString(),
                attn         = testContext.DataRow["ATTN"].ToString(),
            };

            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(testData.user.Email, testData.user.Password);

            var manufacturesItems = indexPage.Header.GetManufacturerOptions();

            manufacturerOption = manufacturesItems.ElementAtOrDefault(2).webElement.Text;

            indexPage.Header.SelectManufacturer(manufacturerOption);

            CatalogItemsPage catalogItemPage = indexPage.Header.ClickOnSearchButton();

            catalogItemPage.AddtoCartbuttonInCatalog();

            Thread.Sleep(5000);

            CartPage CartMainPage = catalogItemPage.Header.ClickOnViewCart();

            //Waiting For Loading Cart
            Thread.Sleep(7000);

            //Click no Proceed to checkout button
            CheckoutPage checkoutPage = CartMainPage.ProceedToCheckOut();

            Thread.Sleep(5000);

            checkoutPage.SelectAddressRadioButton(AddressSelectOptions.Existing);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInAddressDropDown();

            checkoutPage.ClickShippingButton();

            Thread.Sleep(5000);

            PaymentOptionModel cardToken = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077"
            };

            checkoutPage.SetBillingElement(BillingInputs.CardHolderName, cardToken.HolderName);
            checkoutPage.SetBillingElement(BillingInputs.CardNumber, cardToken.CardNumber);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationMonth, cardToken.ExpirationMont);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationYear, cardToken.ExpirationYear);
            checkoutPage.SetBillingElement(BillingInputs.CVV, cardToken.Cvv);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInBillingDropDown();

            Assert.IsTrue(checkoutPage.BillingButtonIsEnable(), "Proceed to Review and Place Your Order button is not available");

            Thread.Sleep(5000);

            checkoutPage.BillingSubmitClick();

            Assert.IsTrue(checkoutPage.PlaceOrderButtonIsEnable(), "Place Your Order button is not available");

            Thread.Sleep(5000);

            OrderConfirmationPage orderpage = checkoutPage.PlaceOrderSubmitClick();

            Assert.IsTrue(checkoutPage.OrderConfirmationText(), "Order Confirmation text is not available");
        }
Ejemplo n.º 19
0
        public void WhenINavigateToTheCartPage()
        {
            var cartPage = new CartPage(driver);

            cartPage.NavigateTo();
        }
Ejemplo n.º 20
0
        public void ThenTheCorrectPageShouldBeDisplayed()
        {
            var homePage = new HomePage(driver);
            var cartPage = new CartPage(driver);

            if (pageInTest == "Home")
            {
                Assert.Equal(HomePageUrl, driver.Url);

                //homePage.NavigateTo(); // Nu mai ai nevoie de inca o navigare catre homepage
            }
            else if (pageInTest == "Contact")
            {
                try
                {
                    driver.SwitchTo().ActiveElement();
                }
                catch (NoAlertPresentException exception)
                {
                    output.WriteLine("Popup is not present: " + exception);
                }

                //homePage.NavigateTo();
            }
            else if (pageInTest == "About us")
            {
                try
                {
                    driver.SwitchTo().ActiveElement();
                }
                catch (NoAlertPresentException exception)
                {
                    output.WriteLine("Popup is not present: " + exception);
                }

                //homePage.NavigateTo();
            }
            else if (pageInTest == "Cart")
            {
                cartPage.EnsurePageLoaded();

                homePage.NavigateTo();
            }
            else if (pageInTest == "Log in")
            {
                try
                {
                    driver.SwitchTo().ActiveElement();
                }
                catch (NoAlertPresentException exception)
                {
                    output.WriteLine("Popup is not present: " + exception);
                }

                // homePage.NavigateTo();
            }
            else if (pageInTest == "Sign up")
            {
                try
                {
                    driver.SwitchTo().ActiveElement();
                }
                catch (NoAlertPresentException exception)
                {
                    output.WriteLine("Popup is not present: " + exception);
                }

                homePage.NavigateTo();
            }
        }
Ejemplo n.º 21
0
        public void ThenTheCartPageShouldBeDisplayed()
        {
            var cartPage = new CartPage(driver);

            cartPage.EnsurePageLoaded();
        }
Ejemplo n.º 22
0
        public void WhenIPressCheckout()
        {
            var cartPage = new CartPage(driver);

            cartPage.pressCheckout();
        }
Ejemplo n.º 23
0
        public void ValidateAllElementsInConfirmationPage()
        {
            IndexPage indexPage = new IndexPage(driver, url);

            var user = dataFactory.CreateLoginAccount();

            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(user.Email, user.Password);

            var manufacturesItems = indexPage.Header.GetManufacturerOptions();

            manufacturerOption = manufacturesItems.ElementAtOrDefault(2).webElement.Text;

            indexPage.Header.SelectManufacturer(manufacturerOption);

            CatalogItemsPage catalogItemPage = indexPage.Header.ClickOnSearchButton();

            catalogItemPage.AddtoCartbuttonInCatalog();

            Thread.Sleep(5000);

            CartPage CartMainPage = catalogItemPage.Header.ClickOnViewCart();

            //Waiting For Loading Cart
            Thread.Sleep(7000);

            //Click no Proceed to checkout button
            CheckoutPage checkoutPage = CartMainPage.ProceedToCheckOut();

            Thread.Sleep(5000);

            checkoutPage.SelectAddressRadioButton(AddressSelectOptions.Existing);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInAddressDropDown();

            checkoutPage.ClickShippingButton();

            Thread.Sleep(5000);

            PaymentOptionModel cardToken = new PaymentOptionModel
            {
                CardNumber     = "4596502148863902",
                ExpirationMont = "03",
                ExpirationYear = "20",
                HolderName     = "Dixie Green",
                Cvv            = "775"
            };

            checkoutPage.SetBillingElement(BillingInputs.CardHolderName, cardToken.HolderName);
            checkoutPage.SetBillingElement(BillingInputs.CardNumber, cardToken.CardNumber);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationMonth, cardToken.ExpirationMont);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationYear, cardToken.ExpirationYear);
            checkoutPage.SetBillingElement(BillingInputs.CVV, cardToken.Cvv);

            Thread.Sleep(5000);

            checkoutPage.SelectFirstInBillingDropDown();

            Assert.IsTrue(checkoutPage.BillingButtonIsEnable(), "Proceed to Review and Place Your Order button is not available");

            Thread.Sleep(5000);

            checkoutPage.BillingSubmitClick();

            Assert.IsTrue(checkoutPage.PlaceOrderButtonIsEnable(), "Place Your Order button is not available");

            Thread.Sleep(5000);

            OrderConfirmationPage orderpage = checkoutPage.PlaceOrderSubmitClick();

            Assert.IsTrue(checkoutPage.OrderConfirmationText(), "Order Confirmation text is not available");

            Assert.IsTrue(orderpage.SuccessMsgIsPresent(), "Success Alert Message is not Displayed");

            Assert.IsTrue(orderpage.CustomerInfoIsDisplayed(), "Customer Information is not displayed");

            Assert.IsTrue(orderpage.ShippingInfoIsDisplayed(), "Shipping Information is not displayed");

            Assert.IsTrue(orderpage.BillingInfoIsDisplayed(), "Billing Information is not displayed");

            Assert.IsTrue(orderpage.listOfItemsDisplayed(), "List Item View is not Displaying Items");
        }
 public CartController(ScenarioContext scenarioContext) : base(scenarioContext)
 {
     _driver              = scenarioContext["WEB_DRIVER"] as IWebDriver;
     cartpage             = new CartPage();
     this.scenarioContext = scenarioContext;
 }
Ejemplo n.º 25
0
 public CartPageSteps(IWebDriver driver)
 {
     CartPage  = new CartPage(driver);
     CartTable = new CartTable(driver);
 }
Ejemplo n.º 26
0
        public ActionResult AddToCart(ShirtVariation currentContent, decimal Quantity, string Monogram)
        {
            // LoadOrCreateCart - in EPiServer.Commerce.Order.IOrderRepositoryExtensions
            var cart = _orderRepository.LoadOrCreateCart <ICart>(
                PrincipalInfo.CurrentPrincipal.GetContactId(), "Default");

            //cart.  // ...have a look at all the extension methods

            string code = currentContent.Code;

            // Manually checking - could have a look at the InventoryRecord - properties
            // ...could be part of an optional lab in Fund
            IWarehouse      wh  = _whRep.GetDefaultWarehouse();
            InventoryRecord rec = _invService.Get(code, wh.Code);


            // ... can get: Sequence contains more than one matching element...
            // ...when we have two different lineitems for the same SKU
            // Use when the cart is empty/one LI for SKU with Qty --> no crash
            var lineItem = cart.GetAllLineItems().SingleOrDefault(x => x.Code == code);

            //currentContent.IsAvailableInCurrentMarket();

            // Below works for the same SKU on different LineItems... Changing back for the Fund
            //var lineItem = cart.GetAllLineItems().First(x => x.Code == code); // Changed to this for multiple LI with the same code - crash if no cart

            // ECF 12 changes - market.MarketId
            IMarket market = _currentMarket.GetCurrentMarket();

            if (lineItem == null)
            {
                lineItem          = _orderFactory.CreateLineItem(code, cart);
                lineItem.Quantity = Quantity; // gets this as an argument for the method

                // ECF 12 changes - market.MarketId
                _placedPriceProcessor.UpdatePlacedPrice
                    (lineItem, GetContact(), market.MarketId, cart.Currency,
                    (lineItemToValidate, validation) => { }); // does not take care of the messages here

                cart.AddLineItem(lineItem);
            }
            else
            {
                // Qty increases ... no new LineItem ...
                // original for Fund.
                lineItem.Quantity += Quantity; // need an update
                // maybe do price validation here too
            }

            // Validations
            var validationIssues = new Dictionary <ILineItem, ValidationIssue>();

            // ECF 12 changes - market.MarketId
            // RoCe - This needs to be updated to get the message out + Lab-steps added...
            var validLineItem = _lineItemValidator.Validate(lineItem, market.MarketId, (item, issue) => { });

            cart.ValidateOrRemoveLineItems((item, issue) => validationIssues.Add(item, issue), _lineItemValidator);
            //var someIssue = validationIssues.First().Value;

            if (validLineItem) // We're happy
            {
                // If MDP - error when adding, may need to reset IIS as the model has changed
                //    when adding/removing the MetaField in CM
                lineItem.Properties["Monogram"] = Monogram;

                _orderRepository.Save(cart);
            }

            ContentReference cartRef     = _contentLoader.Get <StartPage>(ContentReference.StartPage).Settings.CartPage;
            ContentReference cartPageRef = EPiServer.Web.SiteDefinition.Current.StartPage;
            CartPage         cartPage    = _contentLoader.Get <CartPage>(cartRef);
            var name = cartPage.Name;
            var lang = ContentLanguage.PreferredCulture;

            string passingValue = cart.Name; // if something is needed

            //return RedirectToAction("Index", new { node = theRef, passedAlong = passingValue }); // Doesn't work
            return(RedirectToAction("Index", lang + "/" + name, new { passedAlong = passingValue })); // Works
        }
Ejemplo n.º 27
0
 public void ThenCartPageIsShown()
 {
     CartPage.CartPageIsShown();
 }
Ejemplo n.º 28
0
 public NewPurchaseFacade(MainPage mainPage, CartPage cartPage, CheckoutPage checkoutPage)
 {
     _mainPage     = mainPage;
     _cartPage     = cartPage;
     _checkoutPage = checkoutPage;
 }
Ejemplo n.º 29
0
        public void OnlyPaymentMethodAdded()
        {
            var indexPage = new IndexPage(driver, url);

            var testData = new
            {
                //Make sure to change name of email
                user = dataFactory.CreateLoginAccount(),
            };

            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(testData.user.Email, testData.user.Password);

            indexPage.Header.SelectManufacturer(manufacturerOption);

            indexPage.Header.SetSearchFieldText(searchField);

            CatalogItemsPage catalogItemPage = indexPage.Header.ClickOnSearchButton();

            Thread.Sleep(2000);

            catalogItemPage.AddtoCartbuttonInCatalog();

            Thread.Sleep(5000);

            CartPage CartMainPage = catalogItemPage.Header.ClickOnViewCart();

            //Waiting For Loading Cart
            Thread.Sleep(7000);

            //Click no Proceed to checkout button
            CheckoutPage checkoutPage = CartMainPage.ProceedToCheckOut();

            Thread.Sleep(5000);

            checkoutPage.SetAddressElement(AddressInputs.ATTN, "CompanyOrName");
            checkoutPage.SetAddressElement(AddressInputs.StreetAddress, "123 Massachusetts Avenue");
            checkoutPage.SetAddressElement(AddressInputs.Apt, "12345");
            checkoutPage.SetAddressElement(AddressInputs.City, "Cambridge");
            checkoutPage.SetAddressElement(AddressInputs.State, "MA");
            checkoutPage.SetAddressElement(AddressInputs.Postal, "02138");

            checkoutPage.ClickShippingButton();

            //Thread.Sleep(2000);

            Thread.Sleep(5000);

            checkoutPage.SelectBillingRadioButton(BillingSelectOptions.New);

            PaymentOptionModel cardToken = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077"
            };

            checkoutPage.SetBillingElement(BillingInputs.CardHolderName, cardToken.HolderName);
            checkoutPage.SetBillingElement(BillingInputs.CardNumber, cardToken.CardNumber);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationMonth, cardToken.ExpirationMont);
            checkoutPage.SetBillingElement(BillingInputs.ExpirationYear, cardToken.ExpirationYear);
            checkoutPage.SetBillingElement(BillingInputs.CVV, cardToken.Cvv);

            Thread.Sleep(2000);

            Assert.IsTrue(checkoutPage.BillingButtonIsEnable(), "Proceed to Review and Place Your Order button is not available");

            checkoutPage.BillingSubmitClick();

            Thread.Sleep(3000);

            Assert.IsTrue(checkoutPage.PlaceOrderButtonIsEnable(), "Place Your Order button is not available");

            Thread.Sleep(5000);

            OrderConfirmationPage orderpage = checkoutPage.PlaceOrderSubmitClick();

            Assert.IsTrue(checkoutPage.OrderConfirmationText(), "Order Confirmation text is not available");
        }
 public void WhenUserClickAddToCartButton()
 {
     helmetProductPage.ClickAddToCart();
     cartPage = new CartPage(_webDriver);
 }
 public CartPageViewModel(INavigation navigation, CartPage cartPage)
 {
     navigationRef = navigation;
     cartPageRef   = cartPage;
 }