Exemple #1
0
    def test_sort_contacts(self):
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        contacts_app.wait_for_contacts(
            number_to_wait_for=len(self._contacts_name_list))

        # sort by first name, compare with sorted-by-first-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_first[idx]
            self.assertEqual(contact_items[idx].full_name,
                             name_tuple[0] + " " + name_tuple[1],
                             "Should order by first name.")

        contacts_settings = contacts_app.tap_settings()
        contacts_settings.enable_order_by_last_name()
        contacts_settings.tap_done()
        contacts_app.wait_for_contacts(
            number_to_wait_for=len(self._contacts_name_list))

        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_last[idx]
            self.assertEqual(contact_items[idx].full_name,
                             name_tuple[0] + " " + name_tuple[1],
                             "Should order by last name.")

        contacts_settings = contacts_app.tap_settings()
        contacts_settings.disable_order_by_last_name()
        contacts_settings.tap_done()
    def test_sort_contacts(self):
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))

        # sort by first name, compare with sorted-by-first-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_first[idx]
            self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by first name.")

        contacts_settings = contacts_app.tap_settings()
        contacts_settings.enable_order_by_last_name()
        contacts_settings.tap_done()
        contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))

        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_last[idx]
            self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by last name.")

        contacts_settings = contacts_app.tap_settings()
        contacts_settings.disable_order_by_last_name()
        contacts_settings.tap_done()
Exemple #3
0
    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.contact(contact_first_name).tap(
            return_class='SelectContact')

        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.contact(contact_first_name).tap(return_class='SelectContact')

        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'])
Exemple #5
0
    def test_sort_contacts(self):
        order_by_last_name_default = False

        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # if "Order by last name" switch is on, turn off it
        contacts_settings = contacts_app.tap_settings()
        self.assertEqual(contacts_settings.order_by_last_name,
                         order_by_last_name_default)
        # This test starts from when order_by_last_name is false
        if order_by_last_name_default:
            contacts_settings.tap_order_by_last_name()
        contacts_settings.tap_done()

        # here we wait for contacts once the correct order has been set
        contacts_app.wait_for_contacts(
            number_to_wait_for=len(self._contacts_name_list))

        # sort by first name, compare with sorted-by-first-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_first[idx]
            self.assertEqual(contact_items[idx].full_name,
                             name_tuple[0] + " " + name_tuple[1],
                             "Should order by first name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn on "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()
        contacts_app.wait_for_contacts(
            number_to_wait_for=len(self._contacts_name_list))

        # sort by last name, compare with sorted-by-last-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_last[idx]
            self.assertEqual(contact_items[idx].full_name,
                             name_tuple[0] + " " + name_tuple[1],
                             "Should order by last name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn off "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()
    def test_import_contacts_from_gmail(self):

        email = self.testvars['email']['gmail']['email']
        password = self.testvars['email']['gmail']['password']
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # Go on Contacts Settings page
        contacts_settings = contacts_app.tap_settings()

        # Tap Import Contacts
        contacts_settings.tap_import_contacts()

        # Check there are no gmail contacts imported
        self.assertEqual(contacts_settings.gmail_imported_contacts, u'Not imported')
        gmail = contacts_settings.tap_import_from_gmail()

        # Login to gmail account
        gmail.switch_to_gmail_login_frame()
        gmail.gmail_login(email, password)
        contact_import_picker = gmail.tap_grant_access()

        # Import all contacts
        contact_import_picker.tap_select_all()
        contacts_settings = contact_import_picker.tap_import_button()
        contacts_settings.tap_back_from_import_contacts()
        contacts_settings.tap_done()

        # Check there is one gmail contact imported
        self.assertEqual(len(contacts_app.contacts), 1)
Exemple #7
0
    def test_add_and_call_ice_contact(self):
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        contacts_app.wait_for_contacts()

        contacts_settings = contacts_app.tap_settings()
        ice_contact_menu = contacts_settings.tap_set_ice_contact()
        ice_contact_select = ice_contact_menu.enable_set_ice_contact()

        contacts_app = ice_contact_select.select_ice_contact()
        contacts_app.wait_for_contacts(1)
        contact_selected = contacts_app.contacts[0].tap(
            return_class='SetIceContacts')
        settings = contact_selected.go_back()
        contact_list = settings.tap_done()

        self.assertTrue(contact_list.is_ice_list_icon_displayed)
        self.assertEqual(len(contact_list.contacts), 1)
        self.assertEqual(
            contact_list.contacts[0].full_name,
            (self.contact['givenName'] + ' ' + self.contact['familyName']))

        ice_contact = contact_list.open_ice_contact_list()
        ice_contact.wait_for_ice_contact_shown()

        ice_contact_details = contacts_app.contact(
            self.contact['givenName']).tap()
        call_screen = ice_contact_details.tap_phone_number()
        call_screen.wait_for_outgoing_call()
        call_screen.hang_up()
    def test_import_gmail_no_network(self):
        '''
        https://moztrap.mozilla.org/manage/case/8986/
        '''
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        contacts_settings = contacts_app.tap_settings()

        contacts_settings.tap_import_contacts()

        self.assertEqual(contacts_settings.gmail_imported_contacts, u'Not imported')
        gmail = contacts_settings.tap_import_from_gmail()

        # Login to gmail account
        gmail.switch_to_gmail_login_frame()

        email = self.environment.email['gmail']['email']
        password = self.environment.email['gmail']['password']

        gmail.gmail_login(email, password)
        contact_import_picker = gmail.tap_grant_access()

        # Import all contacts
        contact_import_picker.tap_select_all()
        contact_import_picker.tap_import_button(wait_for_import=False)

        self.disable_all_network_connections()
        self.apps.switch_to_displayed_app()

        confirmation_view = ConfirmationView(self.marionette)
        self.assertEqual(confirmation_view.error_message,
                         u'Friends\u2019 photos will not be added to your contacts. Continue anyway?')
    def test_add_and_call_ice_contact(self):
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        contacts_app.wait_for_contacts()

        contacts_settings = contacts_app.tap_settings()
        ice_contact_menu = contacts_settings.tap_set_ice_contact()
        ice_contact_select = ice_contact_menu.enable_set_ice_contact()

        contacts_app = ice_contact_select.select_ice_contact()
        contacts_app.wait_for_contacts(1)
        contact_selected = contacts_app.contacts[0].tap(return_class='SetIceContacts')
        settings = contact_selected.go_back()
        contact_list = settings.tap_done()

        self.assertTrue(contact_list.is_ice_list_icon_displayed)
        self.assertEqual(len(contact_list.contacts), 1)
        self.assertEqual(contact_list.contacts[0].full_name, (self.contact['givenName'] + ' ' + self.contact['familyName']))
        
        ice_contact = contact_list.open_ice_contact_list()
        ice_contact.wait_for_ice_contact_shown()
       
        ice_contact_details = contacts_app.contact(self.contact['givenName']).tap()
        call_screen = ice_contact_details.tap_phone_number()
        call_screen.wait_for_outgoing_call()
        call_screen.hang_up()
    def test_import_contacts_menu_no_network(self):
        '''
        https://moztrap.mozilla.org/manage/case/15183/
        '''
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        contacts_settings = contacts_app.tap_settings()

        contacts_settings.tap_import_contacts()

        self.assertFalse(contacts_settings.is_gmail_import_service_in_error)
        self.assertTrue(contacts_settings.is_gmail_import_enabled)

        self.assertFalse(contacts_settings.is_outlook_import_service_in_error)
        self.assertTrue(contacts_settings.is_outlook_import_enabled)

        self.assertFalse(contacts_settings.is_error_message_displayed)

        self.disable_all_network_connections()
        self.apps.switch_to_displayed_app()

        self.assertTrue(contacts_settings.is_gmail_import_service_in_error)
        self.assertFalse(contacts_settings.is_gmail_import_enabled)

        self.assertTrue(contacts_settings.is_outlook_import_service_in_error)
        self.assertFalse(contacts_settings.is_outlook_import_enabled)

        self.assertTrue(contacts_settings.is_error_message_displayed)
    def test_import_contacts_from_gmail(self):

        email = self.testvars['email']['gmail']['email']
        password = self.testvars['email']['gmail']['password']
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # Go on Contacts Settings page
        contacts_settings = contacts_app.tap_settings()

        # Tap Import Contacts
        contacts_settings.tap_import_contacts()

        # Check there are no gmail contacts imported
        self.assertEqual(contacts_settings.gmail_imported_contacts,
                         u'Not imported')
        gmail = contacts_settings.tap_import_from_gmail()

        # Login to gmail account
        gmail.switch_to_gmail_login_frame()
        contacts_import = gmail.gmail_login(email, password)

        # Import first contact
        contacts_import.switch_to_select_contacts_frame()
        contacts_import.tap_first_contact()
        contacts_settings = contacts_import.tap_import_button()
        contacts_settings.tap_back_from_import_contacts()
        contacts_settings.tap_done()

        # Check there is one gmail contact imported
        self.assertEqual(len(contacts_app.contacts), 1)
    def test_import_contacts_from_gmail(self):

        email = self.environment.email['gmail']['email']
        password = self.environment.email['gmail']['password']
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # Go on Contacts Settings page
        contacts_settings = contacts_app.tap_settings()

        # Tap Import Contacts
        contacts_settings.tap_import_contacts()

        # Check there are no gmail contacts imported
        self.assertEqual(contacts_settings.gmail_imported_contacts,
                         u'Not imported')
        gmail = contacts_settings.tap_import_from_gmail()

        # Login to gmail account
        gmail.switch_to_gmail_login_frame()
        gmail.gmail_login(email, password)
        contact_import_picker = gmail.tap_grant_access()

        # Import all contacts
        contact_import_picker.tap_select_all()
        contacts_settings = contact_import_picker.tap_import_button()
        contacts_settings.tap_back_from_import_contacts()
        contacts_settings.tap_done()

        self.assertGreater(len(contacts_app.contacts), 1)
Exemple #13
0
    def test_sort_contacts(self):
        """ Test sorting of contacts

        https://github.com/mozilla/gaia-ui-tests/issues/467

        """

        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        contacts_app.wait_for_contacts(
            number_to_wait_for=len(self._contacts_name_list))

        # if "Order by last name" switch is on, turn off it
        contacts_settings = contacts_app.tap_settings()
        if contacts_settings.order_by_last_name:
            contacts_settings.tap_order_by_last_name()
        contacts_settings.tap_done()

        # sort by first name, compare with sorted-by-first-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_first[idx]
            self.assertEqual(contact_items[idx].full_name,
                             name_tuple[0] + " " + name_tuple[1],
                             "Should order by first name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn on "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()

        # sort by last name, compare with sorted-by-last-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_last[idx]
            self.assertEqual(contact_items[idx].full_name,
                             name_tuple[0] + " " + name_tuple[1],
                             "Should order by last name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn off "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()
Exemple #14
0
    def test_sort_contacts(self):
        order_by_last_name_default = False

        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # if "Order by last name" switch is on, turn off it
        contacts_settings = contacts_app.tap_settings()
        self.assertEqual(contacts_settings.order_by_last_name, order_by_last_name_default)
        # This test starts from when order_by_last_name is false
        if order_by_last_name_default:
            contacts_settings.tap_order_by_last_name()
        contacts_settings.tap_done()

        # here we wait for contacts once the correct order has been set
        contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))

        # sort by first name, compare with sorted-by-first-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_first[idx]
            self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by first name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn on "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()
        contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))

        # sort by last name, compare with sorted-by-last-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_last[idx]
            self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by last name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn off "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()
    def test_sort_contacts(self):
        """ Test sorting of contacts

        https://github.com/mozilla/gaia-ui-tests/issues/467

        """

        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        contacts_app.wait_for_contacts(number_to_wait_for=len(self._contacts_name_list))

        # if "Order by last name" switch is on, turn off it
        contacts_settings = contacts_app.tap_settings()
        if contacts_settings.order_by_last_name:
            contacts_settings.tap_order_by_last_name()
        contacts_settings.tap_done()

        # sort by first name, compare with sorted-by-first-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_first[idx]
            self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by first name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn on "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()

        # sort by last name, compare with sorted-by-last-name list
        contact_items = contacts_app.contacts
        for idx in range(len(self._contacts_name_list)):
            name_tuple = self.sorted_contacts_name_by_last[idx]
            self.assertEqual(contact_items[idx].full_name, name_tuple[0] + " " + name_tuple[1], "Should order by last name.")

        # navigate to settings page
        contacts_settings = contacts_app.tap_settings()
        # turn off "Order by last name" switch
        contacts_settings.tap_order_by_last_name()
        # go to contacts main page from settings page
        contacts_settings.tap_done()
    def test_import_contacts_from_SIM(self):
        """ Insert a new prepaid SIM card (some contacts) in device and import the contacts

        https://moztrap.mozilla.org/manage/case/5880/

        """

        self.assertGreater(len(self.data_layer.sim_contacts), 0, "There is no SIM contacts on SIM card.")
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # import contacts from SIM
        contacts_settings = contacts_app.tap_settings()
        contacts_settings.tap_import_from_sim()

        # all the contacts in the SIM should be imported
        self.assertEqual(len(contacts_app.contacts), len(self.data_layer.sim_contacts))
    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_import_contacts_from_sdcard(self):
        """ Insert a .vcf file to SD card(containing a contact) and import the contact

        https://bugzilla.mozilla.org/show_bug.cgi?id=927348 -  Write a test to import from VCF file on SD card
        """

        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # import contacts from SIM
        contacts_settings = contacts_app.tap_settings()
        contacts_settings.tap_import_contacts()
        contacts_settings.tap_import_from_sdcard()
        contacts_settings.tap_back_from_import_contacts()
        contacts_settings.tap_done()

        # check that the contact name matches the expected, one from the .vcf file
        self.assertEqual(contacts_app.contacts[0].full_name, 'gaia061281 test')
    def test_import_contacts_from_sdcard(self):
        """ Insert a .vcf file to SD card(containing a contact) and import the contact

        https://bugzilla.mozilla.org/show_bug.cgi?id=927348 -  Write a test to import from VCF file on SD card
        """

        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # import contacts from SIM
        contacts_settings = contacts_app.tap_settings()
        contacts_settings.tap_import_contacts()
        contacts_settings.tap_import_from_sdcard()
        contacts_settings.tap_back_from_import_contacts()
        contacts_settings.tap_done()

        # check that the contact name matches the expected, one from the .vcf file
        self.assertEqual(contacts_app.contacts[0].full_name, 'gaia061281 test')
    def test_import_contacts_from_SIM(self):
        """ Insert a new prepaid SIM card (some contacts) in device and import the contacts

        https://moztrap.mozilla.org/manage/case/5880/

        """

        self.assertGreater(len(self.data_layer.sim_contacts), 0,
                           "There is no SIM contacts on SIM card.")
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        # import contacts from SIM
        contacts_settings = contacts_app.tap_settings()
        contacts_settings.tap_import_from_sim()

        # all the contacts in the SIM should be imported
        self.assertEqual(len(contacts_app.contacts),
                         len(self.data_layer.sim_contacts))
    def test_import_contacts_from_facebook(self):
        """
        https://moztrap.mozilla.org/manage/case/5857/
        """

        username = self.testvars['facebook']['username']
        password = self.testvars['facebook']['password']
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        contacts_settings = contacts_app.tap_settings()
        facebook = contacts_settings.tap_sync_friends()
        contact_import_picker = facebook.login(username, password)

        # Import all contacts
        contact_import_picker.tap_select_all()
        contacts_settings = contact_import_picker.tap_import_button()
        contacts_settings.tap_done()

        # Check there is at least one facebook contact imported
        self.assertGreaterEqual(len(contacts_app.contacts), 1)
    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)
Exemple #23
0
    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_import_gmail_no_network(self):
        '''
        https://moztrap.mozilla.org/manage/case/8986/
        '''
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        contacts_settings = contacts_app.tap_settings()

        contacts_settings.tap_import_contacts()

        self.assertEqual(contacts_settings.gmail_imported_contacts,
                         u'Not imported')
        gmail = contacts_settings.tap_import_from_gmail()

        # Login to gmail account
        gmail.switch_to_gmail_login_frame()

        email = self.environment.email['gmail']['email']
        password = self.environment.email['gmail']['password']

        gmail.gmail_login(email, password)
        contact_import_picker = gmail.tap_grant_access()

        # Import all contacts
        contact_import_picker.tap_select_all()
        contact_import_picker.tap_import_button(wait_for_import=False)

        self.disable_all_network_connections()
        self.apps.switch_to_displayed_app()

        confirmation_view = ConfirmationView(self.marionette)
        self.assertEqual(
            confirmation_view.error_message,
            u'Friends\u2019 photos will not be added to your contacts. Continue anyway?'
        )