예제 #1
0
        public void TestRemovingContactFromGroup()
        {
            //if a group is present
            if (!app.Groups.IsGroupPresent())
            {
                GroupData newGroup = new GroupData("test1");
                newGroup.Header = "header";
                newGroup.Footer = "footer";

                app.Groups.Create(newGroup);
            }

            //if a contact NOT present
            if (!app.Contacts.IsContactPresent())
            {
                ContactData newContact = new ContactData("sss", "ddd");
                app.Contacts.Create(newContact);
            }

            GroupData group = GroupData.GetAll()[0];

            app.Contacts.AddAllContactsToGroup(group);

            List <ContactData> oldList = group.GetContacts();
            ContactData        contact = ContactData.GetAll()[0];

            //actions
            app.Contacts.RemoveContactFromGroup(contact, group);

            List <ContactData> newList = group.GetContacts();

            oldList.Remove(contact);
            oldList.Sort();
            newList.Sort();
            Assert.AreEqual(oldList, newList);
        }
        public void ContactModificationTest()

        {
            List <ContactData> OldContacts = app.Contacts.GetContactList();

            if (OldContacts.Count == 0)
            {
                ContactData contact = new ContactData("Ася");
                contact.Middlename = "Павлова";
                contact.Lastname   = "Хомякова";
                contact.Title      = "Задание 4";
                contact.Address    = "Москва, ул.Вавилова 55";
                contact.Mobile     = "9252583243";
                contact.Email      = "*****@*****.**";
                contact.Bday       = "16";
                contact.Bmonth     = "January";
                contact.Byear      = "1900";

                app.Contacts.Create(contact);
            }


            ContactData newData = new ContactData("Анна-Мария");

            newData.Middlename = "null";
            newData.Lastname   = "null";
            newData.Title      = "null";
            newData.Address    = "null";
            newData.Mobile     = "null";
            newData.Email      = "null";
            newData.Bday       = "-";
            newData.Bmonth     = "-";
            newData.Byear      = "null";

            app.Contacts.Modify("1", newData);
        }
예제 #3
0
        public void ContactModifyTest()
        {
            ContactData newData = new ContactData("First name4", "Last Name4", "Address company4");

            newData.Middlename = "Middle name2";
            newData.Nickname   = "Nickname2";
            newData.Photo      = "";
            newData.Title      = "Title2";
            newData.Company    = "Company2";
            newData.Address    = "Address company2";
            newData.Telhome    = "Tel home2";
            newData.Telmobile  = "Tel mobile2";
            newData.Telwork    = "Tel work2";
            newData.Telfax     = "Tel fax2";
            newData.Email1     = "email12";
            newData.Email2     = "email22";
            newData.Email3     = "email32";
            newData.Homepage   = "homepage";
            newData.Bday       = "2";
            newData.Bmonth     = "January";
            newData.Byear      = "1989";
            newData.Aday       = "2";
            newData.Amonth     = "January";
            newData.Ayear      = "2009";
            newData.Address2   = "adress sec2";
            newData.Phone2     = "home sec2";
            newData.Notes      = "notes sec2";

            int num = 0;

            if (!app.Contacts.ContactExists(num))
            {
                ContactData contact1 = new ContactData("Default", "Default", "Default");
                app.Contacts.Create(contact1);
                num = 0;
            }

            List <ContactData> oldContacts = ContactData.GetAll();

            oldContacts.Sort();
            ContactData oldData = oldContacts[num];

            oldContacts[num].Firstname = newData.Firstname;
            oldContacts[num].Lastname  = newData.Lastname;
            oldContacts[num].Address   = newData.Address;
            oldContacts.Sort();

            app.Contacts.Modify(num, newData);
            Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactCount());
            List <ContactData> newContacts = ContactData.GetAll();

            newContacts.Sort();

            //Assert.AreEqual(oldContacts, newContacts);
            foreach (ContactData contact in newContacts)
            {
                if (contact.Id == oldData.Id)
                {
                    Assert.AreEqual(newData.Firstname, contact.Firstname);
                    Assert.AreEqual(newData.Lastname, contact.Lastname);
                    Assert.AreEqual(newData.Address, contact.Address);
                }
            }
        }
        public ContactData GetContactInformationFromTable(int index)
        {
            ContactData cc = new ContactData();

            return(cc);
        }
예제 #5
0
 public ContactHelper FillContactForm(ContactData contact)
 {
     Type(By.Name("firstname"), contact.Firstname);
     Type(By.Name("lastname"), contact.Lastname);
     return(this);
 }
예제 #6
0
 public ContactHelper FillContact(ContactData entryData)
 {
     Type(By.Name("firstname"), entryData.Firstname);
     Type(By.Name("lastname"), entryData.Lastname);
     return(this);
 }
예제 #7
0
        public string GetContactString(ContactData contact)
        {
            string total = "";

            if (contact.Firstname != null && contact.Firstname != "")
            {
                total += contact.Firstname;
                if (contact.Lastname != null && contact.Lastname != "")
                {
                    total += " ";
                }
                else
                {
                    if ((contact.Address != null && contact.Address != "") ||
                        (contact.AllPhonesWithPrefix != null && contact.AllPhonesWithPrefix != "") ||
                        (contact.AllEmails != null && contact.AllEmails != ""))
                    {
                        total += "\r\n";
                    }
                }
            }

            if (contact.Lastname != null && contact.Lastname != "")
            {
                total += contact.Lastname;
                if ((contact.Address != null && contact.Address != "") ||
                    (contact.AllPhonesWithPrefix != null && contact.AllPhonesWithPrefix != "") ||
                    (contact.AllEmails != null && contact.AllEmails != ""))
                {
                    total += "\r\n";
                }
            }

            if (contact.Address != null && contact.Address != "")
            {
                total += contact.Address;
                if ((contact.AllPhonesWithPrefix != null && contact.AllPhonesWithPrefix != "") ||
                    (contact.AllEmails != null && contact.AllEmails != ""))
                {
                    total += "\r\n";
                }
            }

            if (contact.AllPhonesWithPrefix != null && contact.AllPhonesWithPrefix != "")
            {
                if ((contact.Firstname != null && contact.Firstname != "") ||
                    (contact.Lastname != null && contact.Lastname != "") ||
                    (contact.Address != null && contact.Address != ""))
                {
                    total += "\r\n";
                }
                total += contact.AllPhonesWithPrefix;
                if (contact.AllEmails != null && contact.AllEmails != "")
                {
                    total += "\r\n";
                }
                else
                {
                    total = total.Trim();
                }
            }

            if (contact.AllEmails != null && contact.AllEmails != "")
            {
                if ((contact.Firstname != null && contact.Firstname != "") ||
                    (contact.Lastname != null && contact.Lastname != "") ||
                    (contact.Address != null && contact.Address != "") ||
                    (contact.AllPhonesWithPrefix != null && contact.AllPhonesWithPrefix != ""))
                {
                    total += "\r\n";
                }
                total += contact.AllEmails.Trim();
            }
            return(total);
        }
예제 #8
0
 public string ConvertContactDataToString(ContactData contact)
 {
     return(GetContactString(contact));
 }
예제 #9
0
 public List <ContactData> ModifyContactNumberInList(List <ContactData> contactListPrev, int contactNumberToModify, ContactData data)
 {
     return(ModifyGroupNumberInList(contactListPrev, contactNumberToModify, data, RemoveValuesWhichArentShownInGroupList));;
 }
예제 #10
0
 protected void FillContactForm(ContactData contact)
 {
     driver.FindElement(By.Name("firstname")).Click();
     driver.FindElement(By.Name("firstname")).Clear();
     driver.FindElement(By.Name("firstname")).SendKeys(contact.Firstname);
     driver.FindElement(By.Name("middlename")).Click();
     driver.FindElement(By.Name("middlename")).Clear();
     driver.FindElement(By.Name("middlename")).SendKeys(contact.Middlename);
     driver.FindElement(By.Name("lastname")).Click();
     driver.FindElement(By.Name("lastname")).Clear();
     driver.FindElement(By.Name("lastname")).SendKeys(contact.Lastname);
     driver.FindElement(By.Name("title")).Click();
     driver.FindElement(By.Name("nickname")).Click();
     driver.FindElement(By.Name("nickname")).Clear();
     driver.FindElement(By.Name("nickname")).SendKeys(contact.Lastname);
     driver.FindElement(By.Name("photo")).Click();
     driver.FindElement(By.Name("photo")).Clear();
     driver.FindElement(By.Name("photo")).SendKeys(contact.Photo);
     driver.FindElement(By.Name("title")).Click();
     driver.FindElement(By.Name("title")).Clear();
     driver.FindElement(By.Name("title")).SendKeys(contact.Title);
     driver.FindElement(By.Name("theform")).Click();
     driver.FindElement(By.Name("company")).Click();
     driver.FindElement(By.Name("company")).Clear();
     driver.FindElement(By.Name("company")).SendKeys(contact.Company);
     driver.FindElement(By.Name("address")).Click();
     driver.FindElement(By.Name("address")).Clear();
     driver.FindElement(By.Name("address")).SendKeys(contact.Address);
     driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Address:'])[1]/following::label[1]")).Click();
     driver.FindElement(By.Name("home")).Click();
     driver.FindElement(By.Name("home")).Clear();
     driver.FindElement(By.Name("home")).SendKeys(contact.Home);
     driver.FindElement(By.Name("mobile")).Click();
     driver.FindElement(By.Name("mobile")).Clear();
     driver.FindElement(By.Name("mobile")).SendKeys(contact.Mobile);
     driver.FindElement(By.Name("work")).Click();
     driver.FindElement(By.Name("work")).Clear();
     driver.FindElement(By.Name("work")).SendKeys(contact.Work);
     driver.FindElement(By.Name("fax")).Click();
     driver.FindElement(By.Name("fax")).Clear();
     driver.FindElement(By.Name("fax")).SendKeys(contact.Fax);
     driver.FindElement(By.Name("email")).Click();
     driver.FindElement(By.Name("email")).Clear();
     driver.FindElement(By.Name("email")).SendKeys(contact.Email);
     driver.FindElement(By.Name("email2")).Click();
     driver.FindElement(By.Name("email2")).Clear();
     driver.FindElement(By.Name("email2")).SendKeys(contact.Email2);
     driver.FindElement(By.Name("email3")).Click();
     driver.FindElement(By.Name("email3")).Clear();
     driver.FindElement(By.Name("email3")).SendKeys(contact.Email3);
     driver.FindElement(By.Name("homepage")).Click();
     driver.FindElement(By.Name("homepage")).Clear();
     driver.FindElement(By.Name("homepage")).SendKeys(contact.Homepage);
     driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Birthday:'])[1]/following::label[1]")).Click();
     driver.FindElement(By.Name("bday")).Click();
     new SelectElement(driver.FindElement(By.Name("bday"))).SelectByText(contact.Bday);
     driver.FindElement(By.Name("bday")).Click();
     driver.FindElement(By.Name("bmonth")).Click();
     new SelectElement(driver.FindElement(By.Name("bmonth"))).SelectByText(contact.Bmonth);
     driver.FindElement(By.Name("bmonth")).Click();
     driver.FindElement(By.Name("byear")).Click();
     driver.FindElement(By.Name("byear")).Clear();
     driver.FindElement(By.Name("byear")).SendKeys(contact.Byear);
     driver.FindElement(By.Name("aday")).Click();
     new SelectElement(driver.FindElement(By.Name("aday"))).SelectByText(contact.Aday);
     driver.FindElement(By.Name("aday")).Click();
     driver.FindElement(By.Name("amonth")).Click();
     new SelectElement(driver.FindElement(By.Name("amonth"))).SelectByText(contact.Amonth);
     driver.FindElement(By.Name("amonth")).Click();
     driver.FindElement(By.Name("ayear")).Click();
     driver.FindElement(By.Name("ayear")).Clear();
     driver.FindElement(By.Name("ayear")).SendKeys(contact.Ayear);
     driver.FindElement(By.Name("address2")).Click();
     driver.FindElement(By.Name("address2")).Clear();
     driver.FindElement(By.Name("address2")).SendKeys(contact.Address2);
     driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Address:'])[2]/following::label[1]")).Click();
     driver.FindElement(By.Name("phone2")).Click();
     driver.FindElement(By.Name("phone2")).Clear();
     driver.FindElement(By.Name("phone2")).SendKeys(contact.Phone2);
     driver.FindElement(By.Name("notes")).Click();
     driver.FindElement(By.Name("notes")).Clear();
     driver.FindElement(By.Name("notes")).SendKeys(contact.Notes);
     driver.FindElement(By.XPath("(.//*[normalize-space(text()) and normalize-space(.)='Notes:'])[1]/following::input[1]")).Click();
 }
        public void ContactModificationTest()
        {
            ContactData newContact = new ContactData("Up_First", "Up_Middle", "Up_Last", "Up_Nickname", "Up_Title", "Up_Company", "Up_Address", new PhoneForContact("00555", "00666", "00777", "00123-456"), new SecondaryInfoForContact("Up_address2", "Up_number", "Up_notes"));

            app.Contacts.Modify(1, newContact);
        }
예제 #12
0
        public ContactHelper ContactData(ContactData contact)
        {
            Type(By.Name("firstname"), contact.FirstName);
            Type(By.Name("middlename"), contact.MiddleName);
            Type(By.Name("lastname"), contact.LastName);
            Type(By.Name("address"), contact.Address);
            Type(By.Name("home"), contact.HomePhone);
            Type(By.Name("mobile"), contact.MobilePhone);
            Type(By.Name("work"), contact.WorkPhone);
            Type(By.Name("email"), contact.Email);
            Type(By.Name("email2"), contact.Email2);
            Type(By.Name("email3"), contact.Email3);

            /*driver.FindElement(By.Name("nickname")).Click();
             * driver.FindElement(By.Name("nickname")).Clear();
             * driver.FindElement(By.Name("nickname")).SendKeys("nick");
             * driver.FindElement(By.Name("title")).Click();
             * driver.FindElement(By.Name("title")).Clear();
             * driver.FindElement(By.Name("title")).SendKeys("title");
             * driver.FindElement(By.Name("company")).Click();
             * driver.FindElement(By.Name("company")).Clear();
             * driver.FindElement(By.Name("company")).SendKeys("company");
             * driver.FindElement(By.Name("fax")).Click();
             * driver.FindElement(By.Name("fax")).Clear();
             * driver.FindElement(By.Name("fax")).SendKeys("0293847");
             * driver.FindElement(By.Name("homepage")).Click();
             * driver.FindElement(By.Name("homepage")).Clear();
             * driver.FindElement(By.Name("homepage")).SendKeys("site.ru");
             * driver.FindElement(By.Name("bday")).Click();
             * new SelectElement(driver.FindElement(By.Name("bday"))).SelectByText("16");
             * driver.FindElement(By.Name("bday")).Click();
             * driver.FindElement(By.Name("bmonth")).Click();
             * new SelectElement(driver.FindElement(By.Name("bmonth"))).SelectByText("January");
             * driver.FindElement(By.Name("bmonth")).Click();
             * driver.FindElement(By.Name("byear")).Click();
             * driver.FindElement(By.Name("byear")).Clear();
             * driver.FindElement(By.Name("byear")).SendKeys("1987");
             * driver.FindElement(By.Name("aday")).Click();
             * new SelectElement(driver.FindElement(By.Name("aday"))).SelectByText("16");
             * driver.FindElement(By.Name("aday")).Click();
             * driver.FindElement(By.Name("amonth")).Click();
             * new SelectElement(driver.FindElement(By.Name("amonth"))).SelectByText("January");
             * driver.FindElement(By.Name("amonth")).Click();
             * driver.FindElement(By.Name("ayear")).Click();
             * driver.FindElement(By.Name("ayear")).Clear();
             * driver.FindElement(By.Name("ayear")).SendKeys("1111");
             * driver.FindElement(By.Name("new_group")).Click();
             * driver.FindElement(By.Name("new_group")).Click();
             * driver.FindElement(By.Name("new_group")).Click();
             * new SelectElement(driver.FindElement(By.Name("new_group"))).SelectByText("Gr-name");
             * driver.FindElement(By.Name("new_group")).Click();
             * driver.FindElement(By.Name("new_group")).Click();
             * new SelectElement(driver.FindElement(By.Name("new_group"))).SelectByText("[none]");
             * driver.FindElement(By.Name("new_group")).Click();
             * driver.FindElement(By.Name("address2")).Click();
             * driver.FindElement(By.Name("address2")).Clear();
             * driver.FindElement(By.Name("address2")).SendKeys("second addresssss");
             * driver.FindElement(By.Name("phone2")).Click();
             * driver.FindElement(By.Name("phone2")).Clear();
             * driver.FindElement(By.Name("phone2")).SendKeys("home");
             * driver.FindElement(By.Name("notes")).Click();
             * driver.FindElement(By.Name("notes")).Clear();
             * driver.FindElement(By.Name("notes")).SendKeys("notes");*/
            return(this);
        }
예제 #13
0
 public int GetContactCount()
 {
     return(ContactData.GetAll().Count); //driver.FindElements(By.Name("entry")).Count;
 }
 public void TestContactInformation()
 {
     ContactData fromTable = app.Contacts.GetContactInformationFromTable(0);
     ContactData fromForm  = app.Contacts.GetContactInformationFromForm(0);
 }