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 shown found contacts
18
19 Steps include:
20        1) Precall state check on Seahawk and phone devices.
21        2) Upload contacts.vcf to device.
22        3) Open Dialpad and enter existent contact number
23        4) All Contacts having this number in it will display on right side of
24         dialpad in contact search
25"""
26
27from utilities import constants
28from utilities.main_utils import common_main
29from bluetooth_test import bluetooth_base_test
30
31class SearchShowingFoundContact(bluetooth_base_test.BluetoothBaseTest):
32
33    def setup_test(self):
34     #Upload contacts to phone device
35     file_path = constants.PATH_TO_CONTACTS_VCF_FILE
36     #TODO- retest again after (b/308018112) is fixed.
37     #contacts were loading manually fpr testing
38     self.call_utils.upload_vcf_contacts_to_device(self.target, file_path)
39     # Pair the devices
40     self.bt_utils.pair_primary_to_secondary()
41     super().enable_recording()
42
43
44    def test_search_contact_by_phone_number(self):
45       """Tests search contact by Phone number."""
46       expected_contact_full_name = constants.EXPECTED_CONTACT_FULL_NAME
47       first_digit_of_search_contact_number = constants.FIRST_DIGIT_OF_SEARCH_CONTACT_NUMBER
48       self.call_utils.open_phone_app()
49       self.call_utils.dial_a_number(first_digit_of_search_contact_number)
50       self.call_utils.wait_with_log(3)
51       self.call_utils.verify_search_results_contain_target_search(
52           expected_contact_full_name
53       )
54
55if __name__ == '__main__':
56    common_main()