public ContactHelper FillContactForm(ContactFormData contact)
        {
            var path = Path.Combine(TestContext.CurrentContext.TestDirectory, @"images\", "newimage.png");

            driver.FindElement(By.CssSelector("input[type=file]")).SendKeys(path);
            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("email3"), contact.Email3);
            Type(By.Name("homepage"), contact.Homepage);
            Type(By.Name("address2"), contact.Address2);
            Type(By.Name("phone2"), contact.Phone2);
            Type(By.Name("notes"), contact.Notes);
            return(this);
        }
        public ContactFormData GetContactInformationFromEditForm(int index)
        {
            manager.Navigator.OpenHomePage();
            InitContactModification(index);
            ContactFormData contactInformationFromForm = new ContactFormData()
            {
                Firstname   = driver.FindElement(By.Name("firstname")).GetAttribute("value"),
                Middlename  = driver.FindElement(By.Name("middlename")).GetAttribute("value"),
                Lastname    = driver.FindElement(By.Name("lastname")).GetAttribute("value"),
                Nickname    = driver.FindElement(By.Name("nickname")).GetAttribute("value"),
                Company     = driver.FindElement(By.Name("company")).GetAttribute("value"),
                Title       = driver.FindElement(By.Name("title")).GetAttribute("value"),
                Address     = driver.FindElement(By.Name("address")).GetAttribute("value"),
                HomePhone   = driver.FindElement(By.Name("home")).GetAttribute("value"),
                MobilePhone = driver.FindElement(By.Name("mobile")).GetAttribute("value"),
                WorkPhone   = driver.FindElement(By.Name("work")).GetAttribute("value"),
                Email       = driver.FindElement(By.Name("email")).GetAttribute("value"),
                Email2      = driver.FindElement(By.Name("email2")).GetAttribute("value"),
                Email3      = driver.FindElement(By.Name("email3")).GetAttribute("value"),
                Homepage    = driver.FindElement(By.Name("homepage")).GetAttribute("value"),
                Address2    = driver.FindElement(By.Name("address2")).GetAttribute("value"),
                Fax         = driver.FindElement(By.Name("fax")).GetAttribute("value"),
                Phone2      = driver.FindElement(By.Name("phone2")).GetAttribute("value"),
                Notes       = driver.FindElement(By.Name("notes")).GetAttribute("value")
            };

            return(contactInformationFromForm);
        }
Beispiel #3
0
        public void ContactModification()
        {
            var       newData = new ContactBuilder().Build();
            const int contactToModifyIndex = 1;

            List <ContactFormData> oldContacts = ContactFormData.GetAllContacts();
            ContactFormData        oldData     = oldContacts[0];

            app.Contacts.Modify(newData, oldData);

            Assert.AreEqual(oldContacts.Count, app.Contacts.GetContactCount());

            oldContacts[0].Lastname  = newData.Lastname;
            oldContacts[0].Firstname = newData.Firstname;
            List <ContactFormData> newContacts = ContactFormData.GetAllContacts();

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

            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactFormData contact in newContacts)
            {
                if (contact.Id == oldData.Id)
                {
                    Assert.AreEqual(newData.Lastname, contact.Lastname);
                    Assert.AreEqual(newData.Firstname, contact.Firstname);
                }
            }
        }
        public void TestContactInformationFromDetails()
        {
            ContactFormData fromForm    = app.Contacts.GetContactInformationFromEditForm(1);
            ContactFormData fromDetails = app.Contacts.GetContactInformationFromDetails(1);

            Assert.AreEqual(fromDetails.AllInformation, fromForm.AllInformation);
        }
 public ContactHelper Create(ContactFormData contact)
 {
     InitAddNewContact();
     FillContactForm(contact);
     SubmitContactForm();
     ReturnToHomePage();
     return(this);
 }
        public ContactHelper Remove(ContactFormData contact)
        {
            CreateContactIfNotExists();

            SelectContact(contact.Id);
            RemoveContact();
            manager.Navigator.OpenHomePage();

            return(this);
        }
        public void TestContactInformationFromForm()
        {
            ContactFormData fromTable = app.Contacts.GetContactInformationFromTable(1);
            ContactFormData fromForm  = app.Contacts.GetContactInformationFromEditForm(1);

            Assert.AreEqual(fromTable, fromForm);
            Assert.AreEqual(fromTable.Address, fromForm.Address);
            Assert.AreEqual(fromTable.AllPhones, fromForm.AllPhones);
            Assert.AreEqual(fromTable.AllEmails, fromForm.AllEmails);
        }
        public ContactHelper Modify(ContactFormData newData, ContactFormData oldData)
        {
            CreateContactIfNotExists();

            InitContactModification(oldData.Id);
            FillContactForm(newData);
            SubmitContactModification();
            ReturnToHomePage();

            return(this);
        }
        public ContactHelper Modify(ContactFormData newData, int contactToModifyIndex)
        {
            CreateContactIfNotExists();

            InitContactModification(contactToModifyIndex);
            FillContactForm(newData);
            SubmitContactModification();
            ReturnToHomePage();

            return(this);
        }
Beispiel #10
0
 public void CompareContactsUI_DB()
 {
     if (PERFORM_LONG_UI_CHECKS)
     {
         List <ContactFormData> fromUI = app.Contacts.GetContactList();
         List <ContactFormData> fromDB = ContactFormData.GetAllContacts();
         fromDB.Sort();
         fromUI.Sort();
         Assert.AreEqual(fromDB, fromUI);
     }
 }
Beispiel #11
0
        public void TestDBConnectivity()
        {
            DateTime start = DateTime.Now;
            List <ContactFormData> fromUi = app.Contacts.GetContactList();
            DateTime finish = DateTime.Now;

            System.Console.Out.WriteLine(finish.Subtract(start));

            start = DateTime.Now;
            List <ContactFormData> fromDB = ContactFormData.GetAllContacts();

            finish = DateTime.Now;
            System.Console.Out.WriteLine(finish.Subtract(start));
        }
Beispiel #12
0
        public void NewContactFromJsonFile(ContactFormData newContact)
        {
            List <ContactFormData> oldContacts = app.Contacts.GetContactList();

            app.Contacts.Create(newContact);

            Assert.AreEqual(oldContacts.Count + 1, app.Contacts.GetContactCount());

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

            oldContacts.Add(newContact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
        public ContactFormData GetContactInformationFromTable(int index)
        {
            manager.Navigator.OpenHomePage();
            IList <IWebElement> cells = driver.FindElements(By.Name("entry"))[index - 1]
                                        .FindElements(By.TagName("td"));
            ContactFormData contactInformationFromTable = new ContactFormData()
            {
                Lastname  = cells[1].Text,
                Firstname = cells[2].Text,
                Address   = cells[3].Text,
                AllEmails = cells[4].Text,
                AllPhones = cells[5].Text
            };

            return(contactInformationFromTable);
        }
Beispiel #14
0
        public void NewContact()
        {
            List <ContactFormData> oldContacts = ContactFormData.GetAllContacts();

            var newContact = new ContactBuilder().Build();

            app.Contacts.Create(newContact);

            Assert.AreEqual(oldContacts.Count + 1, app.Contacts.GetContactCount());

            List <ContactFormData> newContacts = ContactFormData.GetAllContacts();

            oldContacts.Add(newContact);
            oldContacts.Sort();
            newContacts.Sort();
            Assert.AreEqual(oldContacts, newContacts);
        }
Beispiel #15
0
        public void ContactRemove()
        {
            const int contactToRemoveIndex = 1;

            List <ContactFormData> oldContacts = ContactFormData.GetAllContacts();
            ContactFormData        toBeRemoved = oldContacts[0];

            app.Contacts.Remove(toBeRemoved);

            Assert.AreEqual(oldContacts.Count - 1, app.Contacts.GetContactCount());

            List <ContactFormData> newContacts = ContactFormData.GetAllContacts();

            oldContacts.RemoveAt(0);
            oldContacts.Sort();
            newContacts.Sort();

            Assert.AreEqual(oldContacts, newContacts);

            foreach (ContactFormData contact in newContacts)
            {
                Assert.AreNotEqual(contact.Id, toBeRemoved.Id);
            }
        }
Beispiel #16
0
 public ContactBuilder()
 {
     this.contact = CreateContactDefaultModel();
 }