1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package android.platform.test.scenario.tapl_common
17 
18 import android.platform.uiautomator_helpers.DeviceHelpers.waitForObj
19 import androidx.test.uiautomator.BySelector
20 
21 /** Wrapper of UiDevice for finding TAPL UI objects and performing flake-free gestures. */
22 object TaplUiDevice {
23     /**
24      * Waits for a UI object with a given selector. Fails if the object is not visible.
25      *
26      * @param [selector] Selector for the ui object.
27      * @param [objectName] Name of the object for diags
28      * @return The found UI object.
29      */
30     @JvmStatic
waitForObjectnull31     fun waitForObject(selector: BySelector, objectName: String): TaplUiObject {
32         val uiObject = waitForObj(selector)
33         return TaplUiObject(uiObject, objectName)
34     }
35 }
36