示例#1
0
        public void DesignateAccountAddressAsDefault()
        {
            var testData = TestDataFactory.UserWithAccountAddress();

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

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

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

            AddressesHomePage addressesHome = indexPage.Header.ClickOnAddresses();

            addressesHome.ClickOnAddressInDropdown(AccessLevel.Account, testData.Address);
            addressesHome.ContentModal.ClickOnMakeDefault();
            addressesHome.WaitForAppBusy();
            addressesHome.InformationModal.ClickOnClose();

            bool   defaultLabelExist    = addressesHome.IsDefaultLabelPresentOnDropdownItem(AccessLevel.Account);
            string actualDefaultAddress = addressesHome.GetDefaultTileAddressData(AccessLevel.Account);

            Assert.IsTrue(defaultLabelExist, "Default label does not exist");
            Assert.IsTrue(actualDefaultAddress.Contains(testData.Address.street), $"street not found, {testData.Address.street}");
            Assert.IsTrue(actualDefaultAddress.Contains(testData.Address.apartment), $"apartment not found, {testData.Address.apartment}");
            Assert.IsTrue(actualDefaultAddress.Contains(testData.Address.country), $"country not found, {testData.Address.country}");
            Assert.IsTrue(actualDefaultAddress.Contains(testData.Address.postal), $"postal not found, {testData.Address.postal}");
            Assert.IsTrue(actualDefaultAddress.Contains(testData.Address.state), $"state not found, {testData.Address.state}");

            bool userTileExist = addressesHome.DefaultTileExist(AccessLevel.User);

            Assert.IsFalse(userTileExist, "default user level tile is already present");

            //addressesHome.Header.ClickOnSignOut();
        }
示例#2
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");
        }
示例#3
0
        public void DesignateAccountAddressAsDefault()
        {
            //test data
            TestAccountAddress testAddress = new TestAccountAddress
            {
                Apartment           = "349",
                City                = "Denver",
                Country             = "US",
                CompanyName         = "dfs",
                Postal              = "80019",
                StateProvinceRegion = "CO",
                Street              = "Walnut street",
                ExternalIdentifier  = nameof(testAddress) + "C1108"
            };
            AddressModel selectedAddress = new AddressModel
            {
                apartment   = testAddress.Apartment,
                city        = testAddress.City,
                country     = testAddress.Country,
                CompanyName = testAddress.CompanyName,
                postal      = testAddress.Postal,
                state       = testAddress.StateProvinceRegion,
                street      = testAddress.Street
            };

            //this method is not ready
            var testUser = DataFactory.Users.CreateTestUser();

            APIndexPage indexPage = new APIndexPage(Driver, Url);

            APLoginPage loginPage = indexPage.Header.ClickOnSignIn();

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

            AddressesHomePage addressesHome = indexPage.Header.ClickOnAddresses();

            addressesHome.ClickOnAddressInDropdown(AccessLevel.Account, selectedAddress);
            addressesHome.ContentModal.ClickOnMakeDefault();

            //TODO
            //check if busy is present
            addressesHome.WaitForAppBusy();
            addressesHome.InformationModal.ClickOnClose();

            bool   defaultLabelExist    = addressesHome.IsDefaultLabelPresentOnDropdownItem(AccessLevel.Account);
            string actualDefaultAddress = addressesHome.GetDefaultTileAddressData(AccessLevel.Account);

            Assert.IsTrue(defaultLabelExist, "Default label does not exist");
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.Street), $"street not found, {testAddress.Street}");
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.Apartment), $"apartment not found, {testAddress.Apartment}");
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.Country), $"country not found, {testAddress.Country}");
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.Postal), $"postal not found, {testAddress.Postal}");
            Assert.IsTrue(actualDefaultAddress.Contains(testAddress.StateProvinceRegion), $"state not found, {testAddress.StateProvinceRegion}");

            bool userTileExist = addressesHome.DefaultTileExist(AccessLevel.User);

            Assert.IsFalse(userTileExist, "default user level tile is already present");
        }
示例#4
0
        public void DesignateUserAddressAsDefault()
        {
            var          testUser = DataFactory.Users.CreateTestUser();
            AddressModel testData = new AddressModel
            {
                country     = "US",
                street      = "elm street",
                city        = "elm city",
                CompanyName = "KDA",
                postal      = "22800",
                state       = "CO"
            };

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

            indexPage = loginPage.Login(testUser.Username, 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.City, testData.city);
            createAddressPage.SetInputValue(AddressInputs.State, testData.state);
            createAddressPage.SetInputValue(AddressInputs.Postal, testData.postal);

            addressesHome = createAddressPage.ClickOnSubmit();

            addressesHome.InformationModal.ClickOnClose();

            addressesHome.ClickOnAddressInDropdown(AccessLevel.User, testData);
            addressesHome.ContentModal.ClickOnMakeDefault();

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

            addressesHome.InformationModal.ClickOnClose();

            bool   defaultLabelExist    = addressesHome.IsDefaultLabelPresentOnDropdownItem(AccessLevel.User);
            string actualDefaultAddress = addressesHome.GetDefaultTileAddressData(AccessLevel.User);

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

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

            bool accountTileExist = addressesHome.DefaultTileExist(AccessLevel.Account);

            Assert.IsFalse(accountTileExist, "default account level tile is already present");
        }