Esempio n. 1
0
        public AddressHelper Modyfy(int v, AddressData newData)
        {
            if (!IsOnHomePage())
            {
                manager.Navigation.GoToHomePage();
            }
            SelectAddress(v);
            InitAddressModification(0);
            string a = driver.FindElement(By.Name("lastname")).ToString();

            FillAddressData(newData);
            if (a == newData.Lastname)
            {
                driver.FindElement(By.Name("middlename")).SendKeys("1" + a);
            }
            SubmitAddressModification();
            new WebDriverWait(driver, TimeSpan.FromSeconds(10))
            .Until(d => d.FindElements(By.CssSelector("div.msgbox")).Count > 0);
            return(this);
        }
Esempio n. 2
0
        public void AddressRemovalTest()
        {
            AddressData address = new AddressData("Natalia", "Ivanova")
            {
                Middlename     = "Alexander",
                Nickname       = "nataliaivanova49",
                Title          = "Test",
                Company        = "ABC",
                Mobile         = "+79041234567",
                Work           = "88127654321",
                Fax            = "88121726354",
                Email2         = "*****@*****.**",
                Email3         = "*****@*****.**",
                Homepage       = "qqq.com",
                Bday           = "17",
                Bmonth         = "June",
                Byear          = "1985",
                Aday           = "17",
                Amonth         = "June",
                Ayear          = "2025",
                Groupselection = "none",
                Address2       = "1234567 Address2",
                Phone2         = "+79999999999",
                Notes          = "Notes"
            };

            app.Address.RemoveModifyAddressPreparation(address);

            List <AddressData> oldAddress  = AddressData.GetAll();
            AddressData        toBeRemoved = oldAddress[0];

            app.Address.Remove(toBeRemoved);

            List <AddressData> newAddress = AddressData.GetAll();

            oldAddress.RemoveAt(0);
            Assert.AreEqual(oldAddress, newAddress);
        }
Esempio n. 3
0
 public AddressHelper FillAddressForm(AddressData address)
 {
     Type(By.Name("firstname"), address.Firstname);
     Type(By.Name("middlename"), address.Middlename);
     Type(By.Name("lastname"), address.Lastname);
     Type(By.Name("nickname"), address.Nickname);
     PhotoUpload();
     Type(By.Name("title"), address.Title);
     Type(By.Name("company"), address.Company);
     Type(By.Name("address"), address.Address);
     Type(By.Name("home"), address.Home);
     Type(By.Name("mobile"), address.Mobile);
     Type(By.Name("work"), address.Work);
     Type(By.Name("fax"), address.Fax);
     Type(By.Name("email"), address.Email);
     Type(By.Name("email2"), address.Email2);
     Type(By.Name("email3"), address.Email3);
     Type(By.Name("homepage"), address.Homepage);
     driver.FindElement(By.Name("bday")).Click();
     new SelectElement(driver.FindElement(By.Name("bday"))).SelectByText(address.Bday);
     driver.FindElement(By.XPath("//option[@value='17']")).Click();
     new SelectElement(driver.FindElement(By.Name("bmonth"))).SelectByText("June");
     driver.FindElement(By.XPath("//option[@value='June']")).Click();
     Type(By.Name("byear"), address.Byear);
     new SelectElement(driver.FindElement(By.Name("aday"))).SelectByText(address.Aday);
     driver.FindElement(By.XPath("(//option[@value='17'])[2]")).Click();
     new SelectElement(driver.FindElement(By.Name("amonth"))).SelectByText("June");
     driver.FindElement(By.XPath("(//option[@value='June'])[2]")).Click();
     Type(By.Name("ayear"), address.Ayear);
     // SelectElement(driver.FindElement(By.Name("new_group"))).SelectByText("aaa");
     //driver.FindElement(By.XPath("(//option[@value='15'])[3]")).Click();
     Type(By.Name("address2"), address.Address2);
     Type(By.Name("phone2"), address.Phone2);
     Type(By.Name("notes"), address.Notes);
     return(this);
 }
Esempio n. 4
0
        public string FormatDetails(AddressData a)
        {
            string temp = "";

            //1name mname lname\r\
            if (a.Firstname != "")
            {
                temp += a.Firstname;
            }
            if (a.Middlename != "")
            {
                temp += " " + a.Middlename;
            }
            if (a.Lastname != "")
            {
                temp += " " + a.Lastname;
            }
            if (a.Firstname != "" || a.Middlename != "" || a.Lastname != "")
            {
                temp = temp.TrimStart(' ') + @"\r\n";
            }
            //nnname\r\
            if (a.Nickname != "")
            {
                temp += a.Nickname + @"\r\n";
            }
            //title\r\n
            if (a.Title != "")
            {
                temp += a.Title + @"\r\n";
            }
            //companyname\r\n
            if (a.Company != "")
            {
                temp += a.Company + @"\r\n";
            }
            //address\r\n
            if (a.Address != "")
            {
                temp += a.Address + @"\r\n";
            }
            //\r\n
            if (a.Nickname != "" || a.Title != "" || a.Company != "" || a.Address != "")
            {
                temp += @"\r\n";
            }
            //H: 5551\r\n
            if (a.Home != "")
            {
                temp += "H: " + a.Home + @"\r\n";
            }
            //M: 5552\r\n
            if (a.Mobile != "")
            {
                temp += "M: " + a.Mobile + @"\r\n";
            }
            //W: 5553\r\n
            if (a.Work != "")
            {
                temp += "W: " + a.Work + @"\r\n";
            }
            //F: 5554\r\n\r\n
            if (a.Fax != "")
            {
                temp += "F: " + a.Fax + @"\r\n\r\n";
            }
            //[email protected]\r\n
            if (a.Email != "")
            {
                temp += a.Email + @"\r\n";
            }
            //[email protected]\r\n
            if (a.Email2 != "")
            {
                temp += a.Email2 + @"\r\n";
            }
            //[email protected]\r\n
            if (a.Email2 != "")
            {
                temp += a.Email3 + @"\r\n";
            }
            //Homepage:\r\n1.1\r\n\r\n
            if (a.Homepage != "")
            {
                temp += @"Homepage:\r\n" + a.Homepage + @"\r\n";
            }
            //Birthday 1.January 1999(19)\r\n
            if ((a.Bday != "" && a.Bday != "-") || (a.Bmonth != "" && a.Bmonth != "-") || a.Byear != "")
            {
                temp += @"\r\n";
                temp += "Birthday ";
                if (a.Bday != "" && a.Bday != "-")
                {
                    temp += " " + a.Bday + ".";
                }
                if (a.Bmonth != "" && a.Bmonth != "-")
                {
                    temp += " " + a.Bmonth;
                }
                if (a.Byear != "")
                {
                    temp += " " + a.Byear;
                }

                if (a.Byear != "")
                {
                    temp += " (";
                    temp += (DateTime.Today.AddYears(-Convert.ToInt32(a.Byear))).Year;
                    temp += @")";
                }
            }
            //Anniversary 2.February 2000(18)\r\n\r\n
            if ((a.Aday != "" && a.Aday != "-") || (a.Amonth != "" && a.Amonth != "-") || a.Ayear != "")
            {
                temp += @"\r\n";
                temp += "Anniversary";
                if (a.Aday != "" && a.Aday != "-")
                {
                    temp += " " + a.Aday + ".";
                }
                if (a.Amonth != "" && a.Amonth != "-")
                {
                    temp += " " + a.Amonth;
                }
                if (a.Ayear != "")
                {
                    temp += " " + a.Ayear;
                }

                if (a.Ayear != "")
                {
                    temp += " (";
                    temp += (DateTime.Today.AddYears(-Convert.ToInt32(a.Ayear))).Year;
                    temp += @")";
                }
            }
            //address2\r\n\r\n
            if (temp != "" || a.Address2 != "" || a.Phone2 != "" || a.Notes != "")
            {
                temp += @"\r\n";
                if (a.Address2 != "")
                {
                    temp += a.Address2;
                }
                if (a.Phone2 != "")
                {
                    temp += @"\r\n\r\n";
                }
                //P: 5555\r\n\r\n
                if (a.Phone2 != "")
                {
                    temp += "P: " + a.Phone2;
                }
                //hello
                if (a.Notes != "")
                {
                    temp += @"\r\n" + a.Notes;
                }
            }
            return(temp);
        }
Esempio n. 5
0
 public AddressHelper FillAddressData(AddressData addressData)
 {
     Type(By.Name("firstname"), addressData.Firstname);
     if (addressData.Middlename != null)
     {
         driver.FindElement(By.Name("middlename")).Clear();
         driver.FindElement(By.Name("middlename")).SendKeys(addressData.Middlename);
     }
     if (addressData.Lastname != null)
     {
         driver.FindElement(By.Name("lastname")).Clear();
         driver.FindElement(By.Name("lastname")).SendKeys(addressData.Lastname);
     }
     if (addressData.Nickname != null)
     {
         driver.FindElement(By.Name("nickname")).Clear();
         driver.FindElement(By.Name("nickname")).SendKeys(addressData.Nickname);
     }
     if (addressData.Title != null)
     {
         driver.FindElement(By.Name("title")).Clear();
         driver.FindElement(By.Name("title")).SendKeys(addressData.Title);
     }
     if (addressData.Company != null)
     {
         driver.FindElement(By.Name("company")).Clear();
         driver.FindElement(By.Name("company")).SendKeys(addressData.Company);
     }
     if (addressData.Address != null)
     {
         driver.FindElement(By.Name("address")).Clear();
         driver.FindElement(By.Name("address")).SendKeys(addressData.Address);
     }
     if (addressData.Home != null)
     {
         driver.FindElement(By.Name("home")).Clear();
         driver.FindElement(By.Name("home")).SendKeys(addressData.Home);
     }
     if (addressData.Mobile != null)
     {
         driver.FindElement(By.Name("mobile")).Clear();
         driver.FindElement(By.Name("mobile")).SendKeys(addressData.Mobile);
     }
     if (addressData.Work != null)
     {
         driver.FindElement(By.Name("work")).Clear();
         driver.FindElement(By.Name("work")).SendKeys(addressData.Work);
     }
     if (addressData.Fax != null)
     {
         driver.FindElement(By.Name("fax")).Clear();
         driver.FindElement(By.Name("fax")).SendKeys(addressData.Fax);
     }
     if (addressData.Email != null)
     {
         driver.FindElement(By.Name("email")).Clear();
         driver.FindElement(By.Name("email")).SendKeys(addressData.Email);
     }
     if (addressData.Email2 != null)
     {
         driver.FindElement(By.Name("email2")).Clear();
         driver.FindElement(By.Name("email2")).SendKeys(addressData.Email2);
     }
     if (addressData.Email3 != null)
     {
         driver.FindElement(By.Name("email3")).Clear();
         driver.FindElement(By.Name("email3")).SendKeys(addressData.Email3);
     }
     if (addressData.Homepage != null)
     {
         driver.FindElement(By.Name("homepage")).Clear();
         driver.FindElement(By.Name("homepage")).SendKeys(addressData.Homepage);
     }
     if (addressData.Bday != null && addressData.Bmonth != null && addressData.Byear != null)
     {
         new SelectElement(driver.FindElement(By.Name("bday"))).SelectByText(addressData.Bday);
         new SelectElement(driver.FindElement(By.Name("bmonth"))).SelectByText(addressData.Bmonth);
         driver.FindElement(By.Name("byear")).Clear();
         driver.FindElement(By.Name("byear")).SendKeys(addressData.Byear);
     }
     if (addressData.Aday != null && addressData.Amonth != null && addressData.Ayear != null)
     {
         new SelectElement(driver.FindElement(By.Name("aday"))).SelectByText(addressData.Aday);
         new SelectElement(driver.FindElement(By.Name("amonth"))).SelectByText(addressData.Amonth);
         driver.FindElement(By.Name("ayear")).Clear();
         driver.FindElement(By.Name("ayear")).SendKeys(addressData.Ayear);
     }
     if (addressData.Address2 != null)
     {
         driver.FindElement(By.Name("address2")).Clear();
         driver.FindElement(By.Name("address2")).SendKeys(addressData.Address2);
     }
     if (addressData.Phone2 != null)
     {
         driver.FindElement(By.Name("phone2")).Clear();
         driver.FindElement(By.Name("phone2")).SendKeys(addressData.Phone2);
     }
     if (addressData.Notes != null)
     {
         driver.FindElement(By.Name("notes")).Clear();
         driver.FindElement(By.Name("notes")).SendKeys(addressData.Notes);
     }
     return(this);
 }
Esempio n. 6
0
        public void TestAddingAddressToGroup()
        {
            List <GroupData> allGroups = GroupData.GetAll();

            if (allGroups.Count == 0)
            {
                GroupData groupToCreate = new GroupData("zzz");
                groupToCreate.Header = "rrr";
                groupToCreate.Footer = "ccc";

                app.Groups.Create(groupToCreate);
            }

            GroupData          group             = GroupData.GetAll()[0];
            List <AddressData> oldList           = group.GetAddress();
            List <AddressData> allAddress        = AddressData.GetAll();
            List <AddressData> addressNotInGroup = allAddress.FindAll(t => oldList.All(x => x.Id != t.Id));

            if (addressNotInGroup.Count == 0)
            {
                AddressData addressToCreate = new AddressData("qqq", "rrr");
                addressToCreate.Middlename     = "qqq";
                addressToCreate.Nickname       = "qqq";
                addressToCreate.Title          = "qqq";
                addressToCreate.Address        = "qqq";
                addressToCreate.Company        = "qqq";
                addressToCreate.Home           = "qqq";
                addressToCreate.Mobile         = "qqq";
                addressToCreate.Work           = "qqq";
                addressToCreate.Fax            = "qqq";
                addressToCreate.Email          = "qqq" + "@gmail.com";
                addressToCreate.Email2         = "qqq" + "@mail.ru";
                addressToCreate.Email3         = "qqq" + "@yandex.ru";
                addressToCreate.Homepage       = "qqq.com";
                addressToCreate.Bday           = "17";
                addressToCreate.Bmonth         = "June";
                addressToCreate.Byear          = "1985";
                addressToCreate.Aday           = "17";
                addressToCreate.Amonth         = "June";
                addressToCreate.Ayear          = "2025";
                addressToCreate.Groupselection = "none";
                addressToCreate.Address2       = "qqq";
                addressToCreate.Phone2         = "qqq";
                addressToCreate.Notes          = "qqq";
                app.Address.Create(addressToCreate);
                addressNotInGroup.Add(addressToCreate);
            }

            AddressData address = addressNotInGroup.First();


            //actions
            app.Address.AddAddressToGroup(address, group);

            List <AddressData> newList = group.GetAddress();

            oldList.Add(address);
            newList.Sort();
            oldList.Sort();

            Assert.AreEqual(oldList, newList);
        }
Esempio n. 7
0
 public AddressHelper Remove(AddressData address)
 {
     SelectAddress(address.Id);
     RemoveAddress();
     return(this);
 }
        public void AddressModificationTest()
        {
            AddressData newData = new AddressData("aaa", "bbb");

            newData.Middlename = "qqq";
            newData.Nickname   = "qqq";
            newData.Title      = "qqq";
            newData.Company    = "qqq";
            newData.Mobile     = "+111";
            newData.Work       = "111";
            newData.Fax        = "111";
            newData.Email2     = "*****@*****.**";
            newData.Email3     = "*****@*****.**";
            newData.Homepage   = "111.com";
            newData.Bday       = "11";
            newData.Bmonth     = "June";
            newData.Byear      = null;
            newData.Aday       = "11";
            newData.Amonth     = "June";
            newData.Ayear      = null;
            newData.Address2   = null;
            newData.Phone2     = null;
            newData.Notes      = null;

            AddressData address = new AddressData("Natalia", "Ivanova");

            address.Middlename     = "Alexander";
            address.Nickname       = "nataliaivanova49";
            address.Title          = "Test";
            address.Company        = "ABC";
            address.Mobile         = "+79041234567";
            address.Work           = "88127654321";
            address.Fax            = "88121726354";
            address.Email2         = "*****@*****.**";
            address.Email3         = "*****@*****.**";
            address.Homepage       = "qqq.com";
            address.Bday           = "17";
            address.Bmonth         = "June";
            address.Byear          = "1985";
            address.Aday           = "17";
            address.Amonth         = "June";
            address.Ayear          = "2025";
            address.Groupselection = "none";
            address.Address2       = "1234567 Address2";
            address.Phone2         = "++79999999999";
            address.Notes          = "Notes";

            app.Address.RemoveModifyAddressPreparation(address);

            List <AddressData> oldAddress = AddressData.GetAll();

            AddressData toBeRemoved = oldAddress[0];

            app.Address.Modify(toBeRemoved, newData);

            List <AddressData> newAddress = AddressData.GetAll();

            oldAddress[0].Firstname = newData.Firstname;
            oldAddress[0].Lastname  = newData.Lastname;
            oldAddress.Sort();
            newAddress.Sort();
            Assert.AreEqual(oldAddress, newAddress);
        }