Ejemplo n.º 1
0
def _prepare():
    # 准备工作
    # 清理QQ、微信账号,清理游戏数据确保每次启动的逻辑是一样的。然后,拉起游戏
    env = os.environ.get("PLATFORM_IP")
    logger = manager.get_logger()
    lanuch_result = False
    if env:
        lanuch_result = _cloud_prepare()
    else:
        lanuch_result = _native_prepare()

    if lanuch_result:
        # 拉起成功,通常游戏会有一段过场动画,这时候并不一定会启动我们这边的sdk,我们需要不断的尝试连接SDK。如果,连接成功获取sdk版本号则游戏已经启动
        logger.debug("Launch package {0} SUCCESS,try to connect U3DAutomation SDK".format(os.environ["PKGNAME"]))
        global engine
        engine = manager.get_engine()
        version = None
        for i in range(30):
            try:
                version = engine.get_sdk_version()
                if version:
                    logger.debug(version)
                    manager.save_sdk_version(version)
                    return True
            except:
                time.sleep(2)
    return False
Ejemplo n.º 2
0
def _prepare():
    #clear qq,wechat and game datax on device to make sure a stable test environment, and then launch the game.
    env = os.environ.get("PLATFORM_IP")
    logger = manager.get_logger()
    lanuch_result = False
    if env:
        lanuch_result = _cloud_prepare()
    else:
        lanuch_result = _native_prepare()

    if lanuch_result:
        #launch success. in general , a game may have a loading phase in which the sdk has not been launched. So we try to connect SDK in a loop.
        logger.debug("Launch package {0} SUCCESS,try to connect U3DAutomation SDK".format(os.environ["PKGNAME"]))
        global engine
        engine = manager.get_engine()
        version = None
        for i in range(30):
            try:
                version = engine.get_sdk_version()
                if version:
                    logger.debug(version)
                    manager.save_sdk_version(version)
                    return True
            except:
                time.sleep(2)
    return False
Ejemplo n.º 3
0
def _prepare():
    # 准备工作
    # 清理QQ、微信账号,清理游戏数据确保每次启动的逻辑是一样的。然后,拉起游戏
    env = os.environ.get("PLATFORM_IP")
    logger = manager.get_logger()
    lanuch_result = False
    if env:
        lanuch_result = _cloud_prepare()
    else:
        lanuch_result = _native_prepare()

    if lanuch_result:
        # 拉起成功,通常游戏会有一段过场动画,这时候并不一定会启动我们这边的sdk,我们需要不断的尝试连接SDK。如果,连接成功获取sdk版本号则游戏已经启动
        logger.debug(
            "Launch package {0} SUCCESS,try to connect U3DAutomation SDK".
            format(os.environ["PKGNAME"]))
        global engine
        engine = manager.get_engine()
        version = None
        for i in range(30):
            try:
                version = engine.get_sdk_version()
                if version:
                    logger.debug(version)
                    manager.save_sdk_version(version)
                    return True
            except:
                time.sleep(2)
    return False
Ejemplo n.º 4
0
def _prepare():
    # 准备工作
    # 清理QQ、微信账号,清理游戏数据确保每次启动的逻辑是一样的。然后,拉起游戏
    env = os.environ.get("PLATFORM_IP")
    logger = manager.get_logger()
    lanuch_result = False
    if env:
        lanuch_result = _cloud_prepare()
    else:
        lanuch_result = _native_prepare()

    if lanuch_result:
        # 拉起成功,通常游戏会有一段过场动画,这时候并不一定会启动我们这边的sdk,我们需要不断的尝试连接SDK。如果,连接成功获取sdk版本号则游戏已经启动
        logger.debug(
            "Launch package {0} SUCCESS,try to connect U3DAutomation SDK".
            format(os.environ["PKGNAME"]))
        global engine
        engine = manager.get_engine()
        version = None
        for i in range(30):
            try:
                # 开场msdk提示
                allow = device.ui_device(className="android.widget.Button")
                if allow and allow.exists:
                    logger.debug("find popup windows click")
                    allow.click.wait()
                    device.excute_adb("shell input tap 20 20")
                    time.sleep(5)
                version = engine.get_sdk_version()
                if version:
                    logger.debug(version)
                    manager.save_sdk_version(version)
                    return True
            except:
                time.sleep(2)
    return False