Exemple #1
0
        public void E2E06()
        {
            APIndexPage indexPage = new APIndexPage(Driver, Url);

            // log in
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

            loginPage.Login("*****@*****.**", "test1234");

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

            catalogItemsPage.AddToCartFirstItemInCatalog();

            APCartPage cartPage = indexPage.Header.ClickOnViewCart();

            Assert.IsTrue(cartPage.ShippingOptionsPriced());

            string shippingPrice = cartPage.SelectShipping("Showroom Pickup");

            cartPage.WaitForAppBusy();
            Assert.AreEqual(cartPage.GetShippingTotal(), "Free");

            shippingPrice = cartPage.SelectShipping("Ground");
            cartPage.WaitForAppBusy();
            Assert.AreEqual(cartPage.GetShippingTotal(), shippingPrice);

            APCheckoutPage checkoutPage = cartPage.ProceedToCheckOut();

            checkoutPage.WaitForAppBusy();
            checkoutPage.ClickShippingEdit();
            checkoutPage.SelectAddressRadioButton(AddressSelectOptions.New);
            AddressModel addressModel = new AddressModel
            {
                street      = "street 1",
                state       = "Alabama",
                city        = "city 1",
                postal      = "12345",
                country     = "Mexico",
                region      = "CL",
                CompanyName = "test"
            };

            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.Country, addressModel.country);
            checkoutPage.SetAddressElement(AddressInputs.ATTN, addressModel.CompanyName);
            checkoutPage.ShippingButtonIsEnable();
            checkoutPage.ShippingSubmitClick();
            System.Threading.Thread.Sleep(6000);

            //checkoutPage.NextStep();

            //Assert.AreEqual(checkoutPage.ShippingWarning(), "Cannot estimate shipping");
        }
Exemple #2
0
        public void E2E02()
        {
            APIndexPage indexPage = new APIndexPage(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
            APCartPage 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
            APCheckoutPage 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);
        }
Exemple #3
0
        public void E2E05()
        {
            APIndexPage indexPage = new APIndexPage(Driver, Url);

            // log in
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

            loginPage.Login("*****@*****.**", "test1234");

            DashboardHomePage accountDashboard = indexPage.Header.ClickOnDashboard();

            Assert.IsTrue(accountDashboard.ContactInfoExist());

            ContactInfoEditPage contactInfoEdit = accountDashboard.ContactInfoEdit();

            Assert.AreEqual("Edit contact information", contactInfoEdit.GetSectionTitle());
            contactInfoEdit.ClickOnCancel();

            Assert.IsTrue(accountDashboard.AddressesExist());

            AddressesHomePage addressPage = accountDashboard.ClickAddressesLink();

            AddressModel addressModel = new AddressModel
            {
                street      = "134 Manton Street",
                apartment   = "134",
                state       = "Pennsylvania",
                city        = "Philadelphia",
                postal      = "19147",
                country     = "US",
                region      = "PA",
                CompanyName = "Test company"
            };

            addressPage.ClickOnAddressInDropdownStateInitials(AccessLevel.User, addressModel);
            addressPage.WaitForAppBusy();
            addressPage.ContentModal.ClickOnCancel();
            addressPage.WaitForAppBusy();

            /**/
            AddAddressPage addAddressPage = addressPage.ClickOnAddNewAddress();

            AddressModel newAddressModel = new AddressModel
            {
                street      = "134 Testing Street",
                apartment   = "134",
                state       = "Colorado",
                city        = "Aspen",
                postal      = "12345",
                country     = "US",
                region      = "CO",
                CompanyName = "Test company"
            };

            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.Country, newAddressModel.country);
            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.CompanyName, newAddressModel.CompanyName);
            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.Street, newAddressModel.street);
            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.Apartment, newAddressModel.apartment);
            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.City, newAddressModel.city);
            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.State, newAddressModel.state);
            addAddressPage.SetInputValue(PageObjects.MyAccountPOM.AddressesPOM.AddressInputs.Postal, newAddressModel.postal);

            addressPage = addAddressPage.ClickOnSubmit();
            addAddressPage.InformationModal.ClickOnClose();
            addressPage.WaitForAppBusy();


            addressPage.ClickOnAddressInDropdownStateInitials(AccessLevel.User, addressModel);
            addressPage.WaitForAppBusy();

            addressPage.ContentModal.ClickOnMakeDefault();
            addressPage.WaitForAppBusy();
            //TEMPORARY SOLUTION FOR LOADING ANIMATIONS AND LOADING TIMES
            System.Threading.Thread.Sleep(3000);

            addressPage.InformationModal.ClickOnClose();

            /*
             */

            accountDashboard = addressPage.Header.ClickOnDashboard();

            accountDashboard.WaitForAppBusy();
            Assert.IsTrue(accountDashboard.PaymentOptionsExist());

            PaymentOptionsEditPage paymentEditPage = accountDashboard.ClickEditPaymentLink();

            paymentEditPage.ClickOnCancel();

            PaymentOptionsHomePage paymentPage = accountDashboard.ClickPaymentsLink();

            Assert.IsTrue(paymentPage.PaymentOptionsTitleExist());
            IEnumerable <String> paymentItems = paymentPage.GetPaymentsDropdownItems(AccessLevel.Account);

            paymentPage.ClickOnPaymentOption(AccessLevel.Account, paymentItems.First());
            paymentPage.WaitForAppBusy();
            paymentPage.ContentModal.ClickOnMakeDefault();
            paymentPage.WaitForAppBusy();
            paymentPage.InfoModal.ClickOnClose();

            paymentItems = paymentPage.GetPaymentsDropdownItems(AccessLevel.User);

            paymentPage.ClickOnPaymentOption(AccessLevel.User, paymentItems.First());
            paymentPage.WaitForAppBusy();
            paymentPage.ContentModal.ClickOnMakeDefault();
            paymentPage.WaitForAppBusy();
            // TEMPORARY SOLUTION SO IFRAME LOADS AND DOM ELEMENT WAIT DOESN'T CRASH/FAIL THE TEST
            // *** FUTURE SOLUTION TO DO
            System.Threading.Thread.Sleep(4000);
            paymentPage.InfoModal.ClickOnClose();

            paymentPage.WaitForAppBusy();
            PaymentOptionsCreatePage paymentCreatePage = paymentPage.ClickOnAddNewCreditCard();

            // TEMPORARY SOLUTION SO IFRAME LOADS AND DOM ELEMENT WAIT DOESN'T CRASH/FAIL THE TEST
            // *** FUTURE SOLUTION TO DO
            System.Threading.Thread.Sleep(5000);

            PaymentOptionModel paymentOptionModel = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "2022",
                Cvv            = "077",
                HolderName     = "Test Test",
                LastFourDigits = "1293"
            };

            paymentCreatePage.WaitForAppBusy();
            paymentCreatePage.FillCardTokenForm(paymentOptionModel);
            paymentCreatePage.ClickOnMakeDefault();
            paymentCreatePage.SelectPreviouslyStoreAddress("Test company");
            paymentCreatePage.ClickOnSubmit();
            System.Threading.Thread.Sleep(3000);

            // assert if click on submit is valid ( assert/bool that all fields are valid)
            // if assert for click on submit is valid then assert modal if creditcard was a succesfully added
            paymentPage = paymentCreatePage.CloseModal(ModalsEnum.Information);

            // TEMPORARY SOLUTION
            System.Threading.Thread.Sleep(3000);

            // step to change to a US adress and change state to colorado
            // this before searching for item


            //
            indexPage.Header.SetSearchFieldText("KE50750-4");
            CatalogItemsPage catalogItemsPage = indexPage.Header.ClickOnSearchButton();

            catalogItemsPage.AddToCartFirstItemInCatalog();

            APCartPage cartPage = indexPage.Header.ClickOnViewCart();

            // TEMPORARY SOLUTION
            System.Threading.Thread.Sleep(6000);
        }