text: from model.contact import Info
  import random
  # from random import randrange
  
  
  def test_delete_contact_db(app, db, check_ui):
         if len(db.get_contact_list()) == 0:
                app.contact.create(Info(firstname="test"))
         old_contacts = db.get_contact_list()
         contact = random.choice(old_contacts)
         app.contact.delete_contact_by_id(contact.id)
         assert len(old_contacts) - 1 == app.contact.count()
         new_contacts = db.get_contact_list()
         old_contacts.remove(contact)
         assert old_contacts == new_contacts
         if check_ui:
                assert sorted(new_contacts, key=Info.id_or_max) == sorted(app.contact.get_contact_list(),
                                                                          key=Info.id_or_max)
  