コード例 #1
0
    def tearDown(self):
        if d.orientation != self.initial_orientation:
            d.orientation = self.initial_orientation
            d.freeze_rotation(False)

        if self.is_ussd_open:
            dut_manager.activate_phone(self.phone1)
            Dialer.close_ussd()
            self.is_ussd_open = False

        if self.is_call_active2:
            dut_manager.activate_phone(self.phone2)
            self.assertTrue(Dialer.end_call(),
                            'Failed to end call in cleanup.')
            self.is_call_active2 = False

        if self.is_call_active3:
            dut_manager.activate_phone(self.phone3)
            self.assertTrue(Dialer.end_call(),
                            'Failed to end call in cleanup.')
            self.is_call_active3 = False

        if self.is_call_waiting_disabled:
            dut_manager.activate_phone(self.phone1)
            Dialer.launch()
            self.assertTrue(Dialer.dialer_launched(),
                            'Dialer failed to launch.')
            self.assertTrue(
                Dialer.dial_number(self.activate_call_waiting_nr),
                'Failed to activate call waiting using code (%s) in cleanup.' %
                self.activate_call_waiting_nr)
            self.assertTrue(Dialer.is_ussd_open(), 'USSD popup not open.')
            self.assertTrue(Dialer.close_ussd(), 'Failed to close ussd popup.')
            self.is_call_waiting_disabled = False

        for phone in [self.phone1, self.phone2, self.phone3]:
            LOG.info('Cleaning up for %s.' % phone)
            dut_manager.activate_phone(phone)
            UiAutomatorUtils.close_all_tasks()
            StatusBar.open_notifications()
            StatusBar.clear_notifications()
            d.press.home()
コード例 #2
0
    def test_call_wait_using_code_43(self):
        """ ST_TELEPHONY_SS_CW_001 """

        LOG.info('Activate %s' % self.phone1)
        dut_manager.activate_phone(self.phone1)

        LOG.info('Launch Dialer.')
        Dialer.launch()
        self.assertTrue(Dialer.dialer_launched(), 'Dialer failed to launch.')

        LOG.info('Activate call waiting using code (%s).' %
                 self.activate_call_waiting_nr)
        self.assertTrue(
            Dialer.dial_number(self.activate_call_waiting_nr),
            'Failed to activate call waiting using code (%s).' %
            self.activate_call_waiting_nr)

        LOG.info('Check that USSD popup is open.')
        self.assertTrue(Dialer.is_ussd_open(), 'USSD popup not open.')
        self.is_ussd_open = True

        LOG.info('Get USSD message.')
        msg = Dialer.get_ussd_message()
        LOG.info('Found msg: %s' % msg)

        LOG.info('Close USSD popup.')
        self.assertTrue(Dialer.close_ussd(), 'Failed to close ussd popup.')
        self.is_ussd_open = False

        service_enabled_msg = 'Call waiting\nService was enabled.'
        LOG.info(
            'Check that USSD msg indicate that service has been activated.')
        self.assertEqual(
            msg, service_enabled_msg,
            'Found "%s" instead of "%s"' % (msg, service_enabled_msg))

        LOG.info('Interrogate call waiting using code (%s).' %
                 self.interrogate_call_waiting_nr)
        self.assertTrue(
            Dialer.dial_number(self.interrogate_call_waiting_nr),
            'Failed to interrogate call waiting using code (%s).' %
            self.interrogate_call_waiting_nr)

        LOG.info('Check that USSD popup is open.')
        self.assertTrue(Dialer.is_ussd_open(), 'USSD popup not open.')
        self.is_ussd_open = True

        LOG.info('Get USSD message.')
        msg = Dialer.get_ussd_message()
        LOG.info('Found msg: %s' % msg)

        LOG.info('Close USSD popup.')
        self.assertTrue(Dialer.close_ussd(), 'Failed to close ussd popup.')
        self.is_ussd_open = False

        service_interrogate_msg = 'Call waiting\nService was enabled for:\nVoice\nSync'
        LOG.info(
            'Check that USSD msg indicate that service has been activated.')
        self.assertEqual(
            msg, service_interrogate_msg,
            'Found "%s" instead of "%s"' % (msg, service_interrogate_msg))

        LOG.info('Initiate a call from %s to %s.' % (self.phone1, self.phone2))
        self.assertTrue(Dialer.dial_number(self.phone2_number))

        LOG.info('Activate %s' % self.phone2)
        dut_manager.activate_phone(self.phone2)

        LOG.info('Answer incoming call.')
        Dialer.answer_call()  # I wish I could do an assert here
        self.is_call_active2 = True

        LOG.info('Activate %s' % self.phone1)
        dut_manager.activate_phone(self.phone1)

        LOG.info('Check if call is active with %s.' % self.phone2_number)
        self.assertTrue(Dialer.is_call_active(self.phone2_number),
                        'Call is inactive.')

        LOG.info('Activate %s' % self.phone3)
        dut_manager.activate_phone(self.phone3)

        LOG.info('Launch Dialer.')
        Dialer.launch()
        self.assertTrue(Dialer.dialer_launched(), 'Dialer failed to launch.')

        LOG.info('Initiate a call from %s to %s.' % (self.phone3, self.phone1))
        self.assertTrue(Dialer.dial_number(self.phone1_number),
                        'Failed to initiate call.')
        self.is_call_active3 = True

        LOG.info('Activate %s' % self.phone1)
        dut_manager.activate_phone(self.phone1)

        LOG.info('Check that there is an incoming call from %s' %
                 self.phone3_number)
        self.assertTrue(Dialer.check_incoming_call(self.phone3_number),
                        'No incoming call from %s.' % self.phone3_number)

        LOG.info('Activate %s' % self.phone3)
        dut_manager.activate_phone(self.phone3)

        LOG.info('End call with %s.' % self.phone1_number)
        self.assertTrue(Dialer.end_call(),
                        'Failed to end call with %s.' % self.phone1_number)
        self.is_call_active3 = False

        LOG.info('Activate %s' % self.phone2)
        dut_manager.activate_phone(self.phone2)

        LOG.info('End call with %s.' % self.phone1_number)
        self.assertTrue(Dialer.end_call(),
                        'Failed to end call with %s.' % self.phone1_number)
        self.is_call_active2 = False

        LOG.info('Activate %s' % self.phone1)
        dut_manager.activate_phone(self.phone1)

        LOG.info('Launch Dialer.')
        Dialer.launch()
        self.assertTrue(Dialer.dialer_launched(), 'Dialer failed to launch.')

        LOG.info('Deactivate call waiting using code (%s).' %
                 self.deactivate_call_waiting_nr)
        self.assertTrue(
            Dialer.dial_number(self.deactivate_call_waiting_nr),
            'Failed to deactivate call waiting using code (%s).' %
            self.deactivate_call_waiting_nr)
        self.is_call_waiting_disabled = True

        LOG.info('Check that USSD popup is open.')
        self.assertTrue(Dialer.is_ussd_open(), 'USSD popup not open.')
        self.is_ussd_open = True

        LOG.info('Get USSD message.')
        msg = Dialer.get_ussd_message()
        LOG.info('Found msg: %s' % msg)

        LOG.info('Close USSD popup.')
        self.assertTrue(Dialer.close_ussd(), 'Failed to close ussd popup.')
        self.is_ussd_open = False

        service_disabled_msg = 'Call waiting\nService has been disabled.'
        LOG.info(
            'Check that USSD msg indicate that service has been disabled.')
        self.assertEqual(
            msg, service_disabled_msg,
            'Found "%s" instead of "%s"' % (msg, service_disabled_msg))

        LOG.info('Interrogate call waiting using code (%s).' %
                 self.interrogate_call_waiting_nr)
        self.assertTrue(
            Dialer.dial_number(self.interrogate_call_waiting_nr),
            'Failed to interrogate call waiting using code (%s).' %
            self.interrogate_call_waiting_nr)

        LOG.info('Check that USSD popup is open.')
        self.assertTrue(Dialer.is_ussd_open(), 'USSD popup not open.')
        self.is_ussd_open = True

        LOG.info('Get USSD message.')
        msg = Dialer.get_ussd_message()
        LOG.info('Found msg: %s' % msg)

        LOG.info('Close USSD popup.')
        self.assertTrue(Dialer.close_ussd(), 'Failed to close ussd popup.')
        self.is_ussd_open = False

        service_interrogate_msg = service_disabled_msg
        LOG.info(
            'Check that USSD msg indicate that service has been disabled.')
        self.assertEqual(
            msg, service_interrogate_msg,
            'Found "%s" instead of "%s"' % (msg, service_interrogate_msg))

        LOG.info('Initiate a call from %s to %s.' % (self.phone1, self.phone2))
        self.assertTrue(Dialer.dial_number(self.phone2_number))

        LOG.info('Activate %s' % self.phone2)
        dut_manager.activate_phone(self.phone2)

        LOG.info('Answer incoming call.')
        Dialer.answer_call()  # I wish I could do an assert here
        self.is_call_active2 = True

        LOG.info('Activate %s' % self.phone1)
        dut_manager.activate_phone(self.phone1)

        LOG.info('Check if call is active with %s.' % self.phone2_number)
        self.assertTrue(Dialer.is_call_active(self.phone2_number),
                        'Call is inactive.')

        LOG.info('Activate %s' % self.phone3)
        dut_manager.activate_phone(self.phone3)

        LOG.info('Launch Dialer.')
        Dialer.launch()
        self.assertTrue(Dialer.dialer_launched(), 'Dialer failed to launch.')

        LOG.info('Initiate a call from %s to %s.' % (self.phone3, self.phone1))
        self.assertTrue(Dialer.dial_number(self.phone1_number),
                        'Failed to initiate call.')
        self.is_call_active3 = True

        LOG.info('Activate %s' % self.phone1)
        dut_manager.activate_phone(self.phone1)

        LOG.info('Check that there is no incoming call from %s' %
                 self.phone3_number)
        self.assertFalse(Dialer.check_incoming_call(self.phone3_number),
                         'Found incoming call from %s.' % self.phone3_number)

        LOG.info('Activate %s' % self.phone3)
        dut_manager.activate_phone(self.phone3)

        # If voice mail is active, call is redirected to it
        # Otherwise line will be busy
        LOG.info(
            'Check if call is active with %s (redirected to voice mail).' %
            self.phone1_number)
        if Dialer.is_call_active(self.phone1_number):
            LOG.info('Call was redirected to voice mail.')

            LOG.info('End call with %s.' % self.phone1_number)
            self.assertTrue(Dialer.end_call(),
                            'Failed to end call with %s.' % self.phone1_number)
        else:
            LOG.info('Line was busy.')
        self.is_call_active3 = False

        LOG.info('Activate %s' % self.phone2)
        dut_manager.activate_phone(self.phone2)

        LOG.info('End call with %s.' % self.phone1_number)
        self.assertTrue(Dialer.end_call(),
                        'Failed to end call with %s.' % self.phone1_number)
        self.is_call_active2 = False