Beispiel #1
0
        public void AddIntlAddressSetAsDefault()
        {
            var          testUser    = TestDataFactory.CreateLoginAccount();
            AddressModel testAddress = new AddressModel
            {
                country     = "MX",
                CompanyName = "intl address ;)",
                street      = "calle sexta",
                state       = "Estado de Baja California",
                city        = "Ensenada",
                postal      = "22790",
                apartment   = "12"
            };

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

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

            AddressesHomePage addressesPage  = indexPage.Header.ClickOnAddresses();
            AddAddressPage    addAddressPage = addressesPage.ClickOnAddNewAddress();

            string expectedCountry  = addAddressPage.GetCurrentCountryValue();
            var    currentCountries = addAddressPage.GetCountriesFromDropdown().ToList();

            addAddressPage.SetInputValue(AddressInputs.Country, testAddress.country);
            addAddressPage.SetInputValue(AddressInputs.CompanyName, testAddress.CompanyName);
            addAddressPage.SetInputValue(AddressInputs.State, testAddress.state);
            addAddressPage.SetInputValue(AddressInputs.Street, testAddress.street);
            addAddressPage.SetInputValue(AddressInputs.City, testAddress.city);
            addAddressPage.SetInputValue(AddressInputs.Postal, testAddress.postal);
            addAddressPage.SetInputValue(AddressInputs.Apartment, testAddress.apartment);
            addAddressPage.SetCheckboxDefault();

            addressesPage = addAddressPage.ClickOnSubmit();
            addressesPage.WaitForAppBusy();
            addressesPage.InformationModal.ClickOnClose();
            addressesPage.WaitForAppBusy();
            Thread.Sleep(1000);

            var    dropdownItems        = addressesPage.GetAddressesDropdownItems(AccessLevel.User).ToList();
            bool   defaultLabelExist    = addressesPage.IsDefaultLabelPresentOnDropdownItem(AccessLevel.User);
            string actualDefaultAddress = addressesPage.GetDefaultTileAddressData(AccessLevel.User);

            //just created address data
            string createdAddress = FormatAddress(testAddress);

            string expectedAddress    = dropdownItems.FirstOrDefault(x => x.Contains(createdAddress));
            bool   userLevelTileExist = addressesPage.DefaultTileExist(AccessLevel.User);

            Assert.IsNotNull(expectedAddress, "The just added address is not found on the dropdown");
            Assert.IsTrue(defaultLabelExist, "Default label does not exist");

            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.street));
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.apartment));
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.country));
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.postal));
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.state));
            Assert.IsTrue(userLevelTileExist, "default user level tile is already present");
        }
Beispiel #2
0
        public void DeleteAddressCase()
        {
            var          testUser = TestDataFactory.CreateLoginAccount();
            AddressModel testData = new AddressModel
            {
                CompanyName = "QA Softtek",
                street      = "Walnut Street",
                apartment   = "07",
                state       = "CO",
                city        = "Denver",
                country     = "US",
                postal      = "12345"
            };

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

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

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

            AddressesHomePage addressesPage     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesPage.ClickOnAddNewAddress();

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

            addressesPage = createAddressPage.ClickOnSubmit();
            addressesPage.WaitForAppBusy();
            addressesPage.InformationModal.ClickOnClose();
            addressesPage.WaitForAppBusy();
            Thread.Sleep(1000);

            //delete address
            addressesPage.ClickOnAddressInDropdown(AccessLevel.User, testData);
            addressesPage.WaitForAppBusy();
            addressesPage.ContentModal.ClickOnDelete();
            addressesPage.ConfirmationModal.ClickOnDelete();
            addressesPage.WaitForAppBusy();
            var dropdownItems = addressesPage.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //deleted address data
            string deletedAddress = FormatAddress(testData);

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

            Assert.IsNull(expectedAddress, "Selected address is still in the dropdown o:");
        }
Beispiel #3
0
        public void CheckBothDropdownsItemsCount()
        {
            //TODO: this TC needs specific test data (20 level account/user addresses)
            var testData = new { Email = "", Password = "" };


            APIndexPage indexPage = new APIndexPage(Driver, Url);

            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

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

            AddressesHomePage addressesPage = indexPage.Header.ClickOnAddresses();

            int accountLevelItemsCount = addressesPage.GetAddressesDropdownItems(AccessLevel.Account).Count();
            int userLevelItemsCount    = addressesPage.GetAddressesDropdownItems(AccessLevel.User).Count();

            Assert.IsTrue(accountLevelItemsCount > 20, "Account level dropdpown items count is not as expected");
            Assert.IsTrue(userLevelItemsCount > 20, "User level dropdown items count is not as expected");

            //addressesPage.Header.ClickOnSignOut();
        }
Beispiel #4
0
        public void AddUserLevelAddressAutocompleteEdited()
        {
            var          testUser    = TestDataFactory.CreateLoginAccount();
            AddressModel testAddress = new AddressModel
            {
                apartment   = "07",
                city        = "Denver",
                country     = "US",
                postal      = "12345",
                state       = "CO",
                street      = "Walnut Street",
                CompanyName = "QA Softtek"
            };

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

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

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

            AddressesHomePage addressesHomePage   = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressesPage = addressesHomePage.ClickOnAddNewAddress();

            //fill address form
            createAddressesPage.SetInputValue(AddressInputs.CompanyName, testAddress.CompanyName);
            createAddressesPage.SetStreetAutoComplete(testAddress.street, testAddress.city, testAddress.state, testAddress.country);
            createAddressesPage.SetInputValue(AddressInputs.Apartment, testAddress.apartment);
            createAddressesPage.SetInputValue(AddressInputs.City, testAddress.city);
            createAddressesPage.SetInputValue(AddressInputs.Postal, testAddress.postal);

            bool submitButtonEnabled = createAddressesPage.AddNewButtonIsEnabled();

            Assert.IsTrue(submitButtonEnabled, "Submit button is not enabled");

            addressesHomePage = createAddressesPage.ClickOnSubmit();
            addressesHomePage.WaitForAppBusy();
            addressesHomePage.InformationModal.ClickOnClose();
            addressesHomePage.WaitForAppBusy();

            var dropdownItems = addressesHomePage.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //just created address data
            string createdAddress = FormatAddress(testAddress);

            //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");
        }
Beispiel #5
0
        public void EditIntlAddressSetAsDefault()
        {
            var          testUser = DataFactory.Users.CreateTestUser();
            AddressModel testData = new AddressModel
            {
                CompanyName = "QA Softtek",
                street      = "Walnut street",
                apartment   = "07",
                state       = "CO",
                city        = "Denver",
                country     = "US",
                postal      = "12345"
            };
            AddressModel newAddress = new AddressModel
            {
                street    = "Calle novena",
                apartment = "apt 2",
                state     = "estado de baja california",
                city      = "ensenada",
                country   = "MX",
                postal    = "22780",
            };

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

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

            AddressesHomePage addressesHome     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesHome.ClickOnAddNewAddress();

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

            addressesHome = createAddressPage.ClickOnSubmit();

            addressesHome.InformationModal.ClickOnClose();

            //start to update the address
            addressesHome.ClickOnAddressInDropdown(AccessLevel.User, testData);

            EditAddressPage editAddressPage = addressesHome.ContentModal.ClickOnEdit();

            editAddressPage.SetInputValue(AddressInputs.Country, newAddress.country);
            editAddressPage.SetInputValue(AddressInputs.State, newAddress.state);
            editAddressPage.SetInputValue(AddressInputs.Street, newAddress.street);
            editAddressPage.SetInputValue(AddressInputs.City, newAddress.city);
            editAddressPage.SetInputValue(AddressInputs.Apartment, newAddress.apartment);
            editAddressPage.SetInputValue(AddressInputs.Postal, newAddress.postal);
            editAddressPage.SetCheckboxDefault();

            addressesHome = editAddressPage.ClickOnSubmit();

            //TODO
            addressesHome.WaitForAppBusy();

            var dropdownItems = addressesHome.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //just edited address data
            string expectedAddress = "Default " + FormatAddress(newAddress);
            string actualAddress   = dropdownItems.FirstOrDefault();

            //search the address in the user level dropdown
            Assert.AreEqual(expectedAddress, actualAddress);
        }
Beispiel #6
0
        public void EditInternationalAddress()
        {
            var          testUser = DataFactory.Users.CreateTestUser();
            AddressModel testData = new AddressModel
            {
                CompanyName = "QA Softtek",
                street      = "Walnut street",
                apartment   = "07",
                state       = "CO",
                city        = "Denver",
                country     = "US",
                postal      = "12345"
            };
            var newAddress = new AddressModel
            {
                street    = "Calle septima",
                apartment = "suite 12",
                state     = "estado de baja california",
                city      = "ensenada",
                country   = "MX",
                postal    = "22890",
            };
            APIndexPage indexPage = new APIndexPage(Driver, Url);
            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

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

            AddressesHomePage addressesHome     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesHome.ClickOnAddNewAddress();

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

            addressesHome = createAddressPage.ClickOnSubmit();

            addressesHome.InformationModal.ClickOnClose();

            //start updating the address
            addressesHome.ClickOnAddressInDropdown(AccessLevel.User, testData);

            EditAddressPage editAddressPage = addressesHome.ContentModal.ClickOnEdit();

            editAddressPage.SetInputValue(AddressInputs.Country, newAddress.country);
            editAddressPage.SetInputValue(AddressInputs.State, newAddress.state);
            editAddressPage.SetInputValue(AddressInputs.Street, newAddress.street);
            editAddressPage.SetInputValue(AddressInputs.City, newAddress.city);
            editAddressPage.SetInputValue(AddressInputs.Apartment, newAddress.apartment);
            editAddressPage.SetInputValue(AddressInputs.Postal, newAddress.postal);

            addressesHome = editAddressPage.ClickOnSubmit();

            System.Threading.Thread.Sleep(1500);

            var dropdownItems = addressesHome.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //just edited address data
            string createdAddress = FormatAddress(newAddress);

            //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");
        }
Beispiel #7
0
        public void EditUserLevelAddress()
        {
            var          testUser = DataFactory.Users.CreateTestUser();
            AddressModel testData = new AddressModel
            {
                CompanyName = "QA Softtek",
                street      = "Walnut street",
                apartment   = "07",
                state       = "CO",
                city        = "Denver",
                country     = "US",
                postal      = "12345"
            };
            AddressModel newAddress = new AddressModel
            {
                street    = "Elm street",
                apartment = "apt 123",
                state     = "CO",
                city      = "Denver",
                country   = "US",
                postal    = "12345",
            };

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

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

            AddressesHomePage addressesHome     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesHome.ClickOnAddNewAddress();

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

            addressesHome = createAddressPage.ClickOnSubmit();

            addressesHome.InformationModal.ClickOnClose();

            //Start updating the address
            addressesHome.ClickOnAddressInDropdown(AccessLevel.User, testData);
            EditAddressPage editAddressPage = addressesHome.ContentModal.ClickOnEdit();

            editAddressPage.SetInputValue(AddressInputs.Street, newAddress.street);
            editAddressPage.SetInputValue(AddressInputs.Apartment, newAddress.apartment);
            addressesHome = editAddressPage.ClickOnSubmit();

            //TODO
            //check if an animation is present
            addressesHome.WaitForAppBusy();
            //TODO
            //dropdown is not populated
            System.Threading.Thread.Sleep(1500);
            var dropdownItems = addressesHome.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //just edited address data
            string expectedAddress = FormatAddress(newAddress);

            //search the address in the user level dropdown
            string actualAddress = dropdownItems.FirstOrDefault();

            Assert.AreEqual(expectedAddress, actualAddress);
        }
Beispiel #8
0
        public void AddInternationalAddress()
        {
            var          testUser    = DataFactory.Users.CreateTestUser();
            AddressModel testAddress = new AddressModel
            {
                country     = "MX",
                CompanyName = "intl address ;)",
                street      = "calle sexta",
                state       = "Estado de Baja California",
                city        = "Ensenada",
                postal      = "22790",
                apartment   = "12"
            };
            string defaultCountry      = "US - United States";
            var    nonAceptedCountries = new
            {
                Somalia    = "Somalia",
                Cuba       = "Cuba",
                Iran       = "Iran",
                NorthKorea = "North Korea",
                Lebannon   = "Lebannon",
                Syria      = "Syria"
            };

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

            indexPage = loginPage.Login(testUser.Username, testUser.Password);
            AddressesHomePage addressesPage  = indexPage.Header.ClickOnAddresses();
            AddAddressPage    addAddressPage = addressesPage.ClickOnAddNewAddress();

            string expectedCountry  = addAddressPage.GetCurrentCountryValue();
            var    currentCountries = addAddressPage.GetCountriesFromDropdown().ToList();

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

            addressesPage = addAddressPage.ClickOnSubmit();

            addressesPage.InformationModal.ClickOnClose();

            var dropdownItems = addressesPage.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //just created address data
            string createdAddress = FormatAddress(testAddress);

            string expectedAddress = dropdownItems.FirstOrDefault(x => x.Contains(createdAddress));

            Assert.IsTrue(defaultCountry.Contains(expectedCountry), $"'{expectedCountry}' is not the default country");
            CollectionAssert.DoesNotContain(currentCountries, nonAceptedCountries.Cuba, $"'{nonAceptedCountries.Cuba}' cannot be here");
            CollectionAssert.DoesNotContain(currentCountries, nonAceptedCountries.Iran, $"'{nonAceptedCountries.Iran}' cannot be here");
            CollectionAssert.DoesNotContain(currentCountries, nonAceptedCountries.Lebannon, $"'{nonAceptedCountries.Lebannon}' cannot be here");
            CollectionAssert.DoesNotContain(currentCountries, nonAceptedCountries.NorthKorea, $"'{nonAceptedCountries.NorthKorea}' cannot be here");
            CollectionAssert.DoesNotContain(currentCountries, nonAceptedCountries.Somalia, $"'{nonAceptedCountries.Somalia}' cannot be here");
            CollectionAssert.DoesNotContain(currentCountries, nonAceptedCountries.Syria, $"'{nonAceptedCountries.Syria}' cannot be here");
            Assert.IsNotNull(expectedAddress, "The just added address is not found on the dropdown");
        }
Beispiel #9
0
        public void EditIntlAddressSetAsDefault()
        {
            var          testUser = TestDataFactory.CreateLoginAccount();
            AddressModel testData = new AddressModel
            {
                CompanyName = "QA Softtek",
                street      = "Walnut Street",
                apartment   = "07",
                state       = "CO",
                city        = "Denver",
                country     = "US",
                postal      = "12345"
            };
            AddressModel newAddress = new AddressModel
            {
                street    = "Calle novena",
                apartment = "suite 2",
                state     = "estado de baja california",
                city      = "ensenada",
                country   = "MX",
                postal    = "22790",
            };

            IndexPage indexPage = new IndexPage(driver, url);
            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

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

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

            AddressesHomePage addressesHome     = indexPage.Header.ClickOnAddresses();
            AddAddressPage    createAddressPage = addressesHome.ClickOnAddNewAddress();

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

            addressesHome = createAddressPage.ClickOnSubmit();
            addressesHome.IsAppBusy();
            addressesHome.InformationModal.ClickOnClose();
            addressesHome.IsAppBusy();

            //start to update the address
            addressesHome.ClickOnAddressInDropdown(AccessLevel.User, testData);

            EditAddressPage editAddressPage = addressesHome.ContentModal.ClickOnEdit();

            editAddressPage.SetInputValue(AddressInputs.Country, newAddress.country);
            editAddressPage.SetInputValue(AddressInputs.State, newAddress.state);
            editAddressPage.SetInputValue(AddressInputs.Street, newAddress.street);
            editAddressPage.SetInputValue(AddressInputs.City, newAddress.city);
            editAddressPage.SetInputValue(AddressInputs.Apartment, newAddress.apartment);
            editAddressPage.SetInputValue(AddressInputs.Postal, newAddress.postal);
            editAddressPage.SetCheckboxDefault();

            addressesHome = editAddressPage.ClickOnSubmit();
            addressesHome.IsAppBusy();

            var dropdownItems = addressesHome.GetAddressesDropdownItems(AccessLevel.User).ToList();

            //just edited address data
            string createdAddress = FormatAddress(newAddress);

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

            Assert.IsNotNull(expectedAddress, "Address is not found in dropdown");
        }