Esempio n. 1
0
def _load_avd_manifest():
    avd_manifest_dir = make_path_absolute(ArgLoader.get_manifest_dir(ArgLoader.AVD_MANIFEST_DIR_KEY))

    if avd_manifest_dir is None:
        message = ("AvdManifest file directory was not found. Check if config_files_dir.json exists in root of"
                   + "project. Otherwise check if it's linking to existing file.")
        raise LauncherFlowInterruptedException(TAG, message)
    else:
        avd_manifest = AvdManifest(avd_manifest_dir)
        Printer.system_message(TAG, "Created AvdManifest from file: " + Color.GREEN + avd_manifest_dir + Color.BLUE
                               + ".")
    return avd_manifest
def _load_launch_plan_manifest():
    launch_manifest_dir = make_path_absolute(ArgLoader.get_manifest_dir(ArgLoader.LAUNCH_MANIFEST_DIR_KEY))

    if launch_manifest_dir is None:
        message = ("LaunchManifest file directory was not found. Check if config_files_dir.json exists in root " 
                   "of project. Otherwise check if it's linking to existing file.")
        raise LauncherFlowInterruptedException(TAG, message)
    else:
        launch_manifest = LaunchManifest(launch_manifest_dir)
        Printer.system_message(TAG, "Created LaunchManifest from file: " + Color.GREEN + launch_manifest_dir
                               + Color.BLUE + ".")
    return launch_manifest
Esempio n. 3
0
def _load_paths_to_global_settings(path_set):
    GlobalConfig.SDK_DIR = clean_folder_only_dir(
        (path_set.paths["sdk_dir"]).path_value)
    if GlobalConfig.SDK_DIR == "":
        Printer.system_message(
            TAG,
            "SDK path not set in PathManifest. Will use path set in env variable "
            + Color.GREEN + "ANDROID_HOME" + Color.BLUE + ".")
        if ANDROID_HOME_ENV is None:
            message = "Env variable 'ANDROID_HOME' is not set. Launcher will quit."
            raise LauncherFlowInterruptedException(TAG, message)
        else:
            GlobalConfig.SDK_DIR = clean_folder_only_dir(
                make_path_absolute(ANDROID_HOME_ENV))
    Printer.system_message(
        TAG, "Launcher will look for SDK in dir: " + Color.GREEN +
        GlobalConfig.SDK_DIR + Color.BLUE + ".")

    GlobalConfig.AVD_DIR = clean_folder_only_dir(
        (path_set.paths["avd_dir"]).path_value)
    if GlobalConfig.AVD_DIR == "":
        Printer.system_message(
            TAG, "AVD path not set in PathManifest. "
            "Will use path set in env variable 'ANDROID_SDK_HOME'.")
        if ANDROID_SDK_HOME_ENV is None:
            Printer.system_message(
                TAG, "Env variable 'ANDROID_SDK_HOME' is not set. "
                "Trying to recreate default path from user root.")
            GlobalConfig.AVD_DIR = clean_folder_only_dir(
                make_path_absolute(HOME)) + ".android"
    Printer.system_message(
        TAG, "Launcher will look for AVD images in dir: " + Color.GREEN +
        GlobalConfig.AVD_DIR + Color.BLUE + ".")

    GlobalConfig.PROJECT_ROOT_DIR = clean_folder_only_dir(
        make_path_absolute((path_set.paths["project_root_dir"]).path_value))
    if GlobalConfig.PROJECT_ROOT_DIR == "":
        Printer.system_message(
            TAG,
            "Project root was not specified. This field is not obligatory.")
        Printer.error(
            TAG,
            "Warning: Without project root directory launcher will quit if no "
            ".*apk files will be found in directory loaded from 'apk_dir' field of PathManifest."
        )
    else:
        Printer.system_message(
            TAG, "Android project root dir set to: " + Color.GREEN +
            GlobalConfig.PROJECT_ROOT_DIR + Color.BLUE + ".")

    GlobalConfig.APK_DIR = clean_folder_only_dir(
        make_path_absolute((path_set.paths["apk_dir"]).path_value))
    if GlobalConfig.APK_DIR == "":
        message = "Directory with .*apk files was not specified. Launcher will quit."
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Launcher will look for .*apk files in dir: " + Color.GREEN +
        GlobalConfig.APK_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_DIR = clean_folder_only_dir(
        (path_set.paths["output_dir"]).path_value)
    if GlobalConfig.OUTPUT_DIR == "":
        Printer.system_message(
            TAG,
            "Output path not set in PathManifest. Default value will be used.")
        GlobalConfig.OUTPUT_DIR = OUTPUT_DIR_DEFAULT
    if not os.path.isabs(GlobalConfig.OUTPUT_DIR):
        message = "Path " + GlobalConfig.OUTPUT_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Launcher will generate log from tests in dir: " + Color.GREEN +
        GlobalConfig.OUTPUT_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_SUMMARY_LOG_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_SUMMARY_LOG_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_SUMMARY_LOG_DIR):
        message = "Path " + GlobalConfig.OUTPUT_SUMMARY_LOG_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Summary log will be stored in dir: " + Color.GREEN +
        GlobalConfig.OUTPUT_SUMMARY_LOG_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_AVD_LOG_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_AVD_LOG_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_AVD_LOG_DIR):
        message = "Path " + GlobalConfig.OUTPUT_AVD_LOG_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Logs from AVD will be stored in dir: " + Color.GREEN +
        GlobalConfig.OUTPUT_AVD_LOG_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_TEST_LOG_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_TEST_LOG_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_TEST_LOG_DIR):
        message = "Path " + GlobalConfig.OUTPUT_TEST_LOG_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Logs from tests will be stored in dir: " + Color.GREEN +
        GlobalConfig.OUTPUT_TEST_LOG_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_TEST_LOGCAT_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_TEST_LOGCAT_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_TEST_LOGCAT_DIR):
        message = "Path " + GlobalConfig.OUTPUT_TEST_LOGCAT_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Logcat logs from tests will be stored in dir: " + Color.GREEN +
        GlobalConfig.OUTPUT_TEST_LOGCAT_DIR + Color.BLUE + ".")

    GlobalConfig.DEVICE_VIDEO_STORAGE_DIR = clean_folder_only_dir(
        DEVICE_VIDEO_STORAGE_FOLDER_DEFAULT)
    Printer.system_message(
        TAG,
        "Firstly recordings will be saved in root directory of test device storage in "
        + Color.GREEN + GlobalConfig.DEVICE_VIDEO_STORAGE_DIR + Color.BLUE +
        " folder.")

    GlobalConfig.OUTPUT_TEST_RECORDINGS_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_TEST_VIDEO_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_TEST_RECORDINGS_DIR):
        message = "Path " + GlobalConfig.OUTPUT_TEST_RECORDINGS_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG,
        "Secondly recordings from tests will be pulled from each device to dir: "
        + Color.GREEN + GlobalConfig.OUTPUT_TEST_RECORDINGS_DIR + Color.BLUE +
        ".")

    GlobalConfig.OUTPUT_STYLES_FOLDER_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_HTML_STYLES_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_STYLES_FOLDER_DIR):
        message = "Path " + GlobalConfig.OUTPUT_STYLES_FOLDER_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Styles for all html logs will be stored in dir: " + Color.GREEN +
        GlobalConfig.OUTPUT_STYLES_FOLDER_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_LOGCAT_HTML_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR + OUTPUT_TEST_LOGCAT_HTML_FOLDER_DEFAULT)
    if not os.path.isabs(GlobalConfig.OUTPUT_LOGCAT_HTML_DIR):
        message = "Path " + GlobalConfig.OUTPUT_TEST_RECORDINGS_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG,
        "Html logs presenting logcats from devices will be stored in dir: " +
        Color.GREEN + GlobalConfig.OUTPUT_LOGCAT_HTML_DIR + Color.BLUE + ".")

    GlobalConfig.OUTPUT_INDEX_HTML_DIR = clean_folder_only_dir(
        GlobalConfig.OUTPUT_DIR) + OUTPUT_HTML_INDEX_FILE_NAME
    if not os.path.isabs(GlobalConfig.OUTPUT_INDEX_HTML_DIR):
        message = "Path " + GlobalConfig.OUTPUT_TEST_RECORDINGS_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG,
        "All html logs containing results from tests, logcats and videos can be accessed from "
        + Color.GREEN + GlobalConfig.OUTPUT_INDEX_HTML_DIR + Color.BLUE +
        " file generated after " + "session ends.")

    GlobalConfig.LOG_GENERATOR_DIR = clean_folder_only_dir(
        LOG_GENERATOR_DIR_DEFAULT)
    if not os.path.isabs(GlobalConfig.LOG_GENERATOR_DIR):
        message = "Path " + GlobalConfig.LOG_GENERATOR_DIR + " needs to be absolute!"
        raise LauncherFlowInterruptedException(TAG, message)
    Printer.system_message(
        TAG, "Logs will be generated with usage of " + Color.GREEN +
        "LogGenerator.py" + Color.BLUE + " file stored in dir: " +
        Color.GREEN + GlobalConfig.LOG_GENERATOR_DIR + Color.BLUE + ".")