1""" Test that call history shows correct calls records 2 3- Requires a testbed with one phones in it that can make calls. 4 5 6 Steps include: 71. Tap on Phone icon from facet rail or App launcher to launch Dialer app 82. Tap on 'Call History' menu to see recent calls 93. Verify that all Incoming and outgoing calls are showing under call history 104. Verify HU Calls records are matching with paired phone call records 11 12NOTE: The original CUJ requires a check on the number of arrows shown below each call, which 13is beyond automation capabilities at this time. This 14test will need to be expanded in the future to cover this functionality. 15 16""" 17 18import logging 19 20from utilities import constants 21from utilities.main_utils import common_main 22from bluetooth_test import bluetooth_base_test 23 24from mobly import asserts 25 26class VerifyCallHistory(bluetooth_base_test.BluetoothBaseTest): 27 """Implement verify call history test.""" 28 29 # In order to test a number greater than three, this test needs to be rewritten 30 # to handle scrolling for multiple unique call entries. 31 TEST_CALLS = 3 32 33 def setup_test(self): 34 """Setup steps before any test is executed.""" 35 # Pair the devices 36 self.bt_utils.pair_primary_to_secondary() 37 super().enable_recording() 38 39 def test_verify_call_history(self): 40 """ 41 Assumes a new phone image with no call history. 42 """ 43 # Set up mobile device 44 contact_name = "Adam Allen" 45 primary_test_number = constants.DIALER_THREE_DIGIT_NUMBER 46 secondary_test_number = constants.INFORMATION_THREE_DIGIT_NUMBER 47 48 49 # Call each test number 50 self.call_utils.dial_a_number(primary_test_number) 51 self.call_utils.make_call() 52 self.call_utils.end_call() 53 54 self.call_utils.dial_a_number(secondary_test_number) 55 self.call_utils.make_call() 56 self.call_utils.end_call() 57 58 # Open up call history 59 self.call_utils.press_home() 60 self.call_utils.wait_with_log(1) 61 self.call_utils.open_phone_app() 62 self.call_utils.wait_with_log(1) 63 self.call_utils.open_call_history() 64 self.call_utils.wait_with_log(1) 65 66 # TODO: This test may be upgraded to get the number of history entries from the 67 # target device for comparison, and to compare call history type (i.e., 'correct arrows') 68 asserts.assert_true( 69 self.discoverer.mbs.hasUIElementWithText(contact_name), 70 "Expected name %s in call history, but did not see it on screen" 71 % contact_name 72 ) 73 74 asserts.assert_true( 75 self.discoverer.mbs.hasUIElementWithText(secondary_test_number), 76 "Expected number %s in call history, but did not see it on screen" 77 % secondary_test_number 78 ) 79 80 self.call_utils.press_home() 81 logging.info("Both expected numbers found in call history.") 82 self.call_utils.wait_with_log(constants.WAIT_TWO_SECONDS) 83 84 85 def teardown_test(self): 86 # End call if test failed 87 self.call_utils.end_call_using_adb_command(self.target) 88 self.call_utils.wait_with_log(5) 89 self.call_utils.press_home() 90 super().teardown_test() 91 92if __name__ == '__main__': 93 common_main()