def test_import_edit_export_contact(self): """ https://moztrap.mozilla.org/manage/case/14115/ """ contacts_app = Contacts(self.marionette) contacts_app.launch() sim_contacts_number_before_import = len(self.data_layer.sim_contacts) self.apps.switch_to_displayed_app() # import contacts from SIM contacts_settings = contacts_app.tap_settings() contacts_settings.tap_import_contacts() contacts_settings.tap_import_from_sim() contacts_settings.tap_back_from_import_contacts() contacts_settings.tap_done() contact_first_name = self.sim_contact['name'][0].split()[0] contact_details = contacts_app.contact(contact_first_name).tap() edit_contact = contact_details.tap_edit() contact_new_family_name = 'New' edit_contact.type_family_name(contact_new_family_name) contact_details = edit_contact.tap_update() contact_details.tap_back() contacts_settings = contacts_app.tap_settings() contacts_settings.tap_export_contacts() contacts_settings.tap_export_to_sim() contacts_app.tap_select_all() contacts_app.tap_export() self.assertIn('contacts exported', contacts_app.status_message) sim_contacts = self.data_layer.sim_contacts self.assertEqual(len(sim_contacts), sim_contacts_number_before_import) for contact in sim_contacts: if contact['tel'][0]['value'] == self.sim_contact['tel'][0][ 'value']: self.sim_contact = contact break self.assertEqual( self.sim_contact['name'][0], '%s %s' % (contact_first_name, contact_new_family_name)) self.assertEqual(self.sim_contact['tel'][0]['value'], self.contact.tel['value'])
def test_import_edit_export_contact(self): """ https://moztrap.mozilla.org/manage/case/14115/ """ contacts_app = Contacts(self.marionette) contacts_app.launch() sim_contacts_number_before_import = len(self.data_layer.sim_contacts) self.apps.switch_to_displayed_app() # import contacts from SIM contacts_settings = contacts_app.tap_settings() contacts_settings.tap_import_contacts() contacts_settings.tap_import_from_sim() contacts_settings.tap_back_from_import_contacts() contacts_settings.tap_done() contact_first_name = self.sim_contact['name'][0].split()[0] contact_details = contacts_app.contact(contact_first_name).tap() edit_contact = contact_details.tap_edit() contact_new_family_name = 'New' edit_contact.type_family_name(contact_new_family_name) contact_details = edit_contact.tap_update() contact_details.tap_back() contacts_settings = contacts_app.tap_settings() contacts_settings.tap_export_contacts() contacts_settings.tap_export_to_sim() contacts_app.tap_select_all() contacts_app.tap_export() self.assertIn('contacts exported', contacts_app.status_message) sim_contacts = self.data_layer.sim_contacts self.assertEqual(len(sim_contacts), sim_contacts_number_before_import) for contact in sim_contacts: if contact['tel'][0]['value'] == self.sim_contact['tel'][0]['value']: self.sim_contact = contact break self.assertEqual(self.sim_contact['name'][0], '%s %s' % (contact_first_name, contact_new_family_name)) self.assertEqual(self.sim_contact['tel'][0]['value'], self.contact.tel['value'])
def test_export_contacts_to_sdcard(self): """ Export contacts to an SD card """ contacts_app = Contacts(self.marionette) contacts_app.launch() contacts_app.wait_for_contacts() contacts_settings = contacts_app.tap_settings() contacts_settings.tap_export_contacts() contacts_settings.tap_export_to_sd() contacts_app.tap_select_all() contacts_app.tap_export() self.assertIn('1/1 contacts exported', contacts_app.status_message) vcf_files = self.data_layer.sdcard_files('.vcf') self.assertEqual(1, len(vcf_files))
def test_delete_all_contacts(self): """ https://moztrap.mozilla.org/manage/case/15181/ """ contacts_app = Contacts(self.marionette) contacts_app.launch() contacts_app.wait_for_contacts(number_to_wait_for=2) contacts_settings = contacts_app.tap_settings() contacts_settings.tap_delete_contacts() contacts_app.tap_select_all() contacts_app.tap_delete() contacts_app.tap_confirm_delete() self.assertIn('2 contacts removed', contacts_app.status_message.lower()) # We assert on the presence of this message instead of the length of contacts_app.contacts being 0 # because Marionette times out when you look for 0 element matching a given CSS selector. # In other words, with assertEquals(len(contacts_app.contacts), 0), this test takes 40 seconds instead of 10. self.assertTrue(contacts_app.is_no_contacts_message_displayed)
def test_delete_all_contacts(self): """ https://moztrap.mozilla.org/manage/case/15181/ """ contacts_app = Contacts(self.marionette) contacts_app.launch() contacts_app.wait_for_contacts(number_to_wait_for=2) contacts_settings = contacts_app.tap_settings() contacts_settings.tap_delete_contacts() contacts_app.tap_select_all() contacts_app.tap_delete() contacts_app.tap_confirm_delete() self.assertIn('2 contacts removed', contacts_app.status_message.lower()) # We assert on the presence of this message instead of the length of contacts_app.contacts being 0 # because Marionette times out when you look for 0 element matching a given CSS selector. # In other words, with assertEquals(len(contacts_app.contacts), 0), this test takes 40 seconds instead of 10. self.assertTrue(contacts_app.is_no_contacts_message_displayed)