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())
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())
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())