Beispiel #1
0
        public void AddContactToGroup()
        {
            Class3_ContactData contact;

            app.Contacts.ContactExist();
            app.Groups.GroupExist();

            Class2_GroupData          group   = Class2_GroupData.GetAllGroupInfo()[0];
            List <Class3_ContactData> oldList = group.GetContacts();

            if (Class2_GroupData.GetAllGroupInfo().Count == oldList.Count)
            {
                contact = new Class3_ContactData("new", "contact");
                app.Contacts.CreateContact(contact);
            }

            contact = Class3_ContactData.GetAllContactInfo()
                      .Except(oldList).First();

            app.Contacts.AddContactToGroup(contact, group);

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

            oldList.Add(contact);
            oldList.Sort();
            newList.Sort();
            Assert.AreEqual(oldList, newList);
        }
Beispiel #2
0
        public void ContactInfoPropertyToEdit()
        {
            Class3_ContactData fromProperty = app.Contacts.GetContactInformationFromProperty(0);
            Class3_ContactData fromForm     = app.Contacts.GetContactInformationFromEditForm(0, true);

            Assert.AreEqual(fromProperty.ContactInfo, fromForm.ContactInfo);
        }
Beispiel #3
0
        public void RemoveContactToGroup()
        {
            Class3_ContactData contact;

            app.Contacts.ContactExist();
            app.Groups.GroupExist();

            Class2_GroupData group = Class2_GroupData.GetAllGroupInfo()
                                     .Find(x => x.Name.Contains("NewTest"));

            if (group == null)
            {
                group = Class2_GroupData.GetAllGroupInfo()[0];
            }

            List <Class3_ContactData> oldList = group.GetContacts();

            if (group.GetContacts().Count == 0)
            {
                contact = Class3_ContactData.GetAllContactInfo()[0];
                app.Contacts.AddContactToGroup(contact, group);
            }
            else
            {
                contact = oldList[0];
            }

            app.Contacts.RemoveContactFromGroup(contact, group);
            List <Class3_ContactData> newList = group.GetContacts();

            oldList.Remove(contact);
            oldList.Sort();
            newList.Sort();
            Assert.AreEqual(oldList, newList);
        }
 public ContactHelper CreateContact(Class3_ContactData contact)
 {
     InitAddContact();
     FillContactData(contact)
     .AddContactSubmit();
     manager.Navigator.HomePage();
     return(this);
 }
 public void RemoveContactFromGroup(Class3_ContactData contact, Class2_GroupData group)
 {
     manager.Navigator.HomePage();
     SelectGroup(group.Name);
     SelectContactId2(contact.Id);
     RemoveContactToGroup();
     new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until
         (d => d.FindElements(By.CssSelector("div.msgbox")).Count > 0);
 }
        public void ModifyContact(Class3_ContactData contact, Class3_ContactData data)
        {
            manager.Navigator.HomePage();
            ContactExist();
            EditContactDB(contact.Id)

            .FillContactData(data)
            .UpdateContact();
        }
Beispiel #7
0
        public void ContactInfoHomeToEdit()
        {
            Class3_ContactData fromTable = app.Contacts.GetContactInformationFromTable(0);
            Class3_ContactData fromForm  = app.Contacts.GetContactInformationFromEditForm(0, false);

            Assert.AreEqual(fromTable, fromForm);
            Assert.AreEqual(fromTable.Address, fromForm.Address);
            Assert.AreEqual(fromTable.AllPhones, fromForm.AllPhones);
            Assert.AreEqual(fromTable.AllEmails, fromForm.AllEmails);
        }
 public void AddContactToGroup(Class3_ContactData contact, Class2_GroupData group)
 {
     manager.Navigator.HomePage();
     ClearGroupFilter();
     SelectContactId2(contact.Id);
     SelectGroupToAdd(group.Name);
     CommitAddingContactToGroup();
     new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until
         (d => d.FindElements(By.CssSelector("div.msgbox")).Count > 0);
 }
 public void RemoveContactDB(Class3_ContactData contact)
 {
     manager.Navigator.HomePage();
     SelectContactId(contact.Id)
     .DeleteSelectedContact();
     driver.SwitchTo().Alert().Accept();
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
     driver.FindElement(By.CssSelector("div.msgbox"));
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
     manager.Navigator.HomePage();
 }
Beispiel #10
0
 public void CompareContactUI_DB()
 {
     if (PERFORM_LONG_UI_CHECKS)
     {
         List <Class3_ContactData> fromUI = app.Contacts.GetContactsList();
         List <Class3_ContactData> fromDB = Class3_ContactData.GetAllContactInfo();
         fromUI.Sort();
         fromDB.Sort();
         Assert.AreEqual(fromUI, fromDB);
     }
 }
        public void TheAddContactTest(Class3_ContactData contact)
        {
            List <Class3_ContactData> oldContact = Class3_ContactData.GetAllContactInfo();

            app.Contacts.CreateContact(contact);
            List <Class3_ContactData> newContact = Class3_ContactData.GetAllContactInfo();

            oldContact.Add(contact);
            oldContact.Sort();
            newContact.Sort();
            Assert.AreEqual(oldContact, newContact);
        }
 public void ContactExist()
 {
     if (IsElementPresent(By.CssSelector("img[alt=\"Edit\"]")))
     {
     }
     else
     {
         Class3_ContactData ifcontact = new Class3_ContactData("Petya", "Dude");
         ifcontact.MobilePhone = "+791111111";
         CreateContact(ifcontact);
     };
 }
Beispiel #13
0
        public void RemoveContactTest()
        {
            app.Contacts.ContactExist();
            List <Class3_ContactData> oldContact  = Class3_ContactData.GetAllContactInfo();
            Class3_ContactData        toBeRemoved = oldContact[0];

            app.Contacts.RemoveContactDB(toBeRemoved);
            List <Class3_ContactData> newContact = Class3_ContactData.GetAllContactInfo();

            oldContact.RemoveAt(0);
            oldContact.Sort();
            newContact.Sort();
            Assert.AreEqual(oldContact, newContact);
        }
Beispiel #14
0
        public void ModifyContactTest()
        {
            Class3_ContactData data = new Class3_ContactData("Croopper", null);

            data.Firstname   = "Croopper";
            data.Lastname    = null;
            data.MobilePhone = null;
            List <Class3_ContactData> oldContact = Class3_ContactData.GetAllContactInfo();

            app.Contacts.ModifyContact(oldContact[0], data);
            List <Class3_ContactData> newContact = Class3_ContactData.GetAllContactInfo();

            oldContact[0].Firstname = data.Firstname;
            oldContact.Sort();
            newContact.Sort();
            Assert.AreEqual(oldContact, newContact);
        }
 /*
  * public int GetNumberOfSearchResult()
  * {
  * manager.Navigator.HomePage();
  * string text = driver.FindElement(By.TagName("label")).Text;
  * Match m = new Regex(@"\d+").Match(text);
  * return Int32.Parse(m.Value);
  * }
  */
 public ContactHelper FillContactData(Class3_ContactData contact)
 {
     Type(By.Name("firstname"), contact.Firstname);
     Type(By.Name("middlename"), contact.Middlename);
     Type(By.Name("lastname"), contact.Lastname);
     Type(By.Name("nickname"), contact.Nickname);
     Type(By.Name("title"), contact.Title);
     Type(By.Name("company"), contact.Company);
     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("fax"), contact.Fax);
     Type(By.Name("email"), contact.Email);
     Type(By.Name("email2"), contact.Email2);
     Type(By.Name("homepage"), contact.Homepage);
     Type(By.Name("bday"), contact.Bday);
     Type(By.Name("bmonth"), contact.Bmonth);
     Type(By.Name("Byear"), contact.Byear);
     Type(By.Name("phone2"), contact.Phone2);
     Type(By.Name("notes"), contact.Notes);
     return(this);
 }