public ContactHelper FillContactForm(ContactData contact) { Type(By.Name("firstname"), contact.Userfirstname); Type(By.Name("middlename"), contact.Usermiddlename); Type(By.Name("lastname"), contact.Userlastname); Type(By.Name("nickname"), contact.Usernickname); Type(By.Name("title"), contact.Usertitle); Type(By.Name("company"), contact.Usercompany); Type(By.Name("address"), contact.Useraddress); Type(By.Name("home"), contact.Userhome); Type(By.Name("mobile"), contact.Usermobile); Type(By.Name("work"), contact.Userwork); Type(By.Name("fax"), contact.Userfax); Type(By.Name("email"), contact.Useremail); Type(By.Name("email2"), contact.Useremail2); Type(By.Name("email3"), contact.Useremail3); Type(By.Name("homepage"), contact.Userhomepage); Type(By.Name("byear"), contact.Userbyear); Type(By.Name("ayear"), contact.Userayear); Type(By.Name("address2"), contact.Useraddress2); Type(By.Name("phone2"), contact.Userphone2); Type(By.Name("notes"), contact.Usernotes); return(this); }
public void TestRemovingContactFromGroup() { app.Groups.GroupIsPresent(); app.Contacts.ContactIsPresent(); GroupData group = GroupData.GetAll()[0]; List <ContactData> oldList = group.GetContacts(); ContactData contact = ContactData.GetAll().Except(oldList).First(); if (group.GetContacts().Count() == 0) { app.Contacts.AddContactToGroup(contact, group); } app.Contacts.RemoveContactFromGroup(contact, group); List <ContactData> newList = group.GetContacts(); oldList.Remove(contact); newList.Sort(); oldList.Sort(); Assert.AreEqual(oldList, newList); }
public void ContactModificationTest() { ContactData newContact = new ContactData("Petr", "Petrov"); app.Contacts.IfNeedToCreate(); List <ContactData> oldContacts = ContactData.GetAll(); ContactData modificationContact = oldContacts[0]; app.Contacts.Modify(modificationContact, newContact); List <ContactData> newContacts = ContactData.GetAll(); oldContacts[0].Firstname = newContact.Firstname; oldContacts[0].Lastname = newContact.Lastname; oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData contact in newContacts) { if (contact.Equals(modificationContact)) { Assert.AreEqual(contact, modificationContact); } } }
//добавить один контакт в группу public void TestAddingContactToGroup_AddOne() { GroupData group = GroupData.GetAll()[0]; List <ContactData> oldList = group.GetContacts(); List <ContactData> contact = new List <ContactData>(); IEnumerable <ContactData> exceptResult = ContactData.GetAll().Except(group.GetContacts()); if (exceptResult.Count() != 0) { contact.Add(ContactData.GetAll().Except(group.GetContacts()).First()); app.Contacts.AddSelectedContactsToGroup(contact, group); oldList.Add(contact[0]); List <ContactData> newList = group.GetContacts(); oldList.Sort(); newList.Sort(); Assert.AreEqual(oldList, newList); } else { Console.Out.Write("Группа " + group.Name + " (id=" + group.Id + ") уже содержит все существующие контакты"); } }
public void ContactRemovalTest() { //проверка на наличие контакта app.Contacts.CreateIfContactNotCreated(0); //создаем список со старыми данными и удаляем контакт List <ContactData> oldContacts = ContactData.GetAll(); ContactData toBeRemoved = oldContacts[0]; app.Contacts.RemoveById(toBeRemoved); //осуществляем проверки, что удалился старый контакт Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount()); List <ContactData> newContacts = ContactData.GetAll(); oldContacts.RemoveAt(0); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData cont in newContacts) { Assert.AreNotEqual(cont.Id, toBeRemoved.Id); } }
public void ContactRemovaltest() { app.Navigator.OpenHomePage(); app.Contacts.CheckContactExistance(); List <ContactData> oldContacts = ContactData.GetAll(); ContactData tobeRemoved = oldContacts[0]; app.Contacts.RemoveContact(tobeRemoved); Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount()); List <ContactData> newContacts = ContactData.GetAll(); oldContacts.RemoveAt(0); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData contact in newContacts) { Assert.AreNotEqual(contact.Id, tobeRemoved.Id); Assert.AreNotEqual(contact.Firstname, tobeRemoved.Firstname); Assert.AreNotEqual(contact.Lastname, tobeRemoved.Lastname); } }
public void ContactRemovalTest() { app.Contacts.PrepareContact(); List <ContactData> oldContacts = app.Contacts.GetContactList(); app.Contacts.Remove(0); int exp = oldContacts.Count - 1; int act = app.Contacts.GetContactCount(); Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount()); List <ContactData> newContacts = app.Contacts.GetContactList(); ContactData toBeRemoved = oldContacts[0]; oldContacts.RemoveAt(0); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData contact in newContacts) { Assert.AreNotEqual(contact.Id, toBeRemoved.Id); } }
public void TestAddingContactToGroup() { //проверка наличия хотя бы одного контакта if (app.Contact.CheckContact() == false) { app.Contact.Create(new ContactData(GenerateRandomString(30), GenerateRandomString(30))); } // проверка наличия хотя бы одной группы if (app.Group.CheckGroup() == false) { app.Group.Create(new GroupData(GenerateRandomString(30))); } GroupData group = GroupData.GetAll()[0]; // берем первую попавшуся группу List <ContactData> oldList = group.GetContacts(); // получаем список контактов, входящих в нее // проверка на то, что если все контакты уже в группе, то создать новый контакт int i = ContactData.GetAll().Except(oldList).Count(); if (i == 0) { app.Contact.Create(new ContactData(GenerateRandomString(30), GenerateRandomString(30))); } ContactData contact = ContactData.GetAll().Except(oldList).First(); // получаем список контактов, не входящих в нее app.Contact.AddContactToGroup(contact, group); List <ContactData> newList = group.GetContacts(); oldList.Add(contact); newList.Sort(); oldList.Sort(); Assert.AreEqual(oldList, newList); }
public void ContactModificationTest() { //preparate if (app.Contacts.GetContactCount() == 0) { app.Contacts.Create(new ContactData("", "")); } List <ContactData> oldContacts = ContactData.GetAll(); ContactData oldData = oldContacts[0]; //action ContactData newData = new ContactData("Update FirstName", "Update LastName"); newData.Id = oldData.Id; newData.MiddleName = "Update MiddleName"; app.Contacts.Modify(newData); //varification app.Navigator.GoToHomePage(); Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactCount()); List <ContactData> newContacts = ContactData.GetAll(); oldContacts[0].FirstName = newData.FirstName; oldContacts[0].LastName = newData.LastName; oldContacts.Sort(); 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); } } }
public void ContactModificationTestDetailsBottom() { int index = 1; ContactData contact = new ContactData("Сергей", "Сергеев"); //contact.Address2 = "Ьщсква"; //contact.Bmonth = "May"; //contact.Amonth = "June"; app.Contacts.IsContactPresent(index, app.Contacts.byDetails, contact); //List<ContactData> oldContacts = app.Contacts.GetContactList(); List <ContactData> oldContacts = ContactData.GetAll(); ContactData oldData = oldContacts[index]; app.Contacts.ModifyViaDetails(index, contact, 2); Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactCount()); //List<ContactData> newContacts = app.Contacts.GetContactList(); List <ContactData> newContacts = ContactData.GetAll(); oldContacts[index].Firstname = contact.Firstname; oldContacts[index].Lastname = contact.Lastname; oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); foreach (ContactData newData in newContacts) { if (newData.Id == oldData.Id) { Assert.AreEqual(contact.Firstname, newData.Firstname); Assert.AreEqual(contact.Lastname, newData.Lastname); } } }
public void TestAddingContactToGroup() { app.Contacts.CreateContactInDB(new ContactData { FirstName = "Not in group", LastName = "Not in group", }); var group = GroupData.GetAll()[0]; var oldList = group.GetContacts(); var contact = ContactData.GetAll().Except(oldList).First(); app.Contacts.AddContactToGroup(contact, group); var newList = group.GetContacts(); oldList.Add(contact); oldList.Sort(); newList.Sort(); Assert.AreEqual(oldList, newList); }
public void ContactModificationDBTest() { //prepare ContactData createContact = new ContactData("Ivan3", "Ivanov"); app.Contact.IsElementContactAndCreate(createContact); //action ContactData editContact = new ContactData("newIvan3", "newIvanov"); List <ContactData> oldContacts = ContactData.GetAll(); ContactData toBeModification = oldContacts[14]; app.Contact.Modify(toBeModification, editContact); List <ContactData> newContacts = ContactData.GetAll(); oldContacts[14].FirstName = editContact.FirstName; oldContacts[14].LastName = editContact.LastName; oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); }
public ContactHelper Remove(ContactData contact) { SelectContactToEdit(contact.Id); RemoveContact(); return(this); }
public void ContactsModificationTest() { ContactData contact = new ContactData("Test", "Test"); contact.Middlename = "zzz"; contact.Nickname = "zzz"; contact.Image = "D:\\Images\\AVATAR\\86158621245c20cecb12fb.gif"; contact.Title = "zzz"; contact.Company = "zzz"; contact.Address = "zzz"; contact.Home = "zzz"; contact.Mobile = "zzz"; contact.Work = "zzz"; contact.Fax = "zzz"; contact.Email = "zzz"; contact.Email2 = "zzz"; contact.Email3 = "zzz"; contact.Homepage = "zzz"; contact.Bday = "12"; contact.Bmonth = "December"; contact.Byear = "1991"; contact.Aday = "12"; contact.Amonth = "December"; contact.Ayear = "2021"; contact.Address2 = "zzz"; contact.Phone2 = "zzz"; contact.Notes = "zzz"; ContactData newData = new ContactData("John", "Jackson"); newData.Middlename = "zzz"; newData.Nickname = "zzz"; newData.Image = "D:\\Images\\AVATAR\\86158621245c20cecb12fb.gif"; newData.Title = "zzz"; newData.Company = "zzz"; newData.Address = "zzz"; newData.Home = "zzz"; newData.Mobile = "zzz"; newData.Work = "zzz"; newData.Fax = "zzz"; newData.Email = "zzz"; newData.Email2 = "zzz"; newData.Email3 = "zzz"; newData.Homepage = "zzz"; newData.Bday = "12"; newData.Bmonth = "December"; newData.Byear = "1991"; newData.Aday = "12"; newData.Amonth = "December"; newData.Ayear = "2021"; newData.Address2 = "zzz"; newData.Phone2 = "zzz"; newData.Notes = "zzz"; appmanager.Contacts.CreateContactIfAbsent(contact); List <ContactData> oldContacts = ContactData.GetAll(); ContactData tomodify = oldContacts[0]; appmanager.Contacts.Modify(tomodify, newData); List <ContactData> newContacts = ContactData.GetAll(); tomodify.Firstname = newData.Firstname; tomodify.Lastname = newData.Lastname; oldContacts.Sort(); newContacts.Sort(); Assert.AreEqual(oldContacts, newContacts); }
public static List <ContactData> GetContactsNotInGroup(GroupData groupData) { List <ContactData> groupContacts = groupData.GetContacts(); return(ContactData.GetAll().Except(groupContacts).ToList()); }
public void RemoveContactFromGroup(ContactData contact, GroupData group) { throw new NotImplementedException(); }
public ContactHelper Remove(ContactData toBeRemoved) { Select(toBeRemoved.Id); SubmitContactRemoval(); return(this); }
public ContactHelper RemovalById(ContactData contact) { SelectContactById(contact.Id); DeletingContact(); return(this); }
public ContactHelper GoToContactsDetailsPage(ContactData contact) { driver.FindElement(By.XPath("(//a[@href='view.php?id=" + contact.Id + "'])")).Click(); return(this); }
public void ContactModificationsTest() { ContactData newData = new ContactData("Лютомир", "Романов"); app.Contacts.Modify(1, newData); }
public ContactData CreateContact() { ContactData myContact = new ContactData("Arina", "sys", "AKorteleva"); return(this.CreateContact(myContact)); }
public ContactHelper UpdateContact(ContactData newContact) { FillNewContactForm(newContact); ClickUpdate(); return(this); }
public ContactHelper FillContactForm(ContactData contact) { FillContactFormWithoutGroup(contact); TypeSelect(By.Name("new_group"), contact.Newgroup); return(this); }
public string GetContactInformationFormToString(int index) { manager.Navigator.GoToHomePage(); ContactData mainContactInformation = GetContactInformationEditForm(index); mainContactInformation.Nickname = driver.FindElement(By.Name("nickname")).GetAttribute("value"); mainContactInformation.Company = driver.FindElement(By.Name("company")).GetAttribute("value"); mainContactInformation.Middlename = driver.FindElement(By.Name("middlename")).GetAttribute("value"); string firstname = ""; if (mainContactInformation.Firstname != "") { firstname = mainContactInformation.Firstname + " "; } string middlename = ""; if (mainContactInformation.Middlename != "") { middlename = mainContactInformation.Middlename + " "; } string title = driver.FindElement(By.Name("title")).GetAttribute("value"); string homepage = ""; if (driver.FindElement(By.Name("homepage")).GetAttribute("value") != "") { homepage = "Homepage:" + driver.FindElement(By.Name("homepage")).GetAttribute("value"); } //phones handling string homePhone = ""; if (mainContactInformation.HomePhone != "") { homePhone = "H: " + mainContactInformation.HomePhone; } string mobile = ""; if (mainContactInformation.Mobile != "") { mobile = "M: " + mainContactInformation.Mobile; } string workPhone = ""; if (mainContactInformation.WorkPhone != "") { workPhone = "W: " + mainContactInformation.WorkPhone; } string fax = ""; if (driver.FindElement(By.Name("fax")).GetAttribute("value") != "") { fax = "F: " + driver.FindElement(By.Name("fax")).GetAttribute("value"); } string phone2 = ""; if (mainContactInformation.Phone2 != "") { phone2 = "P: " + mainContactInformation.Phone2; } //birthday handling string bday = ""; if (driver.FindElement(By.Name("bday")).FindElement(By.CssSelector("[selected]")).GetAttribute("value") != "0") { bday = driver.FindElement(By.Name("bday")).FindElement(By.CssSelector("[selected]")).GetAttribute("value"); } string bmonth = ""; if (driver.FindElement(By.Name("bmonth")).FindElement(By.CssSelector("[selected]")).GetAttribute("value") != "-") { bmonth = driver.FindElement(By.Name("bmonth")).FindElement(By.CssSelector("[selected]")).GetAttribute("value"); } string byear = ""; if (driver.FindElement(By.Name("byear")).GetAttribute("value") != "") { byear = driver.FindElement(By.Name("byear")).GetAttribute("value"); } string birthday = ""; if ((bday != "") || (bmonth != "") || (byear != "")) { if (bday != "") { bday = bday + ". "; } if (byear != "") { byear = byear + " (" + (DateTime.Now.Year - Int32.Parse(byear)) + ")"; } birthday = "BIRTHDAY " + bday + bmonth.ToUpper() + byear; } //anniversary handling string aday = ""; if (driver.FindElement(By.Name("aday")).FindElement(By.CssSelector("[selected]")).GetAttribute("value") != "0") { aday = driver.FindElement(By.Name("aday")).FindElement(By.CssSelector("[selected]")).GetAttribute("value"); } string amonth = ""; if (driver.FindElement(By.Name("amonth")).FindElement(By.CssSelector("[selected]")).GetAttribute("value") != "-") { amonth = driver.FindElement(By.Name("amonth")).FindElement(By.CssSelector("[selected]")).GetAttribute("value"); } string ayear = ""; if (driver.FindElement(By.Name("ayear")).GetAttribute("value") != "") { ayear = driver.FindElement(By.Name("ayear")).GetAttribute("value"); } string anniversary = ""; if ((aday != "") || (amonth != "") || (ayear != "")) { if (aday != "") { aday = aday + ". "; } if (ayear != "") { ayear = ayear + " (" + (DateTime.Now.Year - Int32.Parse(ayear)) + ")"; } anniversary = "ANNIVERSARY " + aday + amonth.ToUpper() + ayear; } //the rest string address2 = driver.FindElement(By.Name("address2")).GetAttribute("value"); string notes = driver.FindElement(By.Name("notes")).GetAttribute("value"); string summary = firstname + middlename + mainContactInformation.Lastname + mainContactInformation.Nickname + title + mainContactInformation.Company + mainContactInformation.Address + homePhone + mobile + workPhone + fax + mainContactInformation.EMail + mainContactInformation.EMail2 + mainContactInformation.EMail3 + homepage + birthday + anniversary + address2 + phone2 + notes; string summaryShort = summary; return(summaryShort); }
public ContactHelper FillContactForm(ContactData contact) { if (contact.Firstname != null) { driver.FindElement(By.Name("firstname")).Clear(); driver.FindElement(By.Name("firstname")).SendKeys(contact.Firstname); } if (contact.Lastname != null) { driver.FindElement(By.Name("lastname")).Clear(); driver.FindElement(By.Name("lastname")).SendKeys(contact.Lastname); } if (contact.Middlename != null) { driver.FindElement(By.Name("middlename")).Clear(); driver.FindElement(By.Name("middlename")).SendKeys(contact.Middlename); } if (contact.Nickname != null) { driver.FindElement(By.Name("nickname")).Clear(); driver.FindElement(By.Name("nickname")).SendKeys(contact.Nickname); } if (contact.Title != null) { driver.FindElement(By.Name("title")).Clear(); driver.FindElement(By.Name("title")).SendKeys(contact.Title); } if (contact.Company != null) { driver.FindElement(By.Name("company")).Clear(); driver.FindElement(By.Name("company")).SendKeys(contact.Company); } if (contact.Address != null) { driver.FindElement(By.Name("address")).Clear(); driver.FindElement(By.Name("address")).SendKeys(contact.Address); } if (contact.HomePhone != null) { driver.FindElement(By.Name("home")).Clear(); driver.FindElement(By.Name("home")).SendKeys(contact.HomePhone); } if (contact.WorkPhone != null) { driver.FindElement(By.Name("work")).Clear(); driver.FindElement(By.Name("work")).SendKeys(contact.WorkPhone); } if (contact.MobilePhone != null) { driver.FindElement(By.Name("mobile")).Clear(); driver.FindElement(By.Name("mobile")).SendKeys(contact.MobilePhone); } if (contact.Fax != null) { driver.FindElement(By.Name("fax")).Clear(); driver.FindElement(By.Name("fax")).SendKeys(contact.Fax); } if (contact.Email1 != null) { driver.FindElement(By.Name("email")).Clear(); driver.FindElement(By.Name("email")).SendKeys(contact.Email1); } if (contact.Email2 != null) { driver.FindElement(By.Name("email2")).Clear(); driver.FindElement(By.Name("email2")).SendKeys(contact.Email2); } if (contact.Email3 != null) { driver.FindElement(By.Name("email3")).Clear(); driver.FindElement(By.Name("email3")).SendKeys(contact.Email3); } if (contact.Homepage != null) { driver.FindElement(By.Name("homepage")).Clear(); driver.FindElement(By.Name("homepage")).SendKeys(contact.Homepage); } /* // fill birth date=14.06.1984 * new SelectElement(driver.FindElement(By.Name("bday"))).SelectByText("14"); * driver.FindElement(By.XPath("//option[16]")).Click(); * driver.FindElement(By.Name("bmonth")).Click(); * new SelectElement(driver.FindElement(By.Name("bmonth"))).SelectByText("June"); * driver.FindElement(By.XPath("//option[@value='June']")).Click(); * driver.FindElement(By.Name("byear")).Click(); * driver.FindElement(By.Name("byear")).Clear(); * driver.FindElement(By.Name("byear")).SendKeys("1984"); * driver.FindElement(By.Name("aday")).Click();*/ return(this); }
private bool IsContactsExists() { return(ContactData.GetAll().Count != 0); }
public void InitContactModification(ContactData contact) { driver.FindElement(By.XPath("(//a[@href='edit.php?id=" + contact.Id + "'])")).Click(); }
public bool IsContactInGroup(ContactData contact, GroupData group) { List <ContactData> contactsInGroup = group.GetContacts(); return(contactsInGroup.Contains(contact)); }
public ContactHelper FillContactForm(ContactData contact) { Type(By.Name("firstname"), contact.Firstname); Type(By.Name("lastname"), contact.Lastname); return(this); }
public ContactHelper Remove(ContactData contact, int v) { SelectContact(v); RemoveContact(); return(this); }