Beispiel #1
0
def setup_and_test_tls():
    if not nextbox_sub_ensure(7):
        return False

    button_xp = '//*[@id="app-content-vue"]/div/div/div/div/button'

    if not input_into_text_field(
            '//*[@id="app-content-vue"]/div/div/div/div/input', conf["email"]):

        chat("mmmh, TLS already enabled, uha: this might be painful...")

        if not test_and_click_button(button_xp):
            return False

        chat(
            "now waiting (~15secs) for apache restart => jump back to non-https (i.e., recurse!)"
        )

        br.delete_all_cookies()

        sleep(5)
        return setup_and_test_tls()

    sleep(1)

    if not test_and_click_button(button_xp):
        chat("cannot click button to activate, giving up...")
        return False

    chat(
        "ok, certificate is on the way, let's wait some secs then check, if it works"
    )
    sleep(10)

    return test_for_valid_login_page(conf["static_domain"], "https")
Beispiel #2
0
def setup_and_test_proxy():
    if not nextbox_sub_ensure(5):
        return False

    input_xp = '//*[@id="app-content-vue"]/div/div[2]/input'
    button_xp = '//*[@id="app-content-vue"]/div/div[2]/button'

    but = get_xpath(button_xp)
    inp = get_xpath(input_xp)

    # no input? means proxy is active!
    if not inp:
        chat("proxy is enabled, disabling first")
        but.click()

    ret = input_into_text_field(input_xp, conf["proxy_domain"])
    if not ret:
        chat("failed input of proxy_domain")
        return False

    if not test_and_click_button(button_xp):
        chat("failed button click")
        return False

    chat("checking 'new' login page now")
    return test_for_valid_login_page(conf["proxy_domain"], "https")
Beispiel #3
0
def storages_backup_avail():
    if not nextbox_sub_ensure(2):
        return False

    info = storages_info()
    if len(info["bottom"]) > 0:
        for el in info["bottom"]:
            el.click()
Beispiel #4
0
def storages_roundtrip():
    if not nextbox_sub_ensure(2):
        return False

    # click on all mount/unmount you find
    info = storages_info()
    for el in info["top"] + info["bottom"]:
        el.click()
    return True
Beispiel #5
0
def backup_test():
    if not nextbox_sub_ensure(3):
        return False

    cont_button_xp = '//*[@id="app-content-vue"]/div/div/button'

    # if this button exists, then we've a not cleaned up backup
    wait_for_xpath(cont_button_xp, 5)
    continue_button = get_xpath(cont_button_xp)

    if continue_button.is_enabled():
        chat("someone left his stuff here, cleaning up...")
        click_xpath(cont_button_xp)

    xp_dropdown = '//*[@id="app-content-vue"]/div/div[1]/div[1]/div[2]/input'
    if not wait_for_xpath(xp_dropdown, 5):
        return False

    # storage dropdown input field
    click_xpath(xp_dropdown)
    chat("chooosing target storage - 1st click the dropdown")

    # now select first storage
    click_xpath(
        '//*[@id="app-content-vue"]/div/div[1]/div[1]/div[3]/ul/li[1]/span/div/span[1]'
    )
    chat("now click to choose")

    # now click into input field
    input_into_text_field('//*[@id="app-content-vue"]/div/div[1]/input',
                          "xxxtest_backup_name")

    chat("enter our designated backup name")
    if not test_and_click_button(
            '//*[@id="app-content-vue"]/div/div[1]/button'):
        return False

    wait_for_xpath(cont_button_xp, 5)
    continue_button = get_xpath(cont_button_xp)

    log(f"waiting for backup...", " B ", end=" ", no_pad=False, flush=True)
    while not continue_button.is_enabled():
        log(".", "", end="", no_pad=True, flush=True)
        sleep(0.5)
    print()

    banner_msg = get_xpath('//*[@id="app-content-vue"]/div/div/span').text

    # don't leave the backup un-cleaned-up
    click_xpath(cont_button_xp)

    if banner_msg == "Completed Backup successfully":
        return True

    return False
Beispiel #6
0
def storages_info():
    if not nextbox_sub_ensure(2):
        return False

    items_mounted = '//*[@id="app-content-vue"]/div/div[1]/*/button'
    items_unmounted = '//*[@id="app-content-vue"]/div/div[2]/*/button'

    top = get_xpath(items_mounted, as_list=True)
    bottom = get_xpath(items_unmounted, as_list=True)

    chat(f"storages: top: #{top} - bottom: #{bottom}")
    return {"top": top or [], "bottom": bottom or []}
Beispiel #7
0
def setup_and_test_static_dns():
    if not nextbox_sub_ensure(6):
        return False

    button_xp = '//*[@id="app-content-vue"]/div/div[2]/button'
    input_xp = '//*[@id="app-content-vue"]/div/div[2]/input'

    ret = input_into_text_field(input_xp, conf["static_domain"])
    if not ret:
        click_xpath(button_xp)
        chat("looks like it's already active, ok let's disable it and retry!")
        if not input_into_text_field(input_xp, conf["static_domain"]):
            chat("failed again, failing overall...")
            return False
        chat("cool, worked out")

    if not test_and_click_button(button_xp):
        return False

    chat("looks good so far, let's see if we can connect")
    return test_for_valid_login_page(conf["static_domain"], "http")