예제 #1
0
        public void AddCreditCardUsingNewAddress()
        {
            var testData = TestDataFactory.CreateLoginAccount();

            #region test data models
            var cardtoken = new PaymentOptionModel
            {
                CardNumber     = "5582508629687473",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077",
                LastFourDigits = "7473"
            };
            var address = new AddressModel
            {
                country     = "US",
                CompanyName = "QA Softtek Automation",
                state       = "CO",
                city        = "Denver",
                street      = "Elm street",
                postal      = "22780",
                apartment   = "24"
            };
            #endregion

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();
            indexPage = loginPage.Login(testData.Email, testData.Password);

            PaymentOptionsHomePage   paymentsPage      = indexPage.Header.ClickOnPaymentOptions();
            PaymentOptionsCreatePage addNewPaymentPage = paymentsPage.ClickOnAddNewCreditCard();
            addNewPaymentPage.FillCardTokenForm(cardtoken);
            addNewPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.AddNew);

            //Fill billing address form
            addNewPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, address.CompanyName);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Street, address.street);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Apartment, address.apartment);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.City, address.city);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.State, address.state);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Postal, address.postal);

            bool makeDefaultCheckboxExist = addNewPaymentPage.ElementOnPageIsPresent(AddPaymentElements.DefaultCheckbox);

            Assert.IsTrue(makeDefaultCheckboxExist, "Default checkbox does not exist");

            addNewPaymentPage.ClickOnSubmit();
            addNewPaymentPage.WaitForAppBusy();
            paymentsPage = addNewPaymentPage.CloseModal(ModalsEnum.Information);
            Thread.Sleep(1000);

            List <string> items   = paymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList();
            string        payment = items.FirstOrDefault(it => it.Contains($"{cardtoken.LastFourDigits} {cardtoken.ExpirationMont}/{cardtoken.ExpirationYear}"));

            Assert.IsNotNull(payment, "Payment is not found");
        }
예제 #2
0
        public void AddPaymentOptionIntlAddress()
        {
            var testUser = TestDataFactory.CreateLoginAccount();

            #region test data
            var testCardtoken = new PaymentOptionModel
            {
                CardNumber     = "5582508629687473",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077",
                LastFourDigits = "7473"
            };
            var testBillingAddress = new AddressModel
            {
                country     = "MX",
                CompanyName = "SDET",
                state       = "Estado de baja california",
                city        = "Ensenada",
                street      = "Calle 10",
                postal      = "22790",
                apartment   = "Suite 24"
            };
            #endregion test data

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();
            indexPage = loginPage.Login(testUser.Email, testUser.Password);
            PaymentOptionsHomePage   paymentsHomePage = indexPage.Header.ClickOnPaymentOptions();
            PaymentOptionsCreatePage addPaymentPage   = paymentsHomePage.ClickOnAddNewCreditCard();
            addPaymentPage.FillCardTokenForm(testCardtoken);
            addPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.AddNew);
            addPaymentPage.SetInputAddressValue(AddressInputs.Country, testBillingAddress.country);
            addPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, testBillingAddress.CompanyName);
            addPaymentPage.SetInputAddressValue(AddressInputs.Street, testBillingAddress.street);
            addPaymentPage.SetInputAddressValue(AddressInputs.Apartment, testBillingAddress.apartment);
            addPaymentPage.SetInputAddressValue(AddressInputs.City, testBillingAddress.city);
            addPaymentPage.SetInputAddressValue(AddressInputs.State, testBillingAddress.state);
            addPaymentPage.SetInputAddressValue(AddressInputs.Postal, testBillingAddress.postal);

            addPaymentPage.ClickOnSubmit();
            addPaymentPage.WaitForAppBusy();
            paymentsHomePage = addPaymentPage.CloseModal(ModalsEnum.Information);
            Thread.Sleep(500);

            List <string> items          = paymentsHomePage.GetPaymentsDropdownItems(AccessLevel.User).ToList();
            string        expectedResult = $"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}";
            string        payment        = items.FirstOrDefault(option => option.Contains(expectedResult));

            Assert.IsNotNull(payment, "Payment is not found");
        }
예제 #3
0
        public void EditInternationalAddress()
        {
            var          testUser           = TestDataFactory.CreateLoginAccount();
            AddressModel testBillingAddress = new AddressModel
            {
                country     = "MX",
                CompanyName = "SDET",
                state       = "CO",
                city        = "test city",
                street      = "elm street",
                postal      = "22770",
                apartment   = "Suite s4"
            };
            PaymentOptionModel testCardtoken = new PaymentOptionModel
            {
                LastFourDigits = "1111",
                Cvv            = "077",
                ExpirationMont = "12",
                ExpirationYear = "26",
                HolderName     = "pika",
                CardNumber     = "4111111111111111"
            };
            AddressModel expectedBillingAddress = new AddressModel
            {
                country     = "MX",
                CompanyName = "SDET",
                state       = "Estado de baja california",
                city        = "Ensenada",
                street      = "Calle 3",
                postal      = "22790",
                apartment   = "Suite 24"
            };
            string       currentPaymentData         = $"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}";
            AddressModel actualBillingAddressValues = new AddressModel();

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(testUser.Email, testUser.Password);
            PaymentOptionsHomePage paymentsHomePage = indexPage.Header.ClickOnPaymentOptions();

            //Add a new credit card
            PaymentOptionsCreatePage addPaymentPage = paymentsHomePage.ClickOnAddNewCreditCard();

            addPaymentPage.FillCardTokenForm(testCardtoken);
            addPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.AddNew);
            addPaymentPage.SetInputAddressValue(AddressInputs.Country, testBillingAddress.country);
            addPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, testBillingAddress.CompanyName);
            addPaymentPage.SetInputAddressValue(AddressInputs.Street, testBillingAddress.street);
            addPaymentPage.SetInputAddressValue(AddressInputs.Apartment, testBillingAddress.apartment);
            addPaymentPage.SetInputAddressValue(AddressInputs.City, testBillingAddress.city);
            addPaymentPage.SetInputAddressValue(AddressInputs.State, testBillingAddress.state);
            addPaymentPage.SetInputAddressValue(AddressInputs.Postal, testBillingAddress.postal);

            addPaymentPage.ClickOnSubmit();
            addPaymentPage.WaitForAppBusy();
            paymentsHomePage = addPaymentPage.CloseModal(ModalsEnum.Information);
            Thread.Sleep(1000);

            //Begin testing here
            paymentsHomePage.ClickOnPaymentOption(AccessLevel.User, currentPaymentData);

            PaymentOptionsEditPage editPaymentPage = paymentsHomePage.ContentModal.ClickOnEdit();

            editPaymentPage.WaitForAppBusy();
            editPaymentPage.ClickOnBillingAddressOption(BillingAddressOptions.NewOne);
            editPaymentPage.SetInputAddressValue(AddressInputs.Country, expectedBillingAddress.country);
            editPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, expectedBillingAddress.CompanyName);
            editPaymentPage.SetInputAddressValue(AddressInputs.Street, expectedBillingAddress.street);
            editPaymentPage.SetInputAddressValue(AddressInputs.Apartment, expectedBillingAddress.apartment);
            editPaymentPage.SetInputAddressValue(AddressInputs.City, expectedBillingAddress.city);
            editPaymentPage.SetInputAddressValue(AddressInputs.State, expectedBillingAddress.state);
            editPaymentPage.SetInputAddressValue(AddressInputs.Postal, expectedBillingAddress.postal);

            editPaymentPage.ClickOnSubmit();
            editPaymentPage.WaitForAppBusy();
            paymentsHomePage = editPaymentPage.CloseModal(ModalsEnum.Information);
            Thread.Sleep(1000);

            //make sure the update has done
            paymentsHomePage.ClickOnPaymentOption(AccessLevel.User, currentPaymentData);
            editPaymentPage = paymentsHomePage.ContentModal.ClickOnEdit();
            editPaymentPage.WaitForAppBusy();

            actualBillingAddressValues.country     = editPaymentPage.GetBillingAddressInputValue(AddressInputs.Country);
            actualBillingAddressValues.CompanyName = editPaymentPage.GetBillingAddressInputValue(AddressInputs.CompanyName);
            actualBillingAddressValues.street      = editPaymentPage.GetBillingAddressInputValue(AddressInputs.Street);
            actualBillingAddressValues.apartment   = editPaymentPage.GetBillingAddressInputValue(AddressInputs.Apartment);
            actualBillingAddressValues.city        = editPaymentPage.GetBillingAddressInputValue(AddressInputs.City);
            actualBillingAddressValues.postal      = editPaymentPage.GetBillingAddressInputValue(AddressInputs.Postal);
            actualBillingAddressValues.state       = editPaymentPage.GetBillingAddressInputValue(AddressInputs.State);

            paymentsHomePage = editPaymentPage.ClickOnCancel();

            Assert.IsTrue(expectedBillingAddress.CompanyName == actualBillingAddressValues.CompanyName, $"Expected: '{expectedBillingAddress.CompanyName}' Got: '{actualBillingAddressValues.CompanyName}'");
            Assert.IsTrue(actualBillingAddressValues.country.Contains(expectedBillingAddress.country), $"Expected: '{expectedBillingAddress.country}' Got: '{actualBillingAddressValues.country}'");
            Assert.IsTrue(expectedBillingAddress.street == actualBillingAddressValues.street, $"Expected: '{expectedBillingAddress.street}' Got: '{actualBillingAddressValues.street}'");
            Assert.IsTrue(expectedBillingAddress.apartment == actualBillingAddressValues.apartment, $"Expected: '{expectedBillingAddress.apartment}' Got: '{actualBillingAddressValues.apartment}'");
            Assert.IsTrue(expectedBillingAddress.city == actualBillingAddressValues.city, $"Expected: '{expectedBillingAddress.city}' Got: '{actualBillingAddressValues.city}'");
            Assert.IsTrue(expectedBillingAddress.postal == actualBillingAddressValues.postal, $"Expected: '{expectedBillingAddress.postal}' Got: '{actualBillingAddressValues.postal}'");
            Assert.IsTrue(expectedBillingAddress.state == actualBillingAddressValues.state, $"Expected: '{expectedBillingAddress.state}' Got: '{actualBillingAddressValues.state}'");
        }
예제 #4
0
        public void EditPaymentMakeDefault()
        {
            var testUser = TestDataFactory.CreateLoginAccount();
            PaymentOptionModel testCardtoken = new PaymentOptionModel
            {
                LastFourDigits = "1111",
                Cvv            = "077",
                ExpirationMont = "12",
                ExpirationYear = "26",
                HolderName     = "pika",
                CardNumber     = "4111111111111111"
            };
            AddressModel testBillingAddress = new AddressModel
            {
                country     = "MX",
                CompanyName = "SDET",
                state       = "Estado de baja california",
                city        = "Ensenada",
                street      = "Calle 3",
                postal      = "22790",
                apartment   = "Suite 24"
            };
            string selectPayment = $"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}";

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

            loginPage.Login(testUser.Email, testUser.Password);
            PaymentOptionsHomePage paymentsPage = indexPage.Header.ClickOnPaymentOptions();

            PaymentOptionsCreatePage addPaymentPage = paymentsPage.ClickOnAddNewCreditCard();

            addPaymentPage.FillCardTokenForm(testCardtoken);
            addPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.AddNew);
            addPaymentPage.SetInputAddressValue(AddressInputs.Country, testBillingAddress.country);
            addPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, testBillingAddress.CompanyName);
            addPaymentPage.SetInputAddressValue(AddressInputs.Street, testBillingAddress.street);
            addPaymentPage.SetInputAddressValue(AddressInputs.Apartment, testBillingAddress.apartment);
            addPaymentPage.SetInputAddressValue(AddressInputs.City, testBillingAddress.city);
            addPaymentPage.SetInputAddressValue(AddressInputs.State, testBillingAddress.state);
            addPaymentPage.SetInputAddressValue(AddressInputs.Postal, testBillingAddress.postal);

            addPaymentPage.ClickOnSubmit();
            addPaymentPage.WaitForAppBusy();
            paymentsPage = addPaymentPage.CloseModal(ModalsEnum.Information);

            //begin the test
            paymentsPage.ClickOnPaymentOption(AccessLevel.User, selectPayment);
            PaymentOptionsEditPage editPaymentsPage = paymentsPage.ContentModal.ClickOnEdit();
            bool makeDefaultCheckboxExist           = editPaymentsPage.ElementOnPageIsPresent(AddPaymentElements.DefaultCheckbox);

            Assert.IsTrue(makeDefaultCheckboxExist, "Default checkbox does not exist");

            editPaymentsPage.ClickOnMakeDefault();
            bool isSubmitEnabled = editPaymentsPage.IsSubmitButtonEnabled();

            Assert.IsTrue(isSubmitEnabled, "The form cannot be submited");

            editPaymentsPage.ClickOnSubmit();
            editPaymentsPage.WaitForAppBusy();
            paymentsPage = editPaymentsPage.CloseModal(ModalsEnum.Information);

            List <string> items = paymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList();

            string payment = items.FirstOrDefault(it => it.Contains(
                                                      $"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}"));

            bool   defaultLabelInDropdownItem = paymentsPage.IsDefaultLabelPresentOnDropdownItem(AccessLevel.User);
            string actualDefaultPaymentData   = paymentsPage.GetDefaultTilePaymentData(AccessLevel.User);

            Assert.IsTrue(defaultLabelInDropdownItem, "Default label does not exist");
            Assert.IsTrue(actualDefaultPaymentData.Contains(testCardtoken.LastFourDigits), "Card last four digits cannot be found");
            Assert.IsTrue(actualDefaultPaymentData.Contains($"{testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}"), "Expiration date does not correspond");
            Assert.IsNotNull(payment, "Payment is not found");
        }
예제 #5
0
        //Test Case on test rail -> C1134, C1135, C1179
        //[TestMethod]
        //[TestCategory(TestCategoriesConstants.Regression)]
        //[TestCategory(TestCategoriesConstants.Smoke)]
        public void AddCreditCardUsingPrevStoredAddress()
        {
            var          testData    = TestDataFactory.CreateLoginAccount();
            AddressModel testAddress = new AddressModel
            {
                country     = "US",
                street      = "street test",
                CompanyName = "address company name",
                state       = "CO",
                city        = "boulder",
                postal      = "52809"
            };
            PaymentOptionModel testCardtoken = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "22",
                HolderName     = "Test holder",
                Cvv            = "077",
                LastFourDigits = "1111"
            };

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

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

            //Manually add an address
            AddressesHomePage addressesPage     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesPage.ClickOnAddNewAddress();

            //Fill address form
            createAddressPage.SetInputValue(AddressInputs.CompanyName, testAddress.CompanyName);
            createAddressPage.SetInputValue(AddressInputs.Street, testAddress.street);
            createAddressPage.SetInputValue(AddressInputs.Apartment, testAddress.apartment);
            createAddressPage.SetInputValue(AddressInputs.City, testAddress.city);
            createAddressPage.SetInputValue(AddressInputs.State, testAddress.state);
            createAddressPage.SetInputValue(AddressInputs.Postal, testAddress.postal);

            addressesPage = createAddressPage.ClickOnSubmit();
            addressesPage.WaitForAppBusy();
            //TODO: check the logic on address create process
            //Changed by: Carlos acosta
            //Comments: Gus told me that "IsAppBussy is deprecated and told me to delete it, the method no longer exists
            //addressesPage.IsAppBusy();
            addressesPage.InformationModal.ClickOnClose();

            //test begins here
            PaymentOptionsHomePage   paymentsPage      = addressesPage.Header.ClickOnPaymentOptions();
            PaymentOptionsCreatePage addNewPaymentPage = paymentsPage.ClickOnAddNewCreditCard();

            string storedAddress = string.IsNullOrEmpty(testAddress.apartment) ?
                                   $"{testAddress.street}, {testAddress.city} {testAddress.country} {testAddress.postal}"
                :
                                   $"{testAddress.street}, {testAddress.apartment}, {testAddress.city} {testAddress.country} {testAddress.postal}";

            addNewPaymentPage.FillCardTokenForm(testCardtoken);
            addNewPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.Stored);
            addNewPaymentPage.SelectPreviouslyStoreAddress(storedAddress);
            addNewPaymentPage.ClickOnSubmit();
            addNewPaymentPage.WaitForAppBusy();
            paymentsPage = addNewPaymentPage.CloseModal(ModalsEnum.Information);
            addNewPaymentPage.WaitForAppBusy();
            Thread.Sleep(500);

            List <string> items   = paymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList();
            string        payment = items.FirstOrDefault(it => it.Contains($"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}"));

            Assert.IsNotNull(payment, "Payment option is not found");
        }
예제 #6
0
        public void DeleteUserLevelPayment()
        {
            #region testData
            var testUser = TestDataFactory.CreateLoginAccount();
            PaymentOptionModel testCardtoken = new PaymentOptionModel
            {
                CardNumber     = "5582508629687473",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077",
                LastFourDigits = "7473"
            };
            AddressModel testAddress = new AddressModel
            {
                country     = "US",
                CompanyName = "QA Softtek Automation",
                state       = "CO",
                city        = "Denver",
                street      = "Elm street",
                postal      = "22780",
                apartment   = "24"
            };
            #endregion testData

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();
            indexPage = loginPage.Login(testUser.Email, testUser.Password);

            Assert.IsNotNull(indexPage, "Login failed");

            PaymentOptionsHomePage   paymentsPage      = indexPage.Header.ClickOnPaymentOptions();
            PaymentOptionsCreatePage addNewPaymentPage = paymentsPage.ClickOnAddNewCreditCard();
            addNewPaymentPage.FillCardTokenForm(testCardtoken);
            addNewPaymentPage.ClickOnBillingAddressOption(BillingAddressOptions.NewOne);

            //Fill billing address form
            addNewPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, testAddress.CompanyName);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Street, testAddress.street);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Apartment, testAddress.apartment);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.City, testAddress.city);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.State, testAddress.state);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Postal, testAddress.postal);

            bool makeDefaultCheckboxExist = addNewPaymentPage.ElementOnPageIsPresent(AddPaymentElements.DefaultCheckbox);

            Assert.IsTrue(makeDefaultCheckboxExist, "Default checkbox does not exist");

            addNewPaymentPage.ClickOnSubmit();
            addNewPaymentPage.WaitForAppBusy();
            paymentsPage = addNewPaymentPage.CloseModal(ModalsEnum.Information);
            Thread.Sleep(1000);

            //start deleting the payment
            int paymentsCountBefore = paymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList().Count;

            paymentsPage.ClickOnPaymentOption(
                AccessLevel.User,
                $"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}");

            Thread.Sleep(2000);
            paymentsPage.ContentModal.ClickOnDelete();
            Thread.Sleep(1000);
            paymentsPage.ConfirmationModal.ClickOnDelete();
            paymentsPage.WaitForAppBusy();

            int paymentsCountAfter = paymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList().Count;

            Assert.IsTrue(paymentsCountAfter == (paymentsCountBefore - 1), "Payment has not deleted");
        }
예제 #7
0
        public void SetUserLevelPaymentAsDefault()
        {
            var testUser = TestDataFactory.CreateLoginAccount();
            PaymentOptionModel testCardtoken = new PaymentOptionModel
            {
                CardNumber     = "5582508629687473",
                ExpirationMont = "12",
                ExpirationYear = "24",
                HolderName     = "Test corp",
                Cvv            = "077",
                LastFourDigits = "7473"
            };
            AddressModel testAddress = new AddressModel
            {
                country     = "US",
                CompanyName = "QA Softtek Automation",
                state       = "CO",
                city        = "Denver",
                street      = "Elm street",
                postal      = "22780",
                apartment   = "24"
            };
            //needs to be formated like that
            string stringTestPayment = $"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}" + $@"
{testCardtoken.HolderName}";

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

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

            PaymentOptionsHomePage viewPaymentsPage = indexPage.Header.ClickOnPaymentOptions();

            //add payment process
            PaymentOptionsCreatePage addNewPaymentPage = viewPaymentsPage.ClickOnAddNewCreditCard();

            addNewPaymentPage.FillCardTokenForm(testCardtoken);
            addNewPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.AddNew);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.CompanyName, testAddress.CompanyName);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Street, testAddress.street);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Apartment, testAddress.apartment);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.City, testAddress.city);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.State, testAddress.state);
            addNewPaymentPage.SetInputAddressValue(AddressInputs.Postal, testAddress.postal);
            addNewPaymentPage.ClickOnSubmit();
            addNewPaymentPage.WaitForAppBusy();
            viewPaymentsPage = addNewPaymentPage.CloseModal(ModalsEnum.Information);
            Thread.Sleep(1000);

            //validations begins here
            viewPaymentsPage.ClickOnPaymentOption(AccessLevel.User, stringTestPayment);
            viewPaymentsPage.ContentModal.ClickOnMakeDefault();
            viewPaymentsPage.WaitForAppBusy();
            viewPaymentsPage.InfoModal.ClickOnClose();

            bool defaultLabelInDropdownItem = viewPaymentsPage.IsDefaultLabelPresentOnDropdownItem(AccessLevel.User);

            List <string> paymentsInDropdown       = viewPaymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList();
            string        firstPayment             = paymentsInDropdown.ElementAt(0);
            string        actualDefaultPaymentData = viewPaymentsPage.GetDefaultTilePaymentData(AccessLevel.User);

            Assert.IsTrue(defaultLabelInDropdownItem, "default fayment has not a label");
            //sort order check
            Assert.IsTrue(firstPayment.Contains(stringTestPayment), "first payment is not the default one");
            Assert.IsTrue(actualDefaultPaymentData.Contains(testCardtoken.LastFourDigits));
            Assert.IsTrue(actualDefaultPaymentData.Contains($"{testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}"));

            bool accountTileIsPresent = viewPaymentsPage.ElementExistOnPage(AccessLevel.Account, ViewPaymentsElements.DefaultTile);

            Assert.IsFalse(accountTileIsPresent, "Account default tile should not exist here o:");
        }
예제 #8
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);
        }
예제 #9
0
        public void AddCreditCardUsingPrevStoredAddress()
        {
            var         testData    = DataFactory.Users.CreateTestUser();
            TestAddress testAddress = new TestAddress
            {
                Country             = "US",
                Street              = "street test",
                Name                = "address company name",
                StateProvinceRegion = "CO",
                City                = "boulder",
                Postal              = "52809"
            };
            PaymentOptionModel testCardtoken = new PaymentOptionModel
            {
                CardNumber     = "4111111111111111",
                ExpirationMont = "12",
                ExpirationYear = "22",
                HolderName     = "Test holder",
                Cvv            = "077",
                LastFourDigits = "1111"
            };

            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

            indexPage = loginPage.Login(testData.Username, testData.Password);

            //Manually add an address
            AddressesHomePage addressesPage     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesPage.ClickOnAddNewAddress();

            //Fill address form
            createAddressPage.SetInputValue(AddressInputs.CompanyName, testAddress.Name);
            createAddressPage.SetInputValue(AddressInputs.Street, testAddress.Street);
            createAddressPage.SetInputValue(AddressInputs.Apartment, testAddress.Apartment);
            createAddressPage.SetInputValue(AddressInputs.City, testAddress.City);
            createAddressPage.SetInputValue(AddressInputs.State, testAddress.StateProvinceRegion);
            createAddressPage.SetInputValue(AddressInputs.Postal, testAddress.Postal);

            addressesPage = createAddressPage.ClickOnSubmit();
            addressesPage.WaitForAppBusy();
            //TODO: check the logic on address create process
            addressesPage.WaitForAppBusy();
            addressesPage.InformationModal.ClickOnClose();

            //test begins here
            PaymentOptionsHomePage   paymentsPage      = addressesPage.Header.ClickOnPaymentOptions();
            PaymentOptionsCreatePage addNewPaymentPage = paymentsPage.ClickOnAddNewCreditCard();

            addNewPaymentPage.FillCardTokenForm(testCardtoken);
            addNewPaymentPage.SelectBillingAddressOption(BillingAddressOptionsEnum.Stored);
            addNewPaymentPage.SelectPreviouslyStoredAddress(testAddress);
            addNewPaymentPage.ClickOnSubmit();
            addNewPaymentPage.WaitForAppBusy();
            paymentsPage = addNewPaymentPage.CloseModal(ModalsEnum.Information);
            addNewPaymentPage.WaitForAppBusy();
            Thread.Sleep(500);

            List <string> items   = paymentsPage.GetPaymentsDropdownItems(AccessLevel.User).ToList();
            string        payment = items.FirstOrDefault(it => it.Contains($"{testCardtoken.LastFourDigits} {testCardtoken.ExpirationMont}/{testCardtoken.ExpirationYear}"));

            Assert.IsNotNull(payment, "Payment option is not found");
        }