1""" 2 3 Copyright (C) 2023 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 17 Test of searching contact by Phone number name 18 19 Steps include: 20 1) Precall state check on Seahawk and phone devices. 21 2) Upload contacts.vcf to device. 22 3) Search contact on Seahawk by Phone number. 23 4) Assert uploaded contact present in search result 24""" 25 26from utilities import constants 27from utilities.main_utils import common_main 28from bluetooth_test import bluetooth_base_test 29 30class SearchContactByPhoneNumberTest(bluetooth_base_test.BluetoothBaseTest): 31 32 def setup_test(self): 33 #Upload contacts to phone device 34 file_path = constants.PATH_TO_CONTACTS_VCF_FILE 35 #TODO- retest again after (b/308018112) is fixed. 36 #contacts were loading manually fpr testing 37 self.call_utils.upload_vcf_contacts_to_device(self.target, file_path) 38 # Pair the devices 39 self.bt_utils.pair_primary_to_secondary() 40 super().enable_recording() 41 42 43 def test_search_contact_by_phone_number(self): 44 """Tests search contact by Phone number.""" 45 expected_phone_number = constants.EXPECTED_PHONE_NUMBER 46 expected_contact_name = constants.EXPECTED_CONTACT_FULL_NAME 47 self.call_utils.open_phone_app() 48 self.call_utils.open_contacts() 49 self.call_utils.search_contact_by_name( 50 expected_phone_number 51 ) 52 self.call_utils.verify_search_results_contain_target_search( 53 expected_contact_name 54 ) 55 56if __name__ == '__main__': 57 common_main()