public ContactHelper Create(InitContactData icd)
 {
     InitContactCreation(icd);
     SubmitContactCreation();
     manager.Navigators.ReturnHomePage();
     return(this);
 }
        public void ContactRemovalTest()
        {
            if (!app.Contacts.Contact_ModifyChecker())
            {
                InitContactData contact_for_removal = new InitContactData("IVANOV");
                contact_for_removal.Firstname  = "IVAN";
                contact_for_removal.Middlename = "IVANOVICH";
                app.Contacts.Create(contact_for_removal);
            }

            List <InitContactData> oldContacts = app.Contacts.GetContactsList();

            app.Contacts.RemoveContact("selected[]");
            Thread.Sleep(5000);

            List <InitContactData> newContacts = app.Contacts.GetContactsList();

            InitContactData toBeRemoved = oldContacts[0];

            oldContacts.RemoveAt(0);
            Assert.AreEqual(oldContacts.Count, newContacts.Count);
            Assert.AreEqual(oldContacts, newContacts);

            foreach (InitContactData group in newContacts)
            {
                Assert.AreNotEqual(group.Id, toBeRemoved.Id);
            }
        }
 public ContactHelper Contacts_Modify(string index, InitContactData icd_modified)
 {
     SelectContact(index);
     driver.FindElement(By.XPath("//table[@id='maintable']/tbody/tr[2]/td[8]/a/img")).Click();
     InitContactCreation(icd_modified);
     UpdateContactCreation();
     manager.Navigators.ReturnHomePage();
     return(this);
 }
 public void InitContactCreation(InitContactData icd)
 {
     driver.FindElement(By.Name("firstname")).Click();
     driver.FindElement(By.Name("firstname")).Clear();
     driver.FindElement(By.Name("firstname")).SendKeys(icd.Firstname);
     driver.FindElement(By.Name("middlename")).Click();
     driver.FindElement(By.Name("middlename")).Clear();
     driver.FindElement(By.Name("middlename")).SendKeys(icd.Middlename);
     driver.FindElement(By.Name("lastname")).Click();
     driver.FindElement(By.Name("lastname")).Click();
     driver.FindElement(By.Name("lastname")).Clear();
     driver.FindElement(By.Name("lastname")).SendKeys(icd.Lastename);
 }
        public void ShortContactCreationTest()
        {
            InitContactData icd = new InitContactData("K");

            icd.Firstname  = "MMM";
            icd.Middlename = "V";

            List <InitContactData> oldContacts = app.Contacts.GetContactsList();

            app.Contacts.Create(icd);
            List <InitContactData> newContacts = app.Contacts.GetContactsList();

            Assert.AreEqual(oldContacts.Count + 1, newContacts.Count);
        }
        public void ContactCreationTest()
        {
            InitContactData icd = new InitContactData("Kolpakov");

            icd.Firstname  = "Maxim5544";
            icd.Middlename = "Vlad334";

            List <InitContactData> oldContacts = app.Contacts.GetContactsList();

            app.Contacts.Create(icd);
            List <InitContactData> newContacts = app.Contacts.GetContactsList();

            Assert.AreEqual(oldContacts.Count + 1, newContacts.Count);
        }
        public void ContactCreationTest()
        {
            app.navigator.OpenHomePage();
            app.auth.Login(new AccountData("admin", "secret"));
            app.navigator.GoToAccountPage();
            InitContactData icd = new InitContactData();

            icd.Firstname  = "Maxim";
            icd.Middlename = "Vladimirovitch";
            icd.Lastename  = "Kolpakov";
            app.contact.InitContactCreation(icd);
            app.contact.SubmitContactCreation();
            app.navigator.ReturnHomePage();
            app.auth.Logout();
        }
        public void ContactCreationTest()
        {
            OpenHomePage();
            Login(new AccountData("admin", "secret"));
            GoToAccountPage();
            InitContactData icd = new InitContactData();

            icd.Firstname  = "Maxim";
            icd.Middlename = "Vladimirovitch";
            icd.Lastename  = "Kolpakov";
            InitContactCreation(icd);
            SubmitContactCreation();
            ReturnHomePage();
            Logout();
        }
        public List <InitContactData> GetContactsList()
        {
            List <InitContactData> Contacts = new List <InitContactData>();

            manager.Navigators.OpenHomePage();

            IWebElement        contactTable = driver.FindElement(By.TagName("table"));
            List <IWebElement> tableRows    = contactTable.FindElements(By.TagName("tr")).ToList();

            for (int i = 1; i < tableRows.Count; i++)
            {
                IWebElement        tableRow = tableRows[i];
                List <IWebElement> cells    = tableRow.FindElements(By.TagName("td")).ToList();

                InitContactData lastNameContact = new InitContactData(cells[1].Text + " " + cells[2].Text);
                lastNameContact.Id = tableRow.FindElement(By.TagName("input")).GetAttribute("value");

                Contacts.Add(lastNameContact);
            }
            return(Contacts);
        }
        public void ContactModificationTest()
        {
            InitContactData icd_modified = new InitContactData("K_Modificated");

            icd_modified.Firstname  = "M_Modificated";
            icd_modified.Middlename = "V_Modificated";


            if (!app.Contacts.Contact_ModifyChecker())
            {
                InitContactData contact_for_modification = new InitContactData("IVANOV");
                contact_for_modification.Firstname  = "IVAN";
                contact_for_modification.Middlename = "IVANOVICH";
                app.Contacts.Create(contact_for_modification);
            }

            List <InitContactData> oldContacts = app.Contacts.GetContactsList();
            InitContactData        oldData     = oldContacts[0];

            app.Contacts.Contacts_Modify("selected[]", icd_modified);
            List <InitContactData> newContacts = app.Contacts.GetContactsList();

            oldContacts[0].LastNameContact = icd_modified.LastNameContact;
            Assert.AreEqual(oldContacts.Count, newContacts.Count);

            oldContacts.Sort();
            newContacts.Sort();

            foreach (InitContactData contact in newContacts)
            {
                if (contact.Id == oldData.Id)
                {
                    Assert.AreEqual(icd_modified.LastNameContact, icd_modified.LastNameContact);
                }
            }
        }
 public void InitContactCreation(InitContactData icd)
 {
     TypeText(By.Name("firstname"), icd.Firstname);
     TypeText(By.Name("middlename"), icd.Middlename);
     TypeText(By.Name("lastname"), icd.Lastname);
 }