public void RemoveContactFromGroup(ContactAttributes contact, GroupAttributes group)
 {
     manager.Navigator.OpenHomePage();
     SelectGroupInFilter(group.NameGroup);
     SelectContact(0);
     RemovalContactsFromGroup();
     new WebDriverWait(driver, TimeSpan.FromSeconds(15)).Until(d => d.FindElements(By.CssSelector("div.msgbox")).Count > 0);
 }
Esempio n. 2
0
        public void TestDetailsContactInformation()
        {
            ContactAttributes fromForm = app.Contacts.GetContactInformationFromEditForm(0);

            string infoForm = app.Contacts.GetContactInformationFromDetailsForm(0);

            Assert.AreEqual(fromForm.AboutContact, infoForm);
        }
 public ContactHelper Remove(ContactAttributes contact)
 {
     manager.Navigator.OpenHomePage();
     SelectContact(contact.Id);
     driver.FindElement(By.XPath("//input[@value='Delete']")).Click();
     driver.SwitchTo().Alert().Accept();
     ReturnHomePageContact();
     return(this);
 }
 public ContactHelper Create(ContactAttributes contact)
 {
     manager.Navigator.OpenHomePage();
     NewContact();
     FillContactForm(contact);
     SubmitContactCreation();
     ReturnHomePageContact();
     return(this);
 }
 public void AddContactToGroup(ContactAttributes contact, GroupAttributes group)
 {
     manager.Navigator.OpenHomePage();
     ClearGroupFilter();
     SelectContact(contact.Id);
     SelctGroupToAdd(group.NameGroup);
     CommitAddingContactToGroup();
     new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(d => d.FindElements(By.CssSelector("div.msgbox")).Count > 0);
 }
 public ContactHelper Modify(int p, ContactAttributes newData)
 {
     manager.Navigator.OpenHomePage();
     ModificationContact(p);
     FillContactForm(newData);
     SubmitContactModification();
     ReturnHomePageContact();
     return(this);
 }
Esempio n. 7
0
        public void TestContactInformation()
        {
            ContactAttributes fromTable = app.Contacts.GetContactInformationFromTable(0);
            ContactAttributes fromForm  = app.Contacts.GetContactInformationFromEditForm(0);

            Assert.AreEqual(fromTable, fromForm);
            Assert.AreEqual(fromTable.Address, fromForm.Address);
            Assert.AreEqual(fromTable.AllEmails, fromForm.AllEmails);
            Assert.AreEqual(fromTable.AllPhones, fromForm.AllPhones);
        }
 public void CompareContactsUI_DB()
 {
     if (PERFORM_LONG_UI_CHECKS)
     {
         List <ContactAttributes> fromUI = app.Contacts.GetContactList();
         List <ContactAttributes> fromDB = ContactAttributes.GetAll();
         fromUI.Sort();
         fromDB.Sort();
         Assert.AreEqual(fromUI, fromDB);
     }
 }
        public ContactHelper AddContact()
        {
            NewContact();
            ContactAttributes newContact = new ContactAttributes("Maksim", "Radysuhin");

            //newContact.LastnameContact = "Radyushin";
            FillContactForm(newContact);
            SubmitContactCreation();
            ReturnHomePageContact();
            return(this);
        }
 public void ValidationCreationContact()
 {
     if (!IsElementPresent(By.Name("selected[]")))
     {
         NewContact();
         ContactAttributes newContact = new ContactAttributes("Maksim", "Radysuhin");
         //newContact.LastnameContact = "Radyushin";
         FillContactForm(newContact);
         SubmitContactCreation();
         ReturnHomePageContact();
     }
 }
 public ContactHelper FillContactForm(ContactAttributes contact)
 {
     Type(By.Name("firstname"), contact.FirstnameContact);
     Type(By.Name("lastname"), contact.LastnameContact);
     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);
     return(this);
 }
Esempio n. 12
0
        public void TestAddingContactToGroup()
        {
            List <GroupAttributes> listGroups = GroupAttributes.GetAll();

            if (listGroups.Count == 0)
            {
                app.Navigator.OpenGroupsPage();
                app.Groups.AddGroup();                 //если групп нет, то добавляем группу
            }
            listGroups = GroupAttributes.GetAll();     //Вновь получаем список групп
            GroupAttributes          group   = null;   //Создаём и инициализируем контейнер для будущей выбранной группы
            List <ContactAttributes> oldList = null;   //Создаём и инициализируем контейнер для будущего списка контактов выбранной группы
            ContactAttributes        contact = null;   //создаём и инициализируем контейнер для будущего выбранного контакта

            for (int i = 0; i < listGroups.Count; i++) //Начинаем перебирать группы с проверкой на наличие все контактов в выбранной группе
            {
                if (ContactAttributes.GetAll().Count() == 0)
                {
                    app.Navigator.OpenHomePage();
                    app.Contacts.AddContact();
                }
            }
            for (int i = 0; i < listGroups.Count; i++)                            //Начинаем перебирать группы с проверкой на наличие всех контактов в выбранной группе
            {
                group   = listGroups[i];                                          //Выбираем группу
                oldList = group.GetContacts();                                    //Получаем список всех контактов группы
                if (ContactAttributes.GetAll().Except(oldList).Any())             //Проверяем, есть ли не добавленные контакты в списке контактов выбранной группы
                {
                    contact = ContactAttributes.GetAll().Except(oldList).First(); //Если отсутствующий контакт найден, то получаем первый не добавленный
                    break;                                                        //Выходим из цикла
                }
                else if (i == listGroups.Count - 1)                               //Если не находим группу с недобавленными контактами
                {
                    app.Groups.AddGroup();                                        //то создаём новую группу
                    group   = listGroups[listGroups.Count + 1];                   //Выбираем созданную группу и записываем её в контейнер
                    oldList = group.GetContacts();                                //получаем список не добавленных контактов в группу
                    contact = ContactAttributes.GetAll().Except(oldList).First(); //Получаем первый не добавленный контакт выбранной группы
                    break;                                                        //Выходим из цикла
                }
            }
            app.Contacts.AddContactToGroup(contact, group);
            List <ContactAttributes> newList = group.GetContacts();

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

            Assert.AreEqual(oldList, newList);
        }
Esempio n. 13
0
        public void ContactRemovalTest()
        {
            app.Navigator.OpenHomePage();
            app.Contacts.ValidationCreationContact();

            List <ContactAttributes> oldContacts = ContactAttributes.GetAll();
            ContactAttributes        toBeRemoved = oldContacts[0];

            app.Contacts.Remove(toBeRemoved);

            List <ContactAttributes> newContacts = ContactAttributes.GetAll();

            oldContacts.RemoveAt(0);
            Assert.AreEqual(oldContacts, newContacts);
            foreach (ContactAttributes contact in newContacts)
            {
                Assert.AreNotEqual(contact.Id, toBeRemoved.Id);
            }
        }
Esempio n. 14
0
        public void TestRemovalContactToGroup()
        {
            List <ContactAttributes> listContacts = ContactAttributes.GetAll();

            if (listContacts.Count == 0)
            {
                app.Navigator.OpenHomePage();
                app.Contacts.AddContact();//если контактов нет, то добавляем
            }
            List <GroupAttributes> listGroups = GroupAttributes.GetAll();

            if (listGroups.Count == 0)
            {
                app.Navigator.OpenGroupsPage();
                app.Groups.AddGroup();
            }
            listGroups = GroupAttributes.GetAll();                                    //Вновь получаем список групп
            GroupAttributes          group   = listGroups[0];
            List <ContactAttributes> oldList = group.GetContacts();                   //Получаем изначальный список контатов
            ContactAttributes        contact = null;                                  //Создаём и инициализируем контейнер  для будущего контакта

            if (oldList.Count == 0)                                                   //Проверяем наличие контактов в выбранной группе
            {
                app.Contacts.AddContactToGroup(ContactAttributes.GetAll()[0], group); //Если контактов нет то создаём
                oldList = group.GetContacts();                                        //Заново получаем список контактов
                contact = oldList[0];                                                 //Выбираем первый из списка контактов
            }
            else
            {
                oldList = group.GetContacts();                     //Если же список контактов не пуст то получем список контактов
                contact = oldList[rnd.Next(0, oldList.Count - 1)]; //Случайным образом выбираем контакт из списка контактов
            }
            app.Contacts.RemoveContactFromGroup(contact, group);
            List <ContactAttributes> newList = group.GetContacts();

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

            //        Assert.AreEqual(oldList, newList);
        }
Esempio n. 15
0
        public void ContactModificationTest()
        {
            ContactAttributes newData = new ContactAttributes("te455dsat", "3JH545JH534");

            //newData.LastnameContact = "test2";

            app.Navigator.OpenHomePage();
            app.Contacts.ValidationCreationContact();

            List <ContactAttributes> oldContacts = app.Contacts.GetContactList();

            app.Contacts.Modify(0, newData);

            List <ContactAttributes> newContacts = app.Contacts.GetContactList();

            oldContacts[0].FirstnameContact = newData.FirstnameContact;
            oldContacts[0].LastnameContact  = newData.LastnameContact;
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
            // app.Auth.Logout();
        }
Esempio n. 16
0
        public void ContactCreationTest(ContactAttributes contact)
        {
            //ContactAttributes contact = new ContactAttributes("00jfjghf", "jhgj545454h");
            //contact.Address = "1";
            //contact.HomePhone = "8(999)-764-55-55";
            //contact.MobilePhone = "3";
            //contact.WorkPhone = "4";
            //contact.Email = "5";
            //contact.Email2 = "6";
            //contact.Email3 = "7";


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

            app.Contacts.Create(contact);

            List <ContactAttributes> newContacts = ContactAttributes.GetAll();

            oldContacts.Add(contact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }