def test_delete_all_contact_03(app, db, check_ui):
    success = True
    old_groups_contact = db.get_contact_list()
    if not db.get_contact_list() == 0:
        app.contacts.delete_all_contact()
    else:
        app.contacts.open_home_page()
    assert len(old_groups_contact) - len(
        old_groups_contact) == app.contacts.count()
    new_contacts = db.get_group_list()
    if check_ui:
        assert sorted(new_contacts, key=Contactfilld.id_or_max()) == sorted(
            app.contacts.get_contact_list(), key=Contactfilld.id_or_max())
def test_delete_rose_contact_02(app, db, check_ui):
    success = True
    old_groups_contact = db.get_contact_list()
    try:
        app.contacts.delete_Rose_contact()
        return True
    except:
        app.contacts.open_home_page()
        return False
    assert len(old_groups_contact) - 1 == app.contacts.count()
    new_groups_contacts = db.get_contact_list()
    old_groups_contact[0:1] = []
    assert old_groups_contact == new_groups_contacts
    if check_ui:
        assert sorted(new_contacts, key=Contactfilld.id_or_max()) == sorted(
            app.contacts.get_contact_list(), key=Contactfilld.id_or_max())
Ejemplo n.º 3
0
 def get_contact_info_from_edit_page(self, index):
     wd = self.app.wd
     self.open_contact_to_edit_by_index(index)
     firstname = wd.find_element_by_name("firstname").get_attribute("value")
     lastname = wd.find_element_by_name("lastname").get_attribute("value")
     id = wd.find_element_by_name("id").get_attribute("value")
     homephone = wd.find_element_by_name("home").get_attribute("value")
     mobilephone = wd.find_element_by_name("mobile").get_attribute("value")
     workphone = wd.find_element_by_name("work").get_attribute("value")
     secondaryphone = wd.find_element_by_name("phone2").get_attribute(
         "value")
     email1 = wd.find_element_by_name("email").get_attribute("value")
     email2 = wd.find_element_by_name("email2").get_attribute("value")
     email3 = wd.find_element_by_name("email3").get_attribute("value")
     address = wd.find_element_by_name("address").get_attribute("value")
     return Contactfilld(firstname=firstname,
                         lastname=lastname,
                         id=id,
                         homephone=homephone,
                         mobilephone=mobilephone,
                         workphone=workphone,
                         secondaryphone=secondaryphone,
                         email1=email1,
                         email2=email2,
                         email3=email3,
                         address=address)
Ejemplo n.º 4
0
 def get_contact_info_from_viwe_page(self, index):
     wd = self.app.wd
     self.open_contact_view_by_index(index)
     text = wd.find_element_by_id("content").text
     homephone = re.search("H: (.*)", text).group(1)
     workphone = re.search("W: (.*)", text).group(1)
     mobilephone = re.search("M: (.*)", text).group(1)
     secondaryphone = re.search("P: (.*)", text).group(1)
     return Contactfilld(homephone=homephone,
                         mobilephone=mobilephone,
                         workphone=workphone,
                         secondaryphone=secondaryphone)
Ejemplo n.º 5
0
def test_edit_first_contact(app, db, check_ui):
    success = True
    contact = Contactfilld(firstname="Mia",
                           middlename="Rk",
                           lastname="Rose",
                           nickename="Rose",
                           title="Rosw comp",
                           company="Rose",
                           address="ertyui",
                           homephone="1234",
                           mobilephone="5678",
                           workphone="90123",
                           fax="4567",
                           email1="*****@*****.**",
                           email2="*****@*****.**",
                           email3="*****@*****.**",
                           homepage="ya.ry",
                           selectbday="3",
                           selectbmonthe="4",
                           byear="1989",
                           selectaday="8",
                           selectamothe="12",
                           ayear="2000",
                           address2="dferesdfe",
                           secondaryphone="rererr",
                           notes="fgwewerewrw")
    if db.get_contact_list() == 0:
        app.contacts.newcontact(contact)
    old_contacts = db.get_contact_list()
    old_contact = random.choice(old_contacts)
    contact.id = old_contact.id
    app.contacts.edit_contact_by_id(old_contact.id, contact)
    new_contacts = db.get_contact_list()
    old_contacts.remove(old_contact)
    old_contacts.append(contact)
    assert sorted(old_contacts, key=Contactfilld.id_or_max) == sorted(
        new_contacts, key=Contactfilld.id_or_max)
    if check_ui:
        assert sorted(new_contacts, key=Contactfilld.id_or_max()) == sorted(
            app.contacts.get_contact_list(), key=Contactfilld.id_or_max())
Ejemplo n.º 6
0
def test_ad_contact_01(app, db, json_contact,check_ui):
    success = True
    contact = json_contact
    with pytest.allure.step('Given a contact list'):
        old_contacts = db.get_contact_list()
    with pytest.allure.step('when i add contact %s to the list' % contact):
        app.contacts.newcontact(contact)
    with pytest.allure.step('Then the new contact list is equal to the list with the added contact'):
        new_contacts = db.get_contact_list()
        old_contacts.append(contact)
        assert sorted(old_contacts, key=Contactfilld.id_or_max) == sorted(new_contacts, key=Contactfilld.id_or_max)
        if check_ui:
            assert sorted(new_contacts, key=Contactfilld.id_or_max()) == sorted(app.contacts.get_contact_list(), key=Contactfilld.id_or_max())
def test_contact_on_home_page(app,orm):
    if len(orm.get_contact_list()) == 0:
        app.contacts.newcontact(
             Contactfilld(firstname="Mia", middlename="Rk", lastname="Rose", nickename="Rose", title="Rosw comp",
                         company="Rose", address="ertyui", homephone="1234", mobilephone="5678", workphone="90123",
                         fax="4567",
                         email1="*****@*****.**", email2="*****@*****.**", email3="*****@*****.**", homepage="ya.ry",
                         selectbday="3",
                         selectbmonthe="4", byear="1989", selectaday="8", selectamothe="12", ayear="2000",
                         address2="dferesdfe", secondaryphone="rererr", notes="fgwewerewrw"))
    contact_from_home_page = app.contacts.get_contact_list()
    contact_db = orm.get_contact_list()
    assert sorted(contact_from_home_page, key = Contactfilld.id_or_max) == sorted(contact_db, key = Contactfilld.id_or_max)
    for contact_from_home_page in contact_from_home_page:
        contact_db = list(filter(lambda x: x.id == contact_from_home_page.id, clean(contact_db)))[0]
        assert contact_from_home_page.address == clean(contact_db.address)
        assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_db)
        assert contact_from_home_page.all_email_from_home_page == merge_email_like_on_home_page(contact_db)
Ejemplo n.º 8
0
 def get_contact_list(self):
     if self.contact_cache is None:
         wd = self.app.wd
         self.open_home_page()
         self.contact_cache = []
         for element in wd.find_elements_by_name("entry"):
             cells = element.find_elements_by_tag_name("td")
             firstname = cells[2].text
             lastname = cells[1].text
             id = cells[0].find_element_by_tag_name("input").get_attribute(
                 "value")
             all_phones = cells[5].text
             all_email = cells[4].text
             address = cells[3].text
             self.contact_cache.append(
                 Contactfilld(firstname=firstname,
                              lastname=lastname,
                              id=id,
                              all_phones_from_home_page=all_phones,
                              all_email_from_home_page=all_email,
                              address=address))
     return list(self.contact_cache)
def test_add_contact_to_group(app, db, orm):
    if len(db.get_group_list()) == 0:
        app.group.create(Groupe(name="n1", header="h1", footer="f1"))
    groups = db.get_group_list()
    group = random.choice(groups)
    contacts = orm.get_contacts_not_in_group(group)
    if len(contacts) == 0:
        app.contacts.newcontact(
            Contactfilld(firstname="Mia",
                         middlename="Rk",
                         lastname="Rose",
                         nickename="Rose",
                         title="Rosw comp",
                         company="Rose",
                         address="ertyui",
                         homephone="1234",
                         mobilephone="5678",
                         workphone="90123",
                         fax="4567",
                         email1="*****@*****.**",
                         email2="*****@*****.**",
                         email3="*****@*****.**",
                         homepage="ya.ry",
                         selectbday="3",
                         selectbmonthe="4",
                         byear="1989",
                         selectaday="8",
                         selectamothe="12",
                         ayear="2000",
                         address2="dferesdfe",
                         secondaryphone="rererr",
                         notes="fgwewerewrw"))
        contacts = orm.get_contacts_not_in_group(group)
    contact = random.choice(contacts)
    app.contacts.add_contact_to_group(contact, group)
    contacts_in_group = orm.get_contacts_in_group(group)
    assert contact in contacts_in_group, "Contact id=%s не добавлен id=%s" % (
        contact.id, group.id)
Ejemplo n.º 10
0
from model.contactfilld import Contactfilld

testdata = [
    Contactfilld(firstname="Mia",
                 middlename="Rk",
                 lastname="Rose",
                 nickename="Rose",
                 title="Rosw comp",
                 company="Rose",
                 address="ertyui",
                 homephone="1234",
                 mobilephone="5678",
                 workphone="90123",
                 fax="4567",
                 email1="*****@*****.**",
                 email2="*****@*****.**",
                 email3="*****@*****.**",
                 homepage="ya.ry",
                 secondaryphone="878787",
                 notes="fgwewere")
]
Ejemplo n.º 11
0
def random_numbers(prefix, maxlen):
    symbol = string.digits + " " * 2
    return prefix + "".join(
        [random.choice(symbol) for i in range(random.randrange(maxlen))])


testdata = [
    Contactfilld(firstname="Mia",
                 middlename="Rk",
                 lastname="Rose",
                 nickename="Rose",
                 title="Rosw comp",
                 company="Rose",
                 address="ertyui",
                 homephone="1234",
                 mobilephone="5678",
                 workphone="90123",
                 fax="4567",
                 email1="*****@*****.**",
                 email2="*****@*****.**",
                 email3="*****@*****.**",
                 homepage="ya.ry",
                 secondaryphone="878787",
                 notes="fgwewere")
] + [
    Contactfilld(firstname=random_string("firstname", 10),
                 middlename=random_string("middlename", 12),
                 lastname=random_string("lastname", 14),
                 nickename=random_string("nickename", 15),
                 title=random_string("title", 10),
                 address=random_string("address", 10),