def test_dialer_airplane_mode(self):
        # https://moztrap.mozilla.org/manage/case/2282/

        # Disable the device radio, enable Airplane mode
        self.data_layer.set_setting('airplaneMode.enabled', True)

        # Check that we are in Airplane mode
        self.assertTrue(self.data_layer.get_setting('airplaneMode.enabled'))

        # Launch the device dialer
        phone = Phone(self.marionette)
        phone.launch()

        # Make a call
        test_phone_number = self.testvars['remote_phone_number']
        phone.keypad.dial_phone_number(test_phone_number)
        phone.keypad.tap_call_button(switch_to_call_screen=False)

        # Check for the Airplane mode dialog
        phone.wait_for_confirmation_dialog()

        # Verify the correct dialog text for the case
        self.assertEqual("Airplane mode activated", phone.confirmation_dialog_text)

        # Verify that there is no active telephony state; window.navigator.mozTelephony.active is null
        self.assertRaises(JavascriptException, self.marionette.execute_script,
                          "return window.navigator.mozTelephony.active.state;")
Exemplo n.º 2
0
class TestDuplicatePhoneNumber(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        
        self.contact = MockContact(givenName='Test', tel=None)
        self.contact2 = MockContact(givenName=self.contact['givenName'], tel={
            'type': 'Mobile',
            'value': '123456789'})
        self.data_layer.insert_contact(self.contact)
        self.data_layer.insert_contact(self.contact2)

    def test_duplicate_phone_number(self):
        self.phone = Phone(self.marionette)
        self.phone.launch()

        number_to_add = self.contact2['tel']['value']
        self.phone.keypad.dial_phone_number(number_to_add)

        add_number = self.phone.keypad.tap_add_contact()
        contacts_app = add_number.tap_add_to_existing_contact()
        contacts_app.wait_for_contacts(2)
    
        edit_contact = contacts_app.contacts[0].tap(return_class='EditContact')
        duplicate_contact_found = edit_contact.tap_update(return_class='Merge')
        merge_contact = duplicate_contact_found.tap_on_merge()

        self.device.touch_home_button()

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

        self.assertEqual(contacts_app.contacts[0].name, self.contact['givenName'])
Exemplo n.º 3
0
    def test_dialer_make_call(self):
        """https://moztrap.mozilla.org/manage/case/1298/"""

        test_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        self.assertEqual('normal', self.data_layer.current_audio_channel)

        call_screen = phone.keypad.call_number(test_phone_number)

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()
        self.assertEqual('telephony', self.data_layer.current_audio_channel)
        call_screen.switch_to_call_screen_frame()

        # Wait for the state to get to at least 'dialing'
        active_states = ('dialing', 'alerting', 'connecting', 'connected')
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state in active_states,
            timeout=30)

        if len(test_phone_number) <= 12:
            # Check the number displayed is the one we dialed
            self.assertEqual(test_phone_number,
                             call_screen.outgoing_calling_contact)
        else:
            self.assertEqual(test_phone_number[:2],
                             call_screen.outgoing_calling_contact[:2])
Exemplo n.º 4
0
    def test_dialer_make_call(self):
        """https://moztrap.mozilla.org/manage/case/1298/"""

        test_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        # FIXME: Bug 1011000: will need to switch it on
        # Assert that the channel has been switched to telephony
        # channel_change_call = self.data_layer.wait_for_audio_channel_changed()

        call_screen = phone.keypad.call_number(test_phone_number)

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        # FIXME: Bug 1011000: will need to switch it on
        # Assert that the channel has been switched back to normal
        # channel_change_hang = self.data_layer.wait_for_audio_channel_changed()

        # Wait for the state to get to at least 'dialing'
        active_states = ('dialing', 'alerting', 'connecting', 'connected')
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state in active_states,
            timeout=30)

        if len(test_phone_number) <= 12:
            # Check the number displayed is the one we dialed
            self.assertEqual(test_phone_number, call_screen.outgoing_calling_contact)
        else:
            self.assertEqual(test_phone_number[:2], call_screen.outgoing_calling_contact[:2])
    def test_dialer_airplane_mode(self):
        # https://moztrap.mozilla.org/manage/case/2282/

        # Disable the device radio, enable Airplane mode
        self.data_layer.set_setting('ril.radio.disabled', True)

        # Check that we are in Airplane mode
        self.assertTrue(self.data_layer.get_setting('ril.radio.disabled'))

        # Launch the device dialer
        phone = Phone(self.marionette)
        phone.launch()

        # Make a call
        test_phone_number = self.testvars['remote_phone_number']
        phone.keypad.call_number(test_phone_number)

        # Check for the Airplane mode dialog
        phone.wait_for_confirmation_dialog()

        # Verify the correct dialog text for the case
        self.assertEqual("Airplane mode activated",
                         phone.confirmation_dialog_text)

        # Verify that there is no active telephony state; window.navigator.mozTelephony.active is null
        self.assertRaises(
            JavascriptException, self.marionette.execute_script,
            "return window.navigator.mozTelephony.active.state;")
Exemplo n.º 6
0
    def test_dialer_make_call(self):
        """https://moztrap.mozilla.org/manage/case/1298/"""

        test_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        self.assertEqual('normal', self.data_layer.current_audio_channel)

        call_screen = phone.keypad.call_number(test_phone_number)

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()
        self.assertEqual('telephony', self.data_layer.current_audio_channel)
        call_screen.switch_to_call_screen_frame()

        # Wait for the state to get to at least 'dialing'
        active_states = ('dialing', 'alerting', 'connecting', 'connected')
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state in active_states,
            timeout=30)

        if len(test_phone_number) <= 12:
            # Check the number displayed is the one we dialed
            self.assertEqual(test_phone_number, call_screen.outgoing_calling_contact)
        else:
            self.assertEqual(test_phone_number[:2], call_screen.outgoing_calling_contact[:2])
    def test_set_up_conference_call(self):
        """Set up a conference between the remote phone and Plivo."""

        test_phone_number = self.testvars['remote_phone_number']
        from gaiatest.utils.plivo.plivo_util import PlivoUtil
        PLIVO_TIMEOUT = 30
        self.plivo = PlivoUtil(
            self.testvars['plivo']['auth_id'],
            self.testvars['plivo']['auth_token'],
            self.testvars['plivo']['phone_number']
        )

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(test_phone_number)
        call_screen.wait_for_outgoing_call()
        call_screen.wait_for_condition(lambda m: self.data_layer.active_telephony_state == 'connected')

        call_uuid = self.plivo.make_call(
            to_number=self.testvars['carrier']['phone_number'].replace('+', ''),
            timeout=PLIVO_TIMEOUT)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call_while_on_call()
        call_screen.answer_call_while_on_call()

        # Wait for Plivo to report the call as connected
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_connected(call_uuid),
            message='The call was not connected.')

        call_screen.merge_calls()
        self.assertEqual(call_screen.conference_label, 'Conference (2)')
Exemplo n.º 8
0
class TestDialerFindContact(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        # Seed the contact with the remote phone number so we don't call random people
        self.contact = MockContact(
            tel={
                'type': 'Mobile',
                'value': "%s" % self.testvars['remote_phone_number']
            })
        self.data_layer.insert_contact(self.contact)

        # launch the Phone app
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_dialer_find_contact(self):

        number_to_verify = self.contact['tel']['value']

        # Dial number
        self.phone.keypad.dial_phone_number(number_to_verify[:5])

        # Assert search popup is displayed
        self.phone.keypad.wait_for_search_popup_visible()

        # Assert name and phone number are the ones in the saved contact
        self.assertEqual(self.phone.keypad.suggested_name,
                         self.contact['name'])
        self.assertEqual(self.phone.keypad.suggested_phone_number,
                         number_to_verify)

        # Tap search popup suggestion
        call_screen = self.phone.keypad.tap_search_popup()

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        # Wait for the state to get to at least 'dialing'
        active_states = ('dialing', 'alerting', 'connecting', 'connected')
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state in active_states,
            timeout=30)

        if len(number_to_verify) <= call_screen.MAX_NUMBER_OF_DISPLAYED_DIGITS:
            # Check the number displayed is the one we dialed
            self.assertIn(number_to_verify,
                          call_screen.calling_contact_information)
        else:
            self.assertIn(number_to_verify[2:],
                          call_screen.calling_contact_information)

    def tearDown(self):
        # Switch back to main frame before Marionette loses track bug #840931
        self.marionette.switch_to_frame()

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaTestCase.tearDown(self)
Exemplo n.º 9
0
class TestAccessibilityCallscreenVisibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_a11y_callscreen_visibility(self):

        test_phone_number = self.contact['tel']['value']

        # Make a call
        self.phone.a11y_make_call(test_phone_number)

        # Check that the keyboard view is hidden by default
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone.call_screen._views_locator)))

        # Check that the incoming container is hidden by default
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone.call_screen._incoming_container_locator)))

        # Check that the handled call hangup button is hidden by default
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone.call_screen._hangup_button_locator)))

        # Hang up
        self.phone.a11y_hang_up()
Exemplo n.º 10
0
class TestAccessibilityPhoneKeypad(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_phone_keypad(self):

        # Delete is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone.keypad._keypad_delete_locator)))
        # Add contact button is disabled for the screen reader.
        self.assertTrue(self.accessibility.is_disabled(self.marionette.find_element(
            *self.phone.keypad._add_new_contact_button_locator)))

        number_to_verify = self.contact['tel']['value']

        # Screen reader dial number
        self.phone.keypad.a11y_dial_phone_number(number_to_verify)

        # Check that the number was entered correctly.
        self.assertEqual(self.phone.keypad.phone_number, number_to_verify)
        # Delete is visible to the screen reader.
        self.assertFalse(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone.keypad._keypad_delete_locator)))
        # Call button is enabled for the screen reader.
        self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
            *self.phone.keypad._call_bar_locator)))
        # Add contact button is enabled for the screen reader.
        self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
            *self.phone.keypad._add_new_contact_button_locator)))
Exemplo n.º 11
0
    def test_dialer_make_call(self):
        """https://moztrap.mozilla.org/manage/case/1298/"""

        test_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        # FIXME: Bug 1011000: will need to switch it on
        # Assert that the channel has been switched to telephony
        # channel_change_call = self.data_layer.wait_for_audio_channel_changed()

        call_screen = phone.keypad.call_number(test_phone_number)

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        # FIXME: Bug 1011000: will need to switch it on
        # Assert that the channel has been switched back to normal
        # channel_change_hang = self.data_layer.wait_for_audio_channel_changed()

        # Wait for the state to get to at least 'dialing'
        active_states = ('dialing', 'alerting', 'connecting', 'connected')
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state in active_states,
            timeout=30)

        if len(test_phone_number) <= 12:
            # Check the number displayed is the one we dialed
            self.assertEqual(test_phone_number,
                             call_screen.outgoing_calling_contact)
        else:
            self.assertEqual(test_phone_number[:2],
                             call_screen.outgoing_calling_contact[:2])
Exemplo n.º 12
0
    def test_dialer_make_call(self):
        """https://moztrap.mozilla.org/manage/case/1298/"""

        test_phone_number = '0956820097'
        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(test_phone_number)
Exemplo n.º 13
0
    def test_MMI_code_IMEI(self):

        phone = Phone(self.marionette)
        phone.launch()

        # Dial the code
        phone.keypad.phone_number = IMEI_CODE

        attention_screen = AttentionScreen(self.marionette)
        self.assertEqual(attention_screen.message, self.testvars['imei'])
Exemplo n.º 14
0
    def test_MMI_code_IMEI(self):

        phone = Phone(self.marionette)
        phone.launch()

        # Dial the code
        phone.keypad.dial_phone_number(IMEI_CODE)

        attention_screen = AttentionScreen(self.marionette)
        self.assertEqual(attention_screen.message, self.testvars['imei'])
Exemplo n.º 15
0
class TestDialerFindContact(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        # Seed the contact with the remote phone number so we don't call random people
        self.contact = MockContact(tel={
            'type': 'Mobile',
            'value': "%s" % self.testvars['remote_phone_number']})
        self.data_layer.insert_contact(self.contact)

        # launch the Phone app
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_dialer_find_contact(self):

        number_to_verify = self.contact['tel']['value']

        # Dial number
        self.phone.keypad.dial_phone_number(number_to_verify[:5])

        # Assert search popup is displayed
        self.phone.keypad.wait_for_search_popup_visible()

        # Assert name and phone number are the ones in the saved contact
        self.assertEqual(self.phone.keypad.suggested_name, self.contact['name'])
        self.assertEqual(self.phone.keypad.suggested_phone_number, number_to_verify)

        # Tap search popup suggestion
        call_screen = self.phone.keypad.tap_search_popup()

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        # Wait for the state to get to at least 'dialing'
        active_states = ('dialing', 'alerting', 'connecting', 'connected')
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state in active_states,
            timeout=30)

        if len(number_to_verify) <= 12:
            # Check the number displayed is the one we dialed
            self.assertEqual(number_to_verify, call_screen.calling_contact_information.split(', ')[1])
        else:
            self.assertEqual(number_to_verify[:2], call_screen.calling_contact_information.split(', ')[1][:2])

    def tearDown(self):
        # Switch back to main frame before Marionette loses track bug #840931
        self.marionette.switch_to_frame()

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaTestCase.tearDown(self)
Exemplo n.º 16
0
    def test_clear_phone_number(self):
        """
        https://moztrap.mozilla.org/manage/case/2191/
        """
        test_phone_number = '5551234567'

        phone = Phone(self.marionette)
        phone.launch()
        phone.keypad.dial_phone_number(test_phone_number)
        self.assertEquals(phone.keypad.phone_number, test_phone_number)
        phone.keypad.clear_phone_number()
        self.assertEquals(phone.keypad.phone_number, '')
Exemplo n.º 17
0
class TestDialerAddContact(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        # launch the Phone app
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_dialer_add_contact(self):

        number_to_verify = self.contact['tel'][0]['value']

        # Dial number
        self.phone.keypad.dial_phone_number(number_to_verify)

        # Assert that the number was entered correctly.
        self.assertEqual(self.phone.keypad.phone_number, number_to_verify)

        # Click Add contact button
        add_new_number = self.phone.keypad.tap_add_contact()

        # Tap on "Create New Contact"
        new_contact = add_new_number.tap_create_new_contact()

        # Enter data into fields
        new_contact.type_given_name(self.contact['givenName'][0])
        new_contact.type_family_name(self.contact['familyName'][0])

        # Click Done button
        new_contact.tap_done()

        # Switch back to keypad-view
        self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.phone.name)
        self.apps.switch_to_displayed_app()

        #Go to Contact list and Verify result
        contacts = self.phone.tap_contacts()

        # Check only one contact is created
        self.assertEqual(1, len(contacts.contacts))

        #  Tap on the new contact
        contact_details = contacts.contacts[0].tap()

        # Verify full name
        full_name = self.contact['givenName'][0] + " " + self.contact['familyName'][0]
        self.assertEqual(contact_details.full_name, full_name)

        # Verify phone number
        self.assertEqual(contact_details.phone_number, number_to_verify)
Exemplo n.º 18
0
class TestCallLogAllCalls(GaiaMtbfTestCase):

    def setUp(self):
        GaiaMtbfTestCase.setUp(self)

        # delete any existing call log entries - call log needs to be loaded
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_call_log_all_calls(self):
        """https://moztrap.mozilla.org/manage/case/1306/"""

        call_log = self.phone.tap_call_log_toolbar_button()
        self.wait_for_element_displayed("css selector", "div.view-body")
        current_calls_count = call_log.all_calls_count
        numbers = self.marionette.find_elements("css selector", "div.view-body article ol li:first-child")
        if len(numbers) > 0:
            verification_bit = 1
            if self.testvars['remote_phone_number'] in numbers[0].text:
                verification_bit = 0

        test_phone_number = self.testvars['remote_phone_number']

        self.phone.tap_keypad_toolbar_button()

        # Make a call so it will appear in the call log
        self.phone.make_call_and_hang_up(test_phone_number)

        # Wait for fall back to phone app
        self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.phone.name)
        self.apps.switch_to_displayed_app()

        call_log = self.phone.tap_call_log_toolbar_button()
        call_log.tap_all_calls_tab()

        # Check that 'All calls' tab is selected
        self.assertTrue(call_log.is_all_calls_tab_selected)

        # Now check that one call appears in the call log
        self.wait_for_condition(lambda m: call_log.all_calls_count > 0)
        self.assertEqual(call_log.all_calls_count, current_calls_count+verification_bit)

        # Check that the call displayed is for the call we made
        self.assertIn(test_phone_number, call_log.first_all_call_text)

    def tearDown(self):

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaMtbfTestCase.tearDown(self)
Exemplo n.º 19
0
class TestPhoneSelectToolbars(GaiaImageCompareTestCase):

    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_phone_select_toolbars(self):

        # Screen reader activated call log button click.
        self.phone.a11y_click_call_log_toolbar_button()

        # Keypad is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._keypad_toolbar_locator)))
        # Contacts is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._contacts_toolbar_locator)))
        # Call log is visible to the screen reader.
        self.assertFalse(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._call_log_toolbar_locator)))

        self.take_screenshot()

        # Screen reader activated contacts button click.
        self.phone.a11y_click_contacts()
        self.apps.switch_to_displayed_app()

        # Keypad is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._keypad_toolbar_locator)))
        # Contacts is visible to the screen reader.
        self.assertFalse(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._contacts_toolbar_locator)))
        # Call log is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._call_log_toolbar_locator)))
        self.take_screenshot()

        # Screen reader activated keypad button click.
        self.phone.a11y_click_keypad_toolbar_button()

        # Keypad is visible to the screen reader.
        self.assertFalse(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._keypad_toolbar_locator)))
        # Contacts is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._contacts_toolbar_locator)))
        # Call log is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._call_log_toolbar_locator)))
        self.take_screenshot()
Exemplo n.º 20
0
    def test_MMI_code_IMEI(self):

        phone = Phone(self.marionette)
        phone.launch()

        # Dial the code
        phone.keypad.dial_phone_number(IMEI_CODE)

        attention_screen = AttentionScreen(self.marionette)

        # Go through all expected IMEIs and check they are in the message
        for imei in self.testvars['imei']:
            self.assertIn(imei, attention_screen.message)
Exemplo n.º 21
0
    def test_MMI_code_IMEI(self):

        phone = Phone(self.marionette)
        phone.launch()

        # Dial the code
        phone.keypad.dial_phone_number(IMEI_CODE)

        attention_screen = AttentionScreen(self.marionette)

        # Go through all expected IMEIs and check they are in the message
        for imei in self.environment.imei_numbers:
            self.assertIn(imei, attention_screen.message)
Exemplo n.º 22
0
class TestRedialLastNumber(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.test_phone_number = self.testvars['remote_phone_number']

        self.phone = Phone(self.marionette)
        self.phone.launch()

        mock_call = MockCall(self.test_phone_number, 'dialing')
        self.data_layer.insert_call_entry(mock_call)

    def test_redial_last_number(self):
        """
        https://moztrap.mozilla.org/manage/case/9043/
        """
        keypad = self.phone.keypad

        # Check that there is no phone number displayed
        self.assertEqual('', keypad.phone_number)

        keypad.tap_call_button(False)
        keypad.wait_for_phone_number_ready()

        # Check that the last dialed number is displayed
        self.assertEqual(self.test_phone_number, keypad.phone_number)

        call_screen = keypad.tap_call_button()

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        if len(self.test_phone_number
               ) <= call_screen.MAX_NUMBER_OF_DISPLAYED_DIGITS:
            # Check the number displayed is the one we dialed
            self.assertEqual(self.test_phone_number,
                             call_screen.outgoing_calling_contact)
        else:
            self.assertEqual(self.test_phone_number[2:],
                             call_screen.outgoing_calling_contact[2:])

    def tearDown(self):
        # Switch back to main frame before Marionette loses track bug #840931
        self.marionette.switch_to_frame()

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaTestCase.tearDown(self)
    def test_dialer_dsds_make_phone_call_with_default_sim(self, default_sim):
        """
        Place a phone call with the default SIM.
        """
        self.data_layer.set_setting('ril.telephony.defaultServiceId', default_sim - 1)
        remote_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(remote_phone_number)
        call_screen.wait_for_outgoing_call()

        self.assertIn(str(default_sim), call_screen.via_sim)
        call_screen.hang_up()
    def test_set_up_conference_call(self):
        """Set up a conference between the remote phone and Plivo."""

        test_phone_number = self.testvars['remote_phone_number']
        from gaiatest.utils.plivo.plivo_util import PlivoUtil

        self.plivo = PlivoUtil(
            self.testvars['plivo']['auth_id'],
            self.testvars['plivo']['auth_token'],
            self.testvars['plivo']['phone_number']
        )

        self.is_in_conference_call = False
        self.is_in_regular_call = False

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(test_phone_number)
        call_screen.wait_for_outgoing_call()
        self.is_in_regular_call = True
        call_screen.wait_for_condition(lambda m: self.data_layer.active_telephony_state == 'connected')

        self.call_uuid = self.plivo.make_call(
            to_number=self.testvars['local_phone_numbers'][0].replace('+', ''),
            timeout=PLIVO_TIMEOUT)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call_while_on_call()
        call_screen.answer_call_while_on_call()

        # Wait for Plivo to report the call as connected
        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_connected(self.call_uuid),
            message='The call was not connected.')

        call_screen.merge_calls()
        self.is_in_regular_call = False
        self.is_in_conference_call = True
        self.assertEqual(call_screen.conference_label, 'Conference (2)')

        call_screen.hang_up()
        self.is_in_conference_call = False

        Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
            lambda p: p.is_call_completed(self.call_uuid),
            message="Plivo didn't report the call as completed")
        self.call_uuid = None
Exemplo n.º 25
0
class TestRedialLastNumber(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        self.test_phone_number = self.testvars['remote_phone_number']

        self.phone = Phone(self.marionette)
        self.phone.launch()

        mock_call = MockCall(self.test_phone_number, 'dialing')
        self.data_layer.insert_call_entry(mock_call)

    def test_redial_last_number(self):
        """
        https://moztrap.mozilla.org/manage/case/9043/
        """
        keypad = self.phone.keypad

        # Check that there is no phone number displayed
        self.assertEqual('', keypad.phone_number)

        keypad.tap_call_button(False)
        keypad.wait_for_phone_number_ready()

        # Check that the last dialed number is displayed
        self.assertEqual(self.test_phone_number, keypad.phone_number)

        call_screen = keypad.tap_call_button()

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        if len(self.test_phone_number) <= 12:
            # Check the number displayed is the one we dialed
            self.assertEqual(self.test_phone_number, call_screen.outgoing_calling_contact)
        else:
            self.assertEqual(self.test_phone_number[:2], call_screen.outgoing_calling_contact[:2])

    def tearDown(self):
        # Switch back to main frame before Marionette loses track bug #840931
        self.marionette.switch_to_frame()

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaTestCase.tearDown(self)
Exemplo n.º 26
0
class TestDialerAddContact(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        # launch the Phone app
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_dialer_add_contact(self):

        number_to_verify = self.contact['tel']['value']

        # Dial number
        self.phone.keypad.dial_phone_number(number_to_verify)

        # Assert that the number was entered correctly.
        self.assertEqual(self.phone.keypad.phone_number, number_to_verify)

        # Click Add contact button
        add_new_number = self.phone.keypad.tap_add_contact()

        # Tap on "Create New Contact"
        new_contact = add_new_number.tap_create_new_contact()

        # Enter data into fields
        new_contact.type_given_name(self.contact['givenName'])
        new_contact.type_family_name(self.contact['familyName'])

        # Click Done button, don't return Contacts because we return to Dialer
        new_contact.tap_done(return_contacts=False)

        #Go to Contact list and Verify result
        contacts = self.phone.tap_contacts()

        # Check only one contact is created
        contacts.wait_for_contacts(1)

        #  Tap on the new contact
        contact_details = contacts.contacts[0].tap()

        # Verify full name
        full_name = self.contact['givenName'] + " " + self.contact['familyName']
        self.assertEqual(contact_details.full_name, full_name)

        # Verify phone number
        self.assertEqual(contact_details.phone_number, number_to_verify)
    def test_dialer_dsds_make_phone_call_with_default_sim(self, default_sim):
        """
        Place a phone call with the default SIM.
        """
        self.data_layer.set_setting('ril.telephony.defaultServiceId',
                                    default_sim - 1)
        remote_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(remote_phone_number)
        call_screen.wait_for_outgoing_call()

        self.assertIn(str(default_sim), call_screen.via_sim)
        call_screen.hang_up()
    def test_dialer_dsds_make_phone_call_with_default_sim(self, default_sim_value, default_sim_name):
        """
        Place a phone call with the default SIM.
        """
        self.data_layer.set_setting('ril.telephony.defaultServiceId', default_sim_value)
        remote_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(remote_phone_number)
        call_screen.wait_for_outgoing_call()

        # TODO Replace the following line by a check on the l10n ID
        # once bug 1104667 lands
        self.assertTrue(default_sim_name in call_screen.outgoing_via_sim)
        call_screen.hang_up()
Exemplo n.º 29
0
class TestAccessibilityPhoneEditContact(GaiaTestCase):
    def setUp(self):
        # Start application in Phone App
        GaiaTestCase.setUp(self)
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_a11y_phone_edit_contact(self):

        # Add a random contact
        contacts = self.phone.a11y_click_contacts()

        # Add new contact
        new_contact_form = contacts.a11y_click_new_contact()

        # Enter data into fields
        contact = MockContact()
        new_contact_form.type_given_name(contact['givenName'])

        # Save new contact
        new_contact_form.a11y_click_done()
        self.wait_for_condition(lambda m: len(contacts.contacts) == 1)

        # Edit the contact
        contact_item = contacts.contact(contact['givenName'])
        contact_item_detail = contact_item.a11y_click()
        contact_item_edit = contact_item_detail.a11y_click_edit()

        self.apps.switch_to_displayed_app()
        # Now check if toolbar is visible by Screen Reader

        # Keypad is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._keypad_toolbar_button_locator)))
        # Contacts is visible to the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._contacts_view_locator)))
        # Call log is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._call_log_toolbar_button_locator)))
    def test_dialer_dsds_make_phone_call_with_default_sim(self, default_sim_value, default_sim_name):
        """
        Place a phone call with the default SIM.
        """
        self.data_layer.set_setting('ril.telephony.defaultServiceId', default_sim_value)
        remote_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(remote_phone_number)
        call_screen.wait_for_outgoing_call()

        # TODO Replace the following line by a check on the l10n ID
        # once bug 1104667 lands
        self.assertTrue(default_sim_name in call_screen.via_sim)
        call_screen.hang_up()
Exemplo n.º 31
0
class TestCallLogAllCalls(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # delete any existing call log entries - call log needs to be loaded
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_call_log_all_calls(self):
        # https://moztrap.mozilla.org/manage/case/1306/

        self.phone.tap_call_log_toolbar_button()

        # switch back to keypad for the test
        self.phone.tap_keypad_toolbar_button()

        test_phone_number = self.testvars['remote_phone_number']

        # Make a call so it will appear in the call log
        self.phone.make_call_and_hang_up(test_phone_number)

        # Wait for fall back to phone app
        self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.phone.name)
        self.apps.switch_to_displayed_app()

        call_log = self.phone.tap_call_log_toolbar_button()

        call_log.tap_all_calls_tab()

        # Check that 'All calls' tab is selected
        self.assertTrue(call_log.is_all_calls_tab_selected)

        # Now check that one call appears in the call log
        self.assertEqual(call_log.all_calls_count, 1)

        # Check that the call displayed is for the call we made
        self.assertIn(test_phone_number, call_log.first_all_call_text)

    def tearDown(self):

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaTestCase.tearDown(self)
Exemplo n.º 32
0
class TestAccessibilityPhoneKeypad(GaiaImageCompareTestCase):
    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.contact = MockContact()

        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_phone_keypad(self):

        # Delete is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone.keypad._keypad_delete_locator)))
        # Add contact button is disabled for the screen reader.
        self.assertTrue(
            self.accessibility.is_disabled(
                self.marionette.find_element(
                    *self.phone.keypad._add_new_contact_button_locator)))

        self.take_screenshot()

        number_to_verify = '1234567890'

        # Screen reader dial number
        self.phone.keypad.a11y_dial_phone_number(number_to_verify)

        # Check that the number was entered correctly.
        self.take_screenshot()
        self.assertEqual(self.phone.keypad.phone_number, number_to_verify)
        # Delete is visible to the screen reader.
        self.assertFalse(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone.keypad._keypad_delete_locator)))
        # Call button is enabled for the screen reader.
        self.assertFalse(
            self.accessibility.is_disabled(
                self.marionette.find_element(
                    *self.phone.keypad._call_bar_locator)))
        # Add contact button is enabled for the screen reader.
        self.assertFalse(
            self.accessibility.is_disabled(
                self.marionette.find_element(
                    *self.phone.keypad._add_new_contact_button_locator)))
Exemplo n.º 33
0
class TestCallLogAllCalls(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        # delete any existing call log entries - call log needs to be loaded
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_call_log_all_calls(self):
        # https://moztrap.mozilla.org/manage/case/1306/

        self.phone.tap_call_log_toolbar_button()

        # switch back to keypad for the test
        self.phone.tap_keypad_toolbar_button()

        test_phone_number = self.testvars['remote_phone_number']

        # Make a call so it will appear in the call log
        self.phone.make_call_and_hang_up(test_phone_number)

        # Wait for fall back to phone app
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == self.phone.name)
        self.apps.switch_to_displayed_app()

        call_log = self.phone.tap_call_log_toolbar_button()

        call_log.tap_all_calls_tab()

        # Check that 'All calls' tab is selected
        self.assertTrue(call_log.is_all_calls_tab_selected)

        # Now check that one call appears in the call log
        self.assertEqual(call_log.all_calls_count, 1)

        # Check that the call displayed is for the call we made
        self.assertIn(test_phone_number, call_log.first_all_call_text)

    def tearDown(self):

        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        GaiaTestCase.tearDown(self)
Exemplo n.º 34
0
    def test_dialer_make_call(self):
        # https://moztrap.mozilla.org/manage/case/1298/

        test_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        phone.keypad.call_number(test_phone_number)

        # Wait for call screen to be dialing
        phone.call_screen.wait_for_outgoing_call()

        # Wait for the state to get to 'alerting' which means connection made
        phone.call_screen.wait_for_condition(lambda m: self.data_layer.active_telephony_state == "alerting", timeout=30)

        # Check the number displayed is the one we dialed
        self.assertEqual(test_phone_number, phone.call_screen.outgoing_calling_number)
Exemplo n.º 35
0
class TestAccessibilityPhoneEditContact(GaiaTestCase):

    def setUp(self):
        # Start application in Phone App
        GaiaTestCase.setUp(self)
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_a11y_phone_edit_contact(self):

        # Add a random contact
        contacts = self.phone.a11y_click_contacts()

        # Add new contact
        new_contact_form = contacts.a11y_click_new_contact()

        # Enter data into fields
        contact = MockContact()
        new_contact_form.type_given_name(contact['givenName'])

        # Save new contact
        new_contact_form.a11y_click_done()
        self.wait_for_condition(lambda m: len(contacts.contacts) == 1)

        # Edit the contact
        contact_item = contacts.contact(contact['givenName'])
        contact_item_detail = contact_item.a11y_click()
        contact_item_edit = contact_item_detail.a11y_click_edit()

        self.apps.switch_to_displayed_app()
        # Now check if toolbar is visible by Screen Reader

        # Keypad is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._keypad_toolbar_button_locator)))
        # Contacts is visible to the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._contacts_view_locator)))
        # Call log is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone._call_log_toolbar_button_locator)))
Exemplo n.º 36
0
    def test_dialer_make_call(self):
        # https://moztrap.mozilla.org/manage/case/1298/

        test_phone_number = self.testvars['remote_phone_number']

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(test_phone_number)

        # Wait for call screen to be dialing
        call_screen.wait_for_outgoing_call()

        # Wait for the state to get to 'dialing' which means dialer app has initiated telephony
        call_screen.wait_for_condition(
            lambda m: self.data_layer.active_telephony_state == "dialing",
            timeout=30)

        # Check the number displayed is the one we dialed
        self.assertEqual(test_phone_number,
                         call_screen.outgoing_calling_contact)
Exemplo n.º 37
0
    def launch_app(self):
        phone = Phone(self.device.marionette)
        phone.launch()
        phone.tap_call_log_toolbar_button()

        time.sleep(30)  # FIXME: actually wait for call log loading modal to be gone
        self.log('Done waiting for call log loading modal to be gone')

        call_log_container = self.device.marionette.find_element('id', 'call-log-container')
        call_log_location = call_log_container.location
        call_log_swipe_padding = 8

        scroll_x1 = call_log_location['x'] + call_log_container.size['width'] / 2
        scroll_y1 = call_log_location['y'] + (call_log_container.size['height'] -
                                              call_log_swipe_padding)
        scroll_y2 = call_log_location['y'] + call_log_swipe_padding

        self.cmds = []

        for i in range(int(self.scrolldown_amount)):
            self.cmds.append(['drag', scroll_x1, scroll_y1, scroll_x1, scroll_y2, 100, 10])
Exemplo n.º 38
0
class TestDeleteCallLog(GaiaTestCase):

    def setUp(self):

        GaiaTestCase.setUp(self)

        self.phone = Phone(self.marionette)
        self.phone.launch()

        test_phone_number = self.testvars['remote_phone_number']

        mock_call = MockCall(test_phone_number, 'incoming')
        self.data_layer.insert_call_entry(mock_call)
        mock_call = MockCall(test_phone_number, 'dialing')
        self.data_layer.insert_call_entry(mock_call)

    def test_delete_call_log(self):
        """
        https://moztrap.mozilla.org/manage/case/2267/
        """

        call_log = self.phone.tap_call_log_toolbar_button()
        call_log.tap_edit_button()

        # Check that we are in edit mode
        self.assertEqual('Edit', call_log.header_text)

        call_log.tap_select_all_button()
        call_list = call_log.call_list

        # Check that the header contains the number of selected elements
        # and that the checkboxes are selected
        self.assertIn(str(len(call_list)), call_log.header_text)
        for call in call_list:
            self.assertTrue(call.is_checked)

        call_log.tap_delete_button()
        call_log.tap_delete_confirmation_button()

        self.assertEqual('No calls recorded', call_log.no_logs_message)
    def test_set_up_conference_call(self):
        """Set up a conference between the remote phone and Plivo."""

        test_phone_number = self.testvars['remote_phone_number']
        from gaiatest.utils.plivo.plivo_util import PlivoUtil

        self.plivo = PlivoUtil(
            self.testvars['plivo']['auth_id'],
            self.testvars['plivo']['auth_token'],
            self.testvars['plivo']['phone_number']
        )

        self.is_in_conference_call = False
        self.is_in_regular_call = False

        phone = Phone(self.marionette)
        phone.launch()

        call_screen = phone.keypad.call_number(test_phone_number)
        call_screen.wait_for_outgoing_call()
        self.is_in_regular_call = True
        Wait(self.marionette).until(lambda m: self.data_layer.active_telephony_state == 'connected')

        self.call_uuid = self.plivo.make_call(
            to_number=self.environment.phone_numbers[0].replace('+', ''))
        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call_while_on_call()

        call_screen.answer_call_while_on_call()
        self.plivo.wait_for_call_connected(self.call_uuid)

        call_screen.merge_calls()
        self.is_in_regular_call = False
        self.is_in_conference_call = True
        self.assertEqual(call_screen.conference_label, 'Conference (2)')

        call_screen.hang_up()
        self.is_in_conference_call = False
        self.plivo.wait_for_call_completed(self.call_uuid)
        self.call_uuid = None
Exemplo n.º 40
0
class TestDeleteCallLog(GaiaTestCase):
    def setUp(self):

        GaiaTestCase.setUp(self)

        self.phone = Phone(self.marionette)
        self.phone.launch()

        test_phone_number = self.testvars['remote_phone_number']

        mock_call = MockCall(test_phone_number, 'incoming')
        self.data_layer.insert_call_entry(mock_call)
        mock_call = MockCall(test_phone_number, 'dialing')
        self.data_layer.insert_call_entry(mock_call)

    def test_delete_call_log(self):
        """
        https://moztrap.mozilla.org/manage/case/2267/
        """

        call_log = self.phone.tap_call_log_toolbar_button()
        call_log.tap_edit_button()

        # Check that we are in edit mode
        self.assertEqual('Edit', call_log.header_text)

        call_log.tap_select_all_button()
        call_list = call_log.call_list

        # Check that the header contains the number of selected elements
        # and that the checkboxes are selected
        self.assertIn(str(len(call_list)), call_log.header_text)
        for call in call_list:
            self.assertTrue(call.is_checked)

        call_log.tap_delete_button()
        call_log.tap_delete_confirmation_button()

        self.assertEqual('No calls recorded', call_log.no_logs_message)
class TestAccessibilityCallscreenOverlayVisibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_a11y_callscreen_overlay_visibility(self):

        test_phone_number = self.contact['tel']['value']

        # Make a call
        self.phone.a11y_make_call(test_phone_number)

        # Check that the bluetooth dialog overlay is hidden
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *self.phone.call_screen._bluetooth_menu_locator)))

        # Hang up
        self.phone.a11y_hang_up()
Exemplo n.º 42
0
    def launch_app(self):
        phone = Phone(self.device.marionette)
        phone.launch()
        phone.tap_call_log_toolbar_button()

        time.sleep(30)  # FIXME: wait for call log loading modal to be gone
        self.log('Done waiting for call log loading modal to be gone')

        call_log_container = self.device.marionette.find_element(
            'id', 'call-log-container')
        call_log_location = call_log_container.location
        call_log_swipe_padding = 8

        scroll_x1 = call_log_location[
            'x'] + call_log_container.size['width'] / 2
        scroll_y1 = call_log_location['y'] + (
            call_log_container.size['height'] - call_log_swipe_padding)
        scroll_y2 = call_log_location['y'] + call_log_swipe_padding

        self.cmds = []

        for i in range(int(self.scrolldown_amount)):
            self.cmds.append(
                ['drag', scroll_x1, scroll_y1, scroll_x1, scroll_y2, 100, 10])
Exemplo n.º 43
0
class TestCallLogGroups(GaiaTestCase):
    def setUp(self):

        GaiaTestCase.setUp(self)

        self.phone = Phone(self.marionette)
        self.phone.launch()

        current_time = repr(time.time()).replace('.', '')
        self.phone_number_1 = '555%s' % current_time[-7:]
        self.phone_number_2 = '444%s' % current_time[-7:]

        self.yesterday_date = date.fromordinal(date.today().toordinal() - 1)
        self.past_date_1 = date(2014, 12, 01)
        self.past_date_2 = date(2013, 12, 01)

        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_1))
        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_2))

        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_1,
                     date=self.yesterday_date))

        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_1, date=self.past_date_1))
        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_2, date=self.past_date_1))
        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_2, date=self.past_date_1))

        self.data_layer.insert_call_entry(
            MockCall(phone_number=self.phone_number_1, date=self.past_date_2))

    def test_call_log_groups(self):
        """
        https://moztrap.mozilla.org/manage/case/2103/
        """

        call_log = self.phone.tap_call_log_toolbar_button()
        group_calls = call_log.groups_list

        self.assertEqual(4, len(group_calls))
        self.assertEqual('TODAY', group_calls[0].header_text)
        self.assertEqual('YESTERDAY', group_calls[1].header_text)
        self.assertEqual('{:%m/%d/%Y}'.format(self.past_date_1),
                         group_calls[2].header_text)
        self.assertEqual('{:%m/%d/%Y}'.format(self.past_date_2),
                         group_calls[3].header_text)

        today_group_calls = group_calls[0].group_calls
        yesterday_group_calls = group_calls[1].group_calls
        group_calls_2014 = group_calls[2].group_calls
        group_calls_2013 = group_calls[3].group_calls

        self.assertEqual(2, len(today_group_calls))
        self.assertEqual(self.phone_number_1,
                         today_group_calls[0].phone_number)
        self.assertEqual(self.phone_number_2,
                         today_group_calls[1].phone_number)

        self.assertEqual(1, len(yesterday_group_calls))
        self.assertEqual(self.phone_number_1,
                         yesterday_group_calls[0].phone_number)

        self.assertEqual(2, len(group_calls_2014))
        self.assertEqual(self.phone_number_1, group_calls_2014[0].phone_number)
        self.assertEqual(self.phone_number_2, group_calls_2014[1].phone_number)
        self.assertEqual('2', group_calls_2014[1].retry_count)

        self.assertEqual(1, len(group_calls_2013))
        self.assertEqual(self.phone_number_1, group_calls_2013[0].phone_number)
Exemplo n.º 44
0
class TestAccessibilityPhoneSelectToolbars(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_phone_select_toolbars(self):

        # Screen reader activated call log button click.
        call_log = self.phone.a11y_click_call_log_toolbar_button()

        # Keypad is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._keypad_toolbar_locator)))
        # Contacts is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._contacts_toolbar_locator)))
        # Call log is visible to the screen reader.
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *self.phone._call_log_toolbar_locator)))

        # Screen reader activated contacts button click.
        self.phone.a11y_click_contacts()
        self.apps.switch_to_displayed_app()

        # Keypad is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._keypad_toolbar_locator)))
        # Contacts is visible to the screen reader.
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *self.phone._contacts_toolbar_locator)))
        # Call log is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._call_log_toolbar_locator)))

        # Screen reader activated keypad button click.
        self.phone.a11y_click_keypad_toolbar_button()

        # Keypad is visible to the screen reader.
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *self.phone._keypad_toolbar_locator)))
        # Contacts is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._contacts_toolbar_locator)))
        # Call log is hidden from the screen reader.
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(
                    *self.phone._call_log_toolbar_locator)))
Exemplo n.º 45
0
class TestCallLogGroups(GaiaTestCase):

    def setUp(self):

        GaiaTestCase.setUp(self)

        self.phone = Phone(self.marionette)
        self.phone.launch()

        current_time = repr(time.time()).replace('.', '')
        self.phone_number_1 = '555%s' % current_time[-7:]
        self.phone_number_2 = '444%s' % current_time[-7:]

        self.yesterday_date = date.fromordinal(date.today().toordinal()-1)
        self.past_date_1 = date(2014, 12, 01)
        self.past_date_2 = date(2013, 12, 01)

        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_1))
        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_2))

        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_1, date=self.yesterday_date))

        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_1, date=self.past_date_1))
        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_2, date=self.past_date_1))
        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_2, date=self.past_date_1))

        self.data_layer.insert_call_entry(MockCall(phone_number=self.phone_number_1, date=self.past_date_2))

    def test_call_log_groups(self):
        """
        https://moztrap.mozilla.org/manage/case/2103/
        """

        call_log = self.phone.tap_call_log_toolbar_button()
        group_calls = call_log.groups_list

        self.assertEqual(4, len(group_calls))
        self.assertEqual('TODAY', group_calls[0].header_text)
        self.assertEqual('YESTERDAY', group_calls[1].header_text)
        self.assertEqual(u'{:%m/%d/%y}'.format(self.past_date_1), group_calls[2].header_text)
        self.assertEqual(u'{:%m/%d/%y}'.format(self.past_date_2), group_calls[3].header_text)

        today_group_calls = group_calls[0].group_calls
        yesterday_group_calls = group_calls[1].group_calls
        group_calls_2014 = group_calls[2].group_calls
        group_calls_2013 = group_calls[3].group_calls

        self.assertEqual(2, len(today_group_calls))
        self.assertEqual(self.phone_number_1, today_group_calls[0].phone_number)
        self.assertEqual(self.phone_number_2, today_group_calls[1].phone_number)

        self.assertEqual(1, len(yesterday_group_calls))
        self.assertEqual(self.phone_number_1, yesterday_group_calls[0].phone_number)

        self.assertEqual(2, len(group_calls_2014))
        self.assertEqual(self.phone_number_1, group_calls_2014[0].phone_number)
        self.assertEqual(self.phone_number_2, group_calls_2014[1].phone_number)
        self.assertEqual('2', group_calls_2014[1].retry_count)

        self.assertEqual(1, len(group_calls_2013))
        self.assertEqual(self.phone_number_1, group_calls_2013[0].phone_number)
Exemplo n.º 46
0
class TestCallLogAllCalls(GaiaTestCase):

    def setUp(self):

        try:
            self.testvars['plivo']
        except KeyError:
            raise SkipTest('Plivo account details not present in test variables')

        GaiaTestCase.setUp(self)

        # delete any existing call log entries - call log needs to be loaded
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_call_log_all_calls(self):
        """
        https://moztrap.mozilla.org/manage/case/1306/
        """
        test_phone_number = self.testvars['remote_phone_number']

        # Remove the first digit (country code) which is not displayed for AT&T/USA - Bug 1088756
        plivo_phone_number = self.testvars['plivo']['phone_number'][1:]

        # Make a call so it will appear in the call log
        self.phone.make_call_and_hang_up(test_phone_number)

        # Wait for fall back to phone app
        self.phone.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()

        from gaiatest.utils.plivo.plivo_util import PlivoUtil
        self.plivo = PlivoUtil(
            self.testvars['plivo']['auth_id'],
            self.testvars['plivo']['auth_token'],
            self.testvars['plivo']['phone_number']
        )

        self.call_uuid = self.plivo.make_call(
            to_number=self.environment.phone_numbers[0].replace('+', ''))
        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call()

        self.plivo.hangup_call(self.call_uuid)
        self.plivo.wait_for_call_completed(self.call_uuid)
        self.call_uuid = None

        self.phone.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        call_log = self.phone.tap_call_log_toolbar_button()

        # Check all calls tab
        call_log.tap_all_calls_tab()
        self.assertTrue(call_log.is_all_calls_tab_selected)

        self.wait_for_condition(lambda m: len(call_log.call_list) == 2)
        call_list = call_log.call_list

        # Check that the calls displayed are for the calls we made/received
        self.assertIn(plivo_phone_number, call_list[0].phone_number)
        self.assertEqual('incoming', call_list[0].call_type)
        self.assertIn(test_phone_number, call_list[1].phone_number)
        self.assertEqual('dialing', call_list[1].call_type)

        # Check missed calls tab
        call_log.tap_missed_calls_tab()
        self.assertTrue(call_log.is_missed_calls_tab_selected)

        self.wait_for_condition(lambda m: len(call_log.call_list) == 1)
        call_list = call_log.call_list

        # Check that the calls displayed are for the calls we received
        self.assertIn(plivo_phone_number, call_list[0].phone_number)
        self.assertEqual('incoming', call_list[0].call_type)

    def tearDown(self):
        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        # Also ask Plivo to kill the call if needed
        if self.call_uuid:
            self.plivo.hangup_call(self.call_uuid)

        GaiaTestCase.tearDown(self)
Exemplo n.º 47
0
class TestDialerAddContact(GaiaTestCase):

    # Dialer app
    _keyboard_container_locator = ('id', 'keyboard-container')
    _phone_number_view_locator = ('id', 'phone-number-view')
    _add_new_contact_button_locator = ('id', 'keypad-callbar-add-contact')
    _contacts_view_locator = ('id', 'option-contacts')
    _create_new_contact_locator = ('id', 'create-new-contact-menuitem')

    # Header buttons
    _done_button_locator = ('id', 'save-button')

    # New/Edit contact fields
    _given_name_field_locator = ('id', 'givenName')
    _family_name_field_locator = ('id', 'familyName')
    _phone_field_locator = ('id', 'number_0')

    # Contact details panel
    _contact_list_locator = ('css selector', '#contacts-list-G li')
    _contact_name_title_locator = ('id', 'contact-name-title')
    _call_phone_number_button_locator = ('id', 'call-or-pick-0')

    # frames
    _new_contact_frame_locator = (
        'css selector',
        "iframe[src^='app://communications'][src$='contacts/index.html?new']")
    _contact_frame_locator = ('css selector', '#iframe-contacts')
    _keypad_frame_locator = (
        'css selector',
        "iframe[src^='app://communications'][src$='dialer/index.html#keyboard-view']"
    )

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        # launch the Phone app
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_dialer_add_contact(self):

        self.wait_for_element_displayed(*self._keyboard_container_locator)

        # Dial number
        self.phone.keypad.dial_phone_number(self.contact['tel']['value'])

        # Assert that the number was entered correctly.
        phone_view = self.marionette.find_element(
            *self._phone_number_view_locator)
        self.assertEqual(phone_view.get_attribute('value'),
                         self.contact['tel']['value'])

        # Click Add contact button
        self.wait_for_element_displayed(*self._add_new_contact_button_locator)
        add_new_contact = self.marionette.find_element(
            *self._add_new_contact_button_locator)
        self.marionette.tap(add_new_contact)

        # Tap on "Create New Contact"
        self.wait_for_element_displayed(*self._create_new_contact_locator)
        create_new_contact = self.marionette.find_element(
            *self._create_new_contact_locator)
        self.marionette.tap(create_new_contact)

        # Switch to add contacts frame
        self.marionette.switch_to_frame()
        self.wait_for_element_present(*self._new_contact_frame_locator)
        new_contact_frame = self.marionette.find_element(
            *self._new_contact_frame_locator)
        self.marionette.switch_to_frame(new_contact_frame)

        # Enter data into fields
        self.wait_for_element_displayed(*self._done_button_locator)
        self.marionette.find_element(
            *self._given_name_field_locator).send_keys(
                self.contact['givenName'])
        self.marionette.find_element(
            *self._family_name_field_locator).send_keys(
                self.contact['familyName'])

        # Click Done button
        done_button = self.marionette.find_element(*self._done_button_locator)
        self.marionette.tap(done_button)

        # Switch back to keypad-view
        self.marionette.switch_to_frame()

        self.wait_for_element_present(*self._keypad_frame_locator)
        keypad_frame = self.marionette.find_element(
            *self._keypad_frame_locator)
        self.marionette.switch_to_frame(keypad_frame)

        #Go to Contact list and Verify result
        contact_view = self.marionette.find_element(
            *self._contacts_view_locator)
        self.marionette.tap(contact_view)

        # switch to contact frame
        self.wait_for_element_present(*self._contact_frame_locator)
        contact_frame = self.marionette.find_element(
            *self._contact_frame_locator)
        self.marionette.switch_to_frame(contact_frame)

        # Check only one contact is created
        self.wait_for_element_displayed(*self._contact_list_locator)
        contact_list = self.marionette.find_elements(
            *self._contact_list_locator)
        self.assertEqual(1, len(contact_list))

        #  Tap on the new contact
        contact = contact_list[0]
        self.marionette.tap(contact)

        # wait for contact details to be loaded
        self.wait_for_element_displayed(
            *self._call_phone_number_button_locator)

        # Verify full name
        full_name = self.contact['givenName'] + " " + self.contact['familyName']
        self.assertEqual(
            self.marionette.find_element(
                *self._contact_name_title_locator).text, full_name)

        # Verify phone number
        self.assertEqual(
            self.marionette.find_element(
                *self._call_phone_number_button_locator).text,
            self.contact['tel']['value'])
Exemplo n.º 48
0
class TestAccessibilityPhoneCallLog(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_phone_call_log(self):

        # Screen reader activated call log button click.
        call_log = self.phone.a11y_click_call_log_toolbar_button()

        # Edit call log button is disabled for the screen reader.
        self.assertTrue(self.accessibility.is_disabled(self.marionette.find_element(
            *call_log._call_log_edit_button_locator)))

        # Screen reader activated keypad button click.
        self.phone.a11y_click_keypad_toolbar_button()

        test_phone_number = self.contact['tel']['value']

        # Make a call so it will appear in the call log
        self.phone.a11y_make_call_and_hang_up(test_phone_number)

        # Wait for fall back to phone app
        self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.phone.name)
        self.apps.switch_to_displayed_app()
        self.phone.a11y_click_call_log_toolbar_button()

        # Edit call log button is enabled for the screen reader.
        self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
            *call_log._call_log_edit_button_locator)))

        # Now check that one call appears in the call log
        self.assertEqual(call_log.all_calls_count, 1)
        # Check that the call displayed is for the call we made
        self.assertIn(test_phone_number, call_log.first_all_call_text)

        call_log_first_item = self.marionette.find_elements(
            *call_log._all_calls_list_item_button_locator)[0]

        # This needs to be uncommented once the screen reader can handle long press.
        # Activate a first log item with the screen reader.
        # self.accessibility.click(call_log_first_item)

        # # Add contact action menu should be visible to the screen reader.
        # self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
        #     *self.phone._call_group_menu_locator)))

        # # Close the add contact action menu with the screen reader.
        # self.accessibility.click(self.marionette.find_element(
        #     *self.phone._cancel_action_menu_locator))

        self.accessibility.click(self.marionette.find_element(
            *call_log._call_log_edit_button_locator))

        call_log_edit_element = self.marionette.find_element(
            *call_log._call_log_edit_dialog_locator)
        delete = self.marionette.find_element(*call_log._call_log_edit_delete_button_locator)
        deselect = self.marionette.find_element(
            *call_log._call_log_edit_deselect_all_button_locator)
        select = self.marionette.find_element(*call_log._call_log_edit_select_all_button_locator)

        # Edit mode is visible to the screen reader.
        self.assertTrue(self.accessibility.is_visible(call_log_edit_element))
        # Delete button is disabled for the screen reader.
        self.assertTrue(self.accessibility.is_disabled(delete))
        # Deselect all button is disabled for the screen reader.
        self.assertTrue(self.accessibility.is_disabled(deselect))
        # Select all button is enabled for the screen reader.
        self.assertFalse(self.accessibility.is_disabled(select))

        # Activate a first log item with the screen reader.
        call_log_first_item = self.marionette.find_elements(
            *call_log._all_calls_list_item_checkbox_locator)[0]
        self.accessibility.click(call_log_first_item)

        # Delete button is now enabled for the screen reader.
        self.assertFalse(self.accessibility.is_disabled(delete))
        # Deselect all button is now enabled for the screen reader.
        self.assertFalse(self.accessibility.is_disabled(deselect))
        # Select all button is now disabled for the screen reader.
        self.assertTrue(self.accessibility.is_disabled(select))
        # First item in the list is selected.
        self.assertTrue(call_log_first_item.get_attribute('checked'))

        self.accessibility.click(call_log_first_item)
        # First item in the list is unchecked.
        self.assertFalse(call_log_first_item.get_attribute('checked'))

        self.accessibility.click(self.marionette.find_element(
            *call_log._call_log_edit_close_button_locator))

        # Edit mode is hidden from the screen reader.
        self.assertTrue(self.accessibility.is_hidden(call_log_edit_element))
Exemplo n.º 49
0
class TestCallLogAllCalls(GaiaTestCase):
    def setUp(self):

        try:
            self.testvars['plivo']
        except KeyError:
            raise SkipTest(
                'Plivo account details not present in test variables')

        GaiaTestCase.setUp(self)

        # delete any existing call log entries - call log needs to be loaded
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_call_log_all_calls(self):
        """https://moztrap.mozilla.org/manage/case/1306/"""

        test_phone_number = self.testvars['remote_phone_number']
        plivo_phone_number = self.testvars['plivo']['phone_number']

        # Make a call so it will appear in the call log
        self.phone.make_call_and_hang_up(test_phone_number)

        # Wait for fall back to phone app
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == self.phone.name)
        self.apps.switch_to_displayed_app()

        from gaiatest.utils.plivo.plivo_util import PlivoUtil
        self.plivo = PlivoUtil(self.testvars['plivo']['auth_id'],
                               self.testvars['plivo']['auth_token'],
                               self.testvars['plivo']['phone_number'])
        self.call_uuid = self.plivo.make_call(
            to_number=self.testvars['carrier']['phone_number'].replace(
                '+', ''),
            timeout=30)

        call_screen = CallScreen(self.marionette)
        call_screen.wait_for_incoming_call()
        self.plivo.hangup_call(self.call_uuid)

        self.apps.switch_to_displayed_app()
        call_log = self.phone.tap_call_log_toolbar_button()

        # Check all calls tab
        call_log.tap_all_calls_tab()
        self.assertTrue(call_log.is_all_calls_tab_selected)

        call_list = call_log.call_list
        self.assertEqual(len(call_list), 2)

        # Check that the calls displayed are for the calls we made/received
        self.assertIn(plivo_phone_number, call_list[0].phone_number)
        self.assertEqual('incoming', call_list[0].call_type)
        self.assertIn(test_phone_number, call_list[1].phone_number)
        self.assertEqual('dialing', call_list[1].call_type)

        # Check missed calls tab
        call_log.tap_missed_calls_tab()
        self.assertTrue(call_log.is_missed_calls_tab_selected)

        call_list = call_log.call_list
        self.assertEqual(len(call_list), 1)

        # Check that the calls displayed are for the calls we received
        self.assertIn(plivo_phone_number, call_list[0].phone_number)
        self.assertEqual('incoming', call_list[0].call_type)

    def tearDown(self):
        # In case the assertion fails this will still kill the call
        # An open call creates problems for future tests
        self.data_layer.kill_active_call()

        # Also ask Plivo to kill the call if needed
        if self.call_uuid:
            self.plivo.hangup_call(self.call_uuid)

        GaiaTestCase.tearDown(self)
Exemplo n.º 50
0
class TestDialerAddContact(GaiaTestCase):

    # Dialer app
    _keyboard_container_locator = ("id", "keyboard-container")
    _phone_number_view_locator = ("id", "phone-number-view")
    _add_new_contact_button_locator = ("id", "keypad-callbar-add-contact")
    _contacts_view_locator = ("id", "option-contacts")
    _create_new_contact_locator = ("id", "create-new-contact-menuitem")

    # Header buttons
    _done_button_locator = ("id", "save-button")

    # New/Edit contact fields
    _given_name_field_locator = ("id", "givenName")
    _family_name_field_locator = ("id", "familyName")
    _phone_field_locator = ("id", "number_0")

    # Contact details panel
    _contact_list_locator = ("css selector", "#contacts-list-G li")
    _contact_name_title_locator = ("id", "contact-name-title")
    _call_phone_number_button_locator = ("id", "call-or-pick-0")

    # frames
    _new_contact_frame_locator = ("css selector", "iframe[src^='app://communications'][src$='contacts/index.html?new']")
    _contact_frame_locator = ("css selector", "#iframe-contacts")
    _keypad_frame_locator = (
        "css selector",
        "iframe[src^='app://communications'][src$='dialer/index.html#keyboard-view']",
    )

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.contact = MockContact()

        # launch the Phone app
        self.phone = Phone(self.marionette)
        self.phone.launch()

    def test_dialer_add_contact(self):

        self.wait_for_element_displayed(*self._keyboard_container_locator)

        # Dial number
        self.phone.keypad.phone_number = self.contact["tel"]["value"]

        # Assert that the number was entered correctly.
        phone_view = self.marionette.find_element(*self._phone_number_view_locator)
        self.assertEqual(phone_view.get_attribute("value"), self.contact["tel"]["value"])

        # Click Add contact button
        self.wait_for_element_displayed(*self._add_new_contact_button_locator)
        add_new_contact = self.marionette.find_element(*self._add_new_contact_button_locator)
        self.marionette.tap(add_new_contact)

        # Tap on "Create New Contact"
        self.wait_for_element_displayed(*self._create_new_contact_locator)
        create_new_contact = self.marionette.find_element(*self._create_new_contact_locator)
        self.marionette.tap(create_new_contact)

        # Switch to add contacts frame
        self.marionette.switch_to_frame()
        self.wait_for_element_present(*self._new_contact_frame_locator)
        new_contact_frame = self.marionette.find_element(*self._new_contact_frame_locator)
        self.marionette.switch_to_frame(new_contact_frame)

        # Enter data into fields
        self.wait_for_element_displayed(*self._done_button_locator)
        self.marionette.find_element(*self._given_name_field_locator).send_keys(self.contact["givenName"])
        self.marionette.find_element(*self._family_name_field_locator).send_keys(self.contact["familyName"])

        # Click Done button
        done_button = self.marionette.find_element(*self._done_button_locator)
        self.marionette.tap(done_button)

        # Switch back to keypad-view
        self.marionette.switch_to_frame()

        self.wait_for_element_present(*self._keypad_frame_locator)
        keypad_frame = self.marionette.find_element(*self._keypad_frame_locator)
        self.marionette.switch_to_frame(keypad_frame)

        # Go to Contact list and Verify result
        contact_view = self.marionette.find_element(*self._contacts_view_locator)
        self.marionette.tap(contact_view)

        # switch to contact frame
        self.wait_for_element_present(*self._contact_frame_locator)
        contact_frame = self.marionette.find_element(*self._contact_frame_locator)
        self.marionette.switch_to_frame(contact_frame)

        # Check only one contact is created
        self.wait_for_element_displayed(*self._contact_list_locator)
        contact_list = self.marionette.find_elements(*self._contact_list_locator)
        self.assertEqual(1, len(contact_list))

        #  Tap on the new contact
        contact = contact_list[0]
        self.marionette.tap(contact)

        # wait for contact details to be loaded
        self.wait_for_element_displayed(*self._call_phone_number_button_locator)

        # Verify full name
        full_name = self.contact["givenName"] + " " + self.contact["familyName"]
        self.assertEqual(self.marionette.find_element(*self._contact_name_title_locator).text, full_name)

        # Verify phone number
        self.assertEqual(
            self.marionette.find_element(*self._call_phone_number_button_locator).text, self.contact["tel"]["value"]
        )