class TestReceiveCallWithContactPhoto(GaiaTestCase): def setUp(self): try: self.testvars['plivo'] except KeyError: raise SkipTest( 'Plivo account details not present in test variables') GaiaTestCase.setUp(self) with open(self.resource('IMG_0001.jpg'), 'rb') as f: encoded_string = base64.b64encode(f.read()) self.contact = MockContact() self.contact.update(photo='%s' % encoded_string, tel={ 'type': 'Mobile', 'value': self.testvars['plivo']['phone_number'] }) self.data_layer.insert_contact(self.contact) def test_dialer_receive_call_with_contact_photo(self): """ https://moztrap.mozilla.org/manage/case/1544/ """ PLIVO_TIMEOUT = 30 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['local_phone_numbers'][0].replace('+', ''), timeout=PLIVO_TIMEOUT) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call() self.assertIn('background-image:', call_screen.contact_background_style) def tearDown(self): self.plivo.hangup_call(self.call_uuid) GaiaTestCase.tearDown(self)
class TestReceiveCallWithContactPhoto(GaiaTestCase): def setUp(self): try: self.testvars['plivo'] except KeyError: raise SkipTest('Plivo account details not present in test variables') GaiaTestCase.setUp(self) with open(self.resource('IMG_0001.jpg'), 'rb') as f: encoded_string = base64.b64encode(f.read()) self.contact = MockContact() self.contact.update(photo='%s' % encoded_string, tel={'type': 'Mobile', 'value': self.testvars['plivo']['phone_number']}) self.data_layer.insert_contact(self.contact) def test_dialer_receive_call_with_contact_photo(self): """ https://moztrap.mozilla.org/manage/case/1544/ """ PLIVO_TIMEOUT = 30 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['local_phone_numbers'][0].replace('+', ''), timeout=PLIVO_TIMEOUT) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call() self.assertIn('background-image:', call_screen.contact_background_style) def tearDown(self): self.plivo.hangup_call(self.call_uuid) GaiaTestCase.tearDown(self)
class TestReceiveCallFromKnownContactNotification(GaiaTestCase): def setUp(self): try: self.testvars["plivo"] except KeyError: raise SkipTest("Plivo account details not present in test variables") GaiaTestCase.setUp(self) self.contact = MockContact() self.contact.update(tel={"type": "Mobile", "value": self.testvars["plivo"]["phone_number"]}) self.data_layer.insert_contact(self.contact) def test_dialer_miss_call_from_known_contact_notification(self): """ https://moztrap.mozilla.org/manage/case/9294/ """ self.device.lock() 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 lock_screen = LockScreen(self.marionette) lock_screen.switch_to_frame() lock_screen.wait_for_notification() # Check if the screen is turned on self.assertTrue(self.device.is_screen_enabled) # Verify the user sees a missed call notification message # and the known contacts info is shown. self.assertTrue(lock_screen.notifications[0].is_visible) self.assertEqual(lock_screen.notifications[0].title, "Missed call") self.assertTrue(self.contact.givenName in lock_screen.notifications[0].content) self.device.unlock() system = System(self.marionette) system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Verify the user sees the missed call event in the notification center # and the known contacts info is shown. notifications = utility_tray.notifications self.assertEqual(notifications[0].title, "Missed call") self.assertTrue(self.contact.givenName in notifications[0].content) def tearDown(self): # Switch back to main frame before Marionette loses track bug #840931 self.marionette.switch_to_frame() # In case an 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)
class TestReceiveCallFromKnownContactNotification(GaiaTestCase): def setUp(self): try: self.testvars['plivo'] except KeyError: raise SkipTest( 'Plivo account details not present in test variables') GaiaTestCase.setUp(self) self.contact = MockContact() self.contact.update(tel={ 'type': 'Mobile', 'value': self.testvars['plivo']['phone_number'] }) self.data_layer.insert_contact(self.contact) def test_dialer_miss_call_from_known_contact_notification(self): """ https://moztrap.mozilla.org/manage/case/9294/ """ PLIVO_TIMEOUT = 30 self.device.lock() 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['local_phone_numbers'][0].replace('+', ''), timeout=PLIVO_TIMEOUT) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call_with_locked_screen() self.plivo.hangup_call(self.call_uuid) 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 # Verify the user sees a missed call notification message # and the known contacts info is shown. system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed() lock_screen = LockScreen(self.marionette) notifications = lock_screen.notifications self.assertEqual(notifications[0].title, 'Missed call') self.assertTrue(self.contact.givenName in notifications[0].content) system.wait_for_notification_toaster_not_displayed() # Verify the user sees the missed call event in the notification center # and the known contacts info is shown. self.device.unlock() system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() notifications = utility_tray.notifications self.assertEqual(notifications[0].title, 'Missed call') self.assertTrue(self.contact.givenName in notifications[0].content) def tearDown(self): # Switch back to main frame before Marionette loses track bug #840931 self.marionette.switch_to_frame() # In case an 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)
class TestReceiveCallFromKnownContactNotification(GaiaTestCase): def setUp(self): try: self.testvars['plivo'] except KeyError: raise SkipTest('Plivo account details not present in test variables') GaiaTestCase.setUp(self) self.contact = MockContact() self.contact.update(tel={ 'type': 'Mobile', 'value': self.testvars['plivo']['phone_number']} ) self.data_layer.insert_contact(self.contact) def test_dialer_miss_call_from_known_contact_notification(self): """ https://moztrap.mozilla.org/manage/case/9294/ """ PLIVO_TIMEOUT = 30 self.device.lock() 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=PLIVO_TIMEOUT) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call_with_locked_screen() self.plivo.hangup_call(self.call_uuid) self.call_uuid = None # Verify the user sees a missed call notification message # and the known contacts info is shown. system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed() lock_screen = LockScreen(self.marionette) notifications = lock_screen.notifications self.assertEqual(notifications[0].title, 'Missed call') self.assertTrue(self.contact.givenName in notifications[0].content) system.wait_for_notification_toaster_not_displayed() # Verify the user sees the missed call event in the notification center # and the known contacts info is shown. self.device.unlock() system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() notifications = utility_tray.notifications self.assertEqual(notifications[0].title, 'Missed call') self.assertTrue(self.contact.givenName in notifications[0].content) def tearDown(self): # Switch back to main frame before Marionette loses track bug #840931 self.marionette.switch_to_frame() # In case an 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)