示例#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);
        }
示例#2
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);
        }
示例#3
0
 public GroupHelper FillGroupForm(Class2_GroupData group)
 {
     Type(By.Name("group_name"), group.Name);
     Type(By.Name("group_header"), group.Header);
     Type(By.Name("group_footer"), group.Footer);
     return(this);
 }
示例#4
0
 public void ModifyGroup(Class2_GroupData group, Class2_GroupData newData)
 {
     GroupExist()
     .SelectGroupId(group.Id)
     .ModifySelectedGroup()
     .FillGroupForm(newData)
     .UpdateGroup();
 }
示例#5
0
 public GroupHelper Create(Class2_GroupData group)
 {
     manager.Navigator.GroupsPage();
     InitNewGroupCreation();
     FillGroupForm(group);
     SubmitGroupCreation();
     manager.Navigator.GroupsPage();
     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 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 CompareGroupsUI_DB()
 {
     if (PERFORM_LONG_UI_CHECKS)
     {
         List <Class2_GroupData> fromUI = app.Groups.GetGroupList();
         List <Class2_GroupData> fromDB = Class2_GroupData.GetAllGroupInfo();
         fromUI.Sort();
         fromDB.Sort();
         Assert.AreEqual(fromUI, fromDB);
     }
 }
示例#9
0
        public void CreateGroup(Class2_GroupData group)
        {
            app.Navigator.GroupsPage();
            List <Class2_GroupData> oldGroups = Class2_GroupData.GetAllGroupInfo();

            app.Groups.Create(group);
            List <Class2_GroupData> newGroups = Class2_GroupData.GetAllGroupInfo();

            oldGroups.Add(group);
            oldGroups.Sort();
            newGroups.Sort();
            Assert.AreEqual(oldGroups, newGroups);
        }
示例#10
0
 public GroupHelper GroupExist()
 {
     if (IsElementPresent((By.XPath("(//input [@name='selected[]'])['1']"))))
     {
     }
     else
     {
         Class2_GroupData ifgroup = new Class2_GroupData("group");
         ifgroup.Header = "for";
         ifgroup.Footer = "meteor";
         Create(ifgroup);
     };
     return(this);
 }
示例#11
0
        public void RemoveGroupTest()
        {
            app.Navigator.GroupsPage();

            List <Class2_GroupData> oldGroups   = Class2_GroupData.GetAllGroupInfo();
            Class2_GroupData        toBeRemoved = oldGroups[0];

            app.Groups.GroupExist();
            app.Groups.RemoveGroupDB(toBeRemoved);

            //  app.Groups.GroupExist();
            //  app.Groups.RemoveGroup(0);
            List <Class2_GroupData> newGroups = Class2_GroupData.GetAllGroupInfo();

            oldGroups.RemoveAt(0);

            Assert.AreEqual(oldGroups, newGroups);
        }
        public void ModifyGroupTest()
        {
            app.Navigator.GroupsPage();
            Class2_GroupData newData = new Class2_GroupData("Yozha");

            newData.Header = null;
            newData.Footer = null;
            List <Class2_GroupData> oldGroups  = Class2_GroupData.GetAllGroupInfo();
            Class2_GroupData        toBeUpdate = oldGroups[0];

            app.Groups.ModifyGroup(toBeUpdate, newData);
            List <Class2_GroupData> newGroups = Class2_GroupData.GetAllGroupInfo();

            oldGroups[0].Name = newData.Name;
            oldGroups.Sort();
            newGroups.Sort();
            Assert.AreEqual(oldGroups, newGroups);
        }
示例#13
0
        public void CreateBadNameGroup()
        {
            app.Navigator.GroupsPage();
            Class2_GroupData group = new Class2_GroupData("Gro'up11");

            group.Header = "Root";
            group.Footer = "Good";

            List <Class2_GroupData> oldGroups = app.Groups.GetGroupList();

            app.Groups.Create(group);
            List <Class2_GroupData> newGroups = app.Groups.GetGroupList();

            // oldGroups.Add(group);
            oldGroups.Sort();
            newGroups.Sort();
            Assert.AreEqual(oldGroups, newGroups);
        }
示例#14
0
        public void TestDBConnectivity()
        {
            foreach (Class3_ContactData contact in Class2_GroupData.GetAllGroupInfo()[0].GetContacts())
            {
                Console.Out.WriteLine(contact);
            }
            ;



            /* --Скорость проверки из UI и BD
             *
             * DateTime start = DateTime.Now;
             * List<Class2_GroupData> fromUI = app.Groups.GetGroupList();
             * DateTime end = DateTime.Now;
             * Console.Out.WriteLine("UI = " + end.Subtract(start));
             *
             * start = DateTime.Now;
             * List<Class2_GroupData> fromDB = Class2_GroupData.GetAllGroupInfo();
             * end = DateTime.Now;
             * Console.Out.WriteLine("DB = " + end.Subtract(start));
             */
        }
示例#15
0
 public GroupHelper RemoveGroupDB(Class2_GroupData groups)
 {
     SelectGroupId(groups.Id);
     DeleteSelectedGroup();
     return(this);
 }