示例#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");
        }
示例#2
0
        public void DeleteAddressThatIsDefault()
        {
            var          testUser = DataFactory.Users.CreateTestUser();
            AddressModel testData = new AddressModel
            {
                CompanyName = "QA Automation Softtek",
                street      = "test 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.Username, 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);
            createAddressPage.SetCheckboxDefault();

            addressesPage = createAddressPage.ClickOnSubmit();

            addressesPage.InformationModal.ClickOnClose();

            //TODO
            //does not find any address in dropdown
            System.Threading.Thread.Sleep(1000);
            addressesPage.ClickOnAddressInDropdown(AccessLevel.User, testData);

            addressesPage.ContentModal.ClickOnDelete();

            //validating that only exist 1 modal
            bool confirmationModalExist = addressesPage.ConfirmationModalExist();

            Assert.IsFalse(confirmationModalExist, "This element should not exist");
        }
示例#3
0
        public void EditAddressWithNoChangesMade()
        {
            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"
            };

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

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

            Assert.IsNotNull(indexPage);

            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);
            createAddressPage.SetCheckboxDefault();

            addressesPage = createAddressPage.ClickOnSubmit();

            addressesPage.InformationModal.ClickOnClose();

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

            EditAddressPage editAddressPage = addressesPage.ContentModal.ClickOnEdit();

            editAddressPage.SetCheckboxDefault();
            editAddressPage.SetCheckboxDefault();
            editAddressPage.ClickOnSubmit();

            //TODO
            //check if busy animation is present
            editAddressPage.WaitForAppBusy();

            addressesPage = editAddressPage.NoEditsModal.ClickOnCloseFooter();

            bool defaultLabelExist = addressesPage.IsDefaultLabelPresentOnDropdownItem(AccessLevel.User);

            string actualDefaultAddress = addressesPage.GetDefaultTileAddressData(AccessLevel.User);

            Assert.IsTrue(defaultLabelExist, "Default label does not exist");

            Assert.IsTrue(actualDefaultAddress.Contains(testData.street));
            Assert.IsTrue(actualDefaultAddress.Contains(testData.apartment));
            Assert.IsTrue(actualDefaultAddress.Contains(testData.country));
            Assert.IsTrue(actualDefaultAddress.Contains(testData.postal));
            Assert.IsTrue(actualDefaultAddress.Contains(testData.state));
        }