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)
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)
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)
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])
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])
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 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 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)
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)
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)
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)