Example #1
0
    def test_keyboard_basic(self):
        # Use the contacts app to enter some text
        contact = MockContact()
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()

        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_phone(contact['tel'][0]['value'])
        new_contact_form.type_comment('')

        # initialize the keyboard app
        keyboard = new_contact_form.keyboard

        # send first 15 characters, delete last character, send a space, and send all others
        keyboard.send(self._string[:15])
        keyboard.tap_backspace()
        keyboard.tap_space()
        keyboard.send(self._string[15:])

        # select special character using extended character selector
        keyboard.choose_extended_character('A', 8)

        # go back to app frame and finish this
        contacts_app.launch()
        new_contact_form.tap_done()
        self.wait_for_condition(lambda m: len(contacts_app.contacts) == 1)

        contact_details = contacts_app.contacts[0].tap()
        output_text = contact_details.comments

        self.assertEqual(
            self._string[:14] + ' ' + self._string[15:] + 'Æ'.decode("UTF-8"),
            output_text)
Example #2
0
    def test_call_contact(self):
        # NB This is not a listed smoke test
        # Call phone from a contact
        # https://moztrap.mozilla.org/manage/case/5679/

        contacts = Contacts(self.marionette)
        contacts.launch()
        contacts.wait_for_contacts()

        # tap on the created contact
        contact_details = contacts.contact(self.contact['givenName'][0]).tap()

        # tap the phone number and switch to call screen frame
        call_screen = contact_details.tap_phone_number()

        call_screen.wait_for_outgoing_call()

        # Check the number displayed is the one we dialed
        self.assertIn(self.contact['tel'][0]['value'],
                      call_screen.calling_contact_information)

        self.assertIn(self.contact['givenName'][0],
                      call_screen.outgoing_calling_contact)

        call_screen.hang_up()
        # Switch back to main frame before Marionette loses track bug #840931
        self.marionette.switch_to_frame()
Example #3
0
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard()

        # Tap 'add more keyboards' button
        add_more_keyboards = keyboard_settings.tap_add_more_keyboards()

        # Select keyboard language, then click back to make it "stick"
        add_more_keyboards.select_language(u'Espa\u00F1ol')
        add_more_keyboards.go_back()

        keyboard_settings.wait_for_built_in_keyboard(u'Espa\u00F1ol')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')

        # Switch to keyboard frame and switch language
        new_contact_form.keyboard.switch_to_keyboard()
        new_contact_form.keyboard.tap_keyboard_language_key()
        new_contact_form.keyboard.switch_to_keyboard()
        special_key = self.marionette.find_element(
            *self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
    def test_sms_create_new_contact(self):
        self.contact = MockContact()
        self.message_thread = self.messages.tap_first_received_message()
        self.message_thread.wait_for_received_messages()

        # Check that we received the correct message
        self.assertEqual(self.message_thread.header_text,
                         self.testvars['carrier']['phone_number'])

        activities = self.message_thread.tap_header()

        # Create a new contact
        new_contact = activities.tap_create_new_contact()

        # Populate new contact fields
        new_contact.type_given_name(self.contact['givenName'])
        new_contact.type_family_name(self.contact['familyName'])
        new_contact.type_email(self.contact['email']['value'])
        new_contact.type_street(self.contact['adr']['streetAddress'])
        new_contact.type_zip_code(self.contact['adr']['postalCode'])
        new_contact.type_city(self.contact['adr']['locality'])
        new_contact.type_country(self.contact['adr']['countryName'])
        new_contact.type_comment(self.contact['note'])
        new_contact.tap_done(return_contacts=False)

        self.wait_for_condition(
            lambda m: self.message_thread.header_text == self.contact['name'])

        contacts = Contacts(self.marionette)
        contacts.launch()
        contact_details = contacts.contacts[0].tap()
        self.assertEqual(contact_details.phone_numbers[0],
                         self.testvars['carrier']['phone_number'])
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Select keyboard language
        keyboard_settings.select_language('spanish')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_comment('')

        # Switch to keyboard frame and switch language
        self.keyboard.switch_keyboard_language("es")
        keybframe = self.marionette.find_element(
            *self._select_keyb_frame_locator)
        self.marionette.switch_to_frame(keybframe, focus=False)
        self.wait_for_element_displayed(*self._special_key_locator)
        special_key = self.marionette.find_element(
            *self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
Example #6
0
 def tap_done(self):
     self.marionette.find_element(
         *self._settings_close_button_locator).tap()
     self.wait_for_element_not_displayed(
         *self._settings_close_button_locator)
     from gaiatest.apps.contacts.app import Contacts
     return Contacts(self.marionette)
Example #7
0
    def test_delete_contact(self):
        """ Test delete contact

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

        """

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

        pre_contacts_count = len(contacts_app.contacts)
        self.assertEqual(
            pre_contacts_count, 1,
            "Should insert one contact before running this test.")

        contact_item = contacts_app.contact(self.contact['givenName'][0])
        contact_item_detail = contact_item.tap()
        contact_item_edit = contact_item_detail.tap_edit()
        contact_item_edit.tap_delete()
        contact_item_edit.tap_confirm_delete()

        post_contacts_count = len(contacts_app.contacts)
        self.assertEqual(post_contacts_count, 0,
                         "Should have no contact after run this test.")
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Tap on active keyboard link
        select_keyboard = keyboard_settings.tap_selected_keyboards()

        # Tap 'add more keyboards' button
        add_more_keyboards = select_keyboard.tap_add_more_keyboards()

        # Select keyboard language
        add_more_keyboards.select_language(u'Espa\u00F1ol')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')
        self.wait_for_condition(lambda m: new_contact_form.keyboard.is_displayed())

        # Switch to keyboard frame and switch language
        new_contact_form.keyboard.switch_to_keyboard()
        new_contact_form.keyboard.tap_keyboard_language_key()
        self.wait_for_element_displayed(*self._special_key_locator)
        special_key = self.marionette.find_element(*self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
    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)
Example #10
0
 def tap_done(self):
     close = self.marionette.find_element(
         *self._settings_close_button_locator)
     close.tap()
     Wait(self.marionette).until(expected.element_not_displayed(close))
     from gaiatest.apps.contacts.app import Contacts
     return Contacts(self.marionette)
    def test_unlink_facebook_contact(self):
        """
        https://moztrap.mozilla.org/manage/case/5858/
        """

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

        self.assertEqual(len(contacts_app.contacts), 1,
                         'Should insert one contact before running this test')

        # Go to contact item details
        contact_item = contacts_app.contact(self.contact['givenName'])
        contact_item_detail = contact_item.tap()

        facebook = contact_item_detail.tap_link_contact()
        contact_import_picker = facebook.login(username, password)
        contact_import_picker.tap_first_friend()

        contact_item_detail.tap_unlink_contact()
        contact_item_detail.tap_back()

        contacts_app.wait_for_contacts(2)
        self.assertEqual(
            len(contacts_app.contacts), 2,
            'After unlinking the facebook contact should have been added')
Example #12
0
    def test_sms_add_number_to_existing_contact(self):

        # open the message thread screen
        self.message_thread = self.messages.tap_first_received_message()
        self.message_thread.wait_for_received_messages()

        # Check that we received the correct message
        self.assertEqual(self.message_thread.header_text,
                         self.testvars['carrier']['phone_number'])

        activities = self.message_thread.tap_header()

        contacts = activities.tap_add_to_contact()
        contacts.wait_for_contacts(1)
        edit_contact = contacts.contacts[0].tap(return_class='EditContact')

        edit_contact.tap_update(return_details=False)

        self.wait_for_condition(
            lambda m: self.message_thread.header_text == self.contact['name'])

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

        contact_details = contacts.contacts[0].tap()
        self.assertEqual(contact_details.phone_numbers[1],
                         self.testvars['carrier']['phone_number'])
Example #13
0
    def tap_add_to_contact(self):
        self.marionette.find_element(
            *self._add_to_contact_button_locator).tap()

        from gaiatest.apps.contacts.app import Contacts
        contacts = Contacts(self.marionette)
        contacts.switch_to_contacts_frame()
        return contacts
Example #14
0
    def _switch_to_contacts_frame(self):
        # This is a nested frame and we cannot locate it with AppWindowManager
        frame = Wait(self.marionette).until(
            expected.element_present(*self._contacts_frame_locator))
        self.marionette.switch_to_frame(frame)

        from gaiatest.apps.contacts.app import Contacts
        return Contacts(self.marionette)
Example #15
0
 def tap_back(self):
     el = self.marionette.find_element(*self._details_header_locator)
     Wait(self.marionette).until(expected.element_displayed(el))
     # TODO: remove tap with coordinates after Bug 1061698 is fixed
     el.tap(25, 25)
     Wait(self.marionette).until(expected.element_not_displayed(el))
     from gaiatest.apps.contacts.app import Contacts
     return Contacts(self.marionette)
Example #16
0
    def tap_add_to_existing_contact(self):
        element = self.marionette.find_element(
            *self._add_to_existing_contact_locator)
        Wait(self.marionette).until(expected.element_displayed(element))
        element.tap()

        contact = Contacts(self.marionette)
        contact.switch_to_contacts_frame()
        return contact
Example #17
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 setUp(self):
        GaiaEnduranceTestCase.setUp(self)

        # Remove any existing contacts
        self.data_layer.remove_all_contacts(60000)

        # Launch the Contacts app
        self.contacts = Contacts(self.marionette)
        self.contacts.launch()
Example #19
0
    def tap_back(self):
        self.wait_for_element_displayed(*self._details_header_locator)

        # TODO: remove tap with coordinates after Bug 1061698 is fixed
        self.marionette.find_element(*self._details_header_locator).tap(25, 25)

        self.wait_for_element_not_displayed(*self._details_header_locator)
        from gaiatest.apps.contacts.app import Contacts
        return Contacts(self.marionette)
Example #20
0
 def gmail_login(self, user, passwd):
     self.wait_for_element_displayed(*self._email_locator)
     self.marionette.find_element(*self._email_locator).tap()
     self.marionette.find_element(*self._email_locator).send_keys(user)
     self.marionette.find_element(*self._password_locator).tap()
     self.marionette.find_element(*self._password_locator).send_keys(passwd)
     self.marionette.find_element(*self._sign_in_locator).tap()
     from gaiatest.apps.contacts.app import Contacts
     return Contacts(self.marionette)
Example #21
0
    def tap_contacts(self):
        self.marionette.find_element(*self._contacts_view_locator).tap()

        self.wait_for_element_present(*self._contacts_frame_locator)
        frame = self.marionette.find_element(*self._contacts_frame_locator)
        self.marionette.switch_to_frame(frame)

        from gaiatest.apps.contacts.app import Contacts
        return Contacts(self.marionette)
Example #22
0
 def tap_grant_access(self):
     grant_access_button = self.marionette.find_element(
         *self._grant_access_button_locator)
     self.wait_for_condition(lambda m: grant_access_button.is_enabled())
     self.marionette.execute_script("arguments[0].scrollIntoView(false);",
                                    [grant_access_button])
     grant_access_button.tap()
     from gaiatest.apps.contacts.app import Contacts
     return Contacts(self.marionette)
Example #23
0
    def launch_app(self):

        self.log("Launching app and waiting for it to be ready!")

        # launch the contacts app and wait for the contacts to be displayed,
        # the first launch after populating the data takes a long time.
        contacts = Contacts(self.device.marionette)
        contacts.launch()
        self.wait_for_content_ready()
Example #24
0
 def tap_done(self, return_contacts=True):
     # NewContact can be opened as an Activity from other apps. In this scenario we don't return Contacts
     self.marionette.find_element(*self._done_button_locator).tap()
     if return_contacts:
         self.wait_for_element_not_displayed(*self._done_button_locator)
         from gaiatest.apps.contacts.app import Contacts
         return Contacts(self.marionette)
     else:
         # Bug 947317 Marionette exception after tap closes a frame
         time.sleep(2)
Example #25
0
 def wait_for_done(self, return_contacts=True):
     # NewContact can be opened as an Activity from other apps. In this scenario we don't return Contacts
     if return_contacts:
         self.apps.switch_to_displayed_app()
         from gaiatest.apps.contacts.app import Contacts
         return Contacts(self.marionette)
     else:
         Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != 'Communications')
         # Fall back to the underlying app
         self.apps.switch_to_displayed_app()
    def test_add_photo_from_gallery_to_contact(self):
        # https://moztrap.mozilla.org/manage/case/5551/

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

        contact_details = contacts_app.contact(self.contact['givenName']).tap()

        full_name = ' '.join(
            [self.contact['givenName'], self.contact['familyName']])

        self.assertEqual(full_name, contact_details.full_name)

        saved_contact_image_style = contact_details.image_style

        edit_contact = contact_details.tap_edit()

        self.assertEqual('Edit contact', edit_contact.title)

        saved_picture_style = edit_contact.picture_style

        actions_list = edit_contact.tap_picture()

        # choose the source as gallery app
        gallery = actions_list.tap_gallery()

        # switch to the gallery app
        gallery.switch_to_gallery_frame()
        gallery.wait_for_thumbnails_to_load()
        self.assertGreater(gallery.gallery_items_number, 0,
                           'No photos were found in the gallery.')

        image = gallery.tap_first_gallery_item()
        image.tap_crop_done()

        # switch back to the contacts app
        contacts_app.launch()

        self.assertEqual('Edit contact', edit_contact.title)

        edit_contact.wait_for_image_to_load()

        new_picture_style = edit_contact.picture_style
        self.assertNotEqual(
            new_picture_style, saved_picture_style,
            'The picture associated with the contact was not changed.')

        contact_details = edit_contact.tap_update()

        self.assertEqual(full_name, contact_details.full_name)

        self.assertNotEqual(
            contact_details.image_style, saved_contact_image_style,
            'The picture associated with the contact was not changed.')
Example #27
0
 def tap_grant_access(self):
     grant_access = self.marionette.find_element(
         *self._grant_access_button_locator)
     Wait(self.marionette).until(expected.element_enabled(grant_access))
     grant_access.tap()
     # Go back to displayed Contacts app before waiting for the picker
     from gaiatest.apps.contacts.app import Contacts
     Contacts(self.marionette).wait_to_be_displayed()
     self.apps.switch_to_displayed_app()
     from gaiatest.apps.contacts.regions.contact_import_picker import ContactImportPicker
     return ContactImportPicker(self.marionette)
Example #28
0
 def wait_for_done(self, return_contacts=True):
     # NewContact can be opened as an Activity from other apps. In this scenario we don't return Contacts
     if return_contacts:
         self.wait_for_element_not_displayed(*self._done_button_locator)
         from gaiatest.apps.contacts.app import Contacts
         return Contacts(self.marionette)
     else:
         from gaiatest.apps.contacts.app import Contacts
         Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != Contacts.name)
         # Fall back to the underlying app
         self.apps.switch_to_displayed_app()
Example #29
0
 def wait_for_done(self, return_contacts=True):
     # NewContact can be opened as an Activity from other apps. In this scenario we don't return Contacts
     if return_contacts:
         self.wait_for_element_not_displayed(*self._done_button_locator)
         from gaiatest.apps.contacts.app import Contacts
         return Contacts(self.marionette)
     else:
         # Bug 947317 Marionette exception after tap closes a frame
         time.sleep(2)
         # Fall back to the underlying app
         self.apps.switch_to_displayed_app()
Example #30
0
 def tap_update(self, return_details=True):
     self.wait_for_update_button_enabled()
     update = self.marionette.find_element(*self._update_locator)
     update.tap()
     if return_details:
         from gaiatest.apps.contacts.regions.contact_details import ContactDetails
         return ContactDetails(self.marionette)
     else:
         # else we drop back to the underlying app
         from gaiatest.apps.contacts.app import Contacts
         Contacts(self.marionette).wait_to_not_be_displayed()
         self.apps.switch_to_displayed_app()