def uiconfig_test(device): assert (ga2.load_uiconfig("uiconfig.yml")) device.home() ga2.click_element(ga2.By.ID_IN_UICONFIG, "CLOCK_ICON") ga2.click_element(ga2.By.ID_IN_UICONFIG, "TIMER") ga2.click_element(ga2.By.ID_IN_UICONFIG, "TIMER_START") time.sleep(3) ga2.click_element(ga2.By.ID_IN_UICONFIG, "TIMER_STOP") device.home() assert (ga2.ErrType.ERR_SUCCEED == device.launch_app( os.environ.get("PKGNAME", "com.tencent.wetest.demo"))) time.sleep(5) if ga2.is_cloud_mode(): reporter.Reporter().screenshot() # assert(device.init_engine_sdk()==ga2.ERR_SUCCEED) # lazy init when calling engine connector (if not init) assert (ga2.wait_element(ga2.By.ID_IN_UICONFIG, "FindElements", timeout=20)) assert (ga2.touch_element(ga2.By.ID_IN_UICONFIG, "FindElements")) assert (ga2.touch_element(ga2.By.ID_IN_UICONFIG, "Level4")) print(device.display_size()) assert (ga2.touch_element(ga2.By.ID_IN_UICONFIG, "Planet")) assert (ga2.touch_element(ga2.By.ID_IN_UICONFIG, "Game_Back")) assert (ga2.wait_element(ga2.By.ID_IN_UICONFIG, "FindElements")) assert (ga2.touch_element(ga2.By.ID_IN_UICONFIG, "FindElements")) assert (ga2.wait_element(ga2.By.ID_IN_UICONFIG, "Planet_Test")) assert (ga2.touch_element(ga2.By.ID_IN_UICONFIG, "Planet_Test"))
def wait_fail_test(): assert (ga2.wait_element(ga2.By.NAME_IN_ENGINE, "badboy", timeout=6))
def wait_test(): elem = ga2.wait_element(ga2.By.NAME_IN_ENGINE, "/Canvas/Panel/Interaction") if elem is None: logger.error("element is not found")