コード例 #1
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_app_center(driver, ui_mode, screenshot_dir):
    menu(driver, ui_mode, screenshot_dir, 'appcenter')
    header = "//h1[text()='App Center']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    files = "//span[text()='File browser']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, files)))
    screenshots(driver, screenshot_dir, 'appcenter-' + ui_mode)
コード例 #2
0
def test_ldap(driver, app_domain, screenshot_dir, ui_mode):

    driver.get(
        "https://{0}/wp-admin/admin.php?page=mo_ldap_local_login".format(
            app_domain))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'ldap-' + ui_mode)
コード例 #3
0
def test_settings_backup(driver, ui_mode, device_host, screenshot_dir):
    url = "http://{0}/backup.html".format(device_host)
    resp = requests.get(url, verify=False)
    assert resp.status_code == 200
    driver.get(url)
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'settings_backup-' + ui_mode)
コード例 #4
0
def test_app_center(driver, ui_mode, device_host, screenshot_dir):
    url = "http://{0}/appcenter.html".format(device_host)
    resp = requests.get(url, verify=False)
    assert resp.status_code == 200
    driver.get(url)
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'appcenter-' + ui_mode)
コード例 #5
0
def test_new_certificates(driver, ui_mode, screenshot_dir):
    name = driver.find_element_by_id("Name")
    name.send_keys("test")

    driver.find_element_by_xpath("//button[contains(text(),'Create')]").click()

    screenshots(driver, screenshot_dir, 'certificates-new-' + ui_mode)
コード例 #6
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def menu(driver, ui_mode, screenshot_dir, element_id):
    wait_driver = WebDriverWait(driver, 30)
    retries = 10
    retry = 0
    exception = None
    while retry < retries:
        try:
            find_id = element_id
            if ui_mode == "mobile":
                find_id = element_id + '_mobile'
                menubutton = driver.find_element_by_id('menubutton')
                menubutton.click()
                wait_driver.until(EC.visibility_of_element_located((By.ID, find_id)))
            wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.element_to_be_clickable((By.ID, find_id)))
            screenshots(driver, screenshot_dir, element_id + '-' + ui_mode)
            element = driver.find_element_by_id(find_id)
            element.click()
            if ui_mode == "mobile":
                wait_driver.until(EC.invisibility_of_element_located((By.ID, find_id)))
            wait_for_loading(driver)
            return
        except Exception as e:
            exception = e
            print('error (attempt {0}/{1}): {2}'.format(retry + 1, retries, str(e)))
            time.sleep(1)
        retry += 1
    raise exception
コード例 #7
0
ファイル: test-ui.py プロジェクト: syncloud/plex
def wait_or_screenshot(driver, ui_mode, screenshot_dir, method):
    wait_driver = WebDriverWait(driver, 30)
    try:
        wait_driver.until(method)
    except Exception as e:
        screenshots(driver, screenshot_dir, 'exception-' + ui_mode)
        raise e
コード例 #8
0
ファイル: test-ui.py プロジェクト: catbei2020/platform
def test_settings_network(driver, device_host, ui_mode):
    driver.get("http://{0}/network.html".format(device_host))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'settings_network-' + ui_mode)

    driver.find_element_by_css_selector(".bootstrap-switch-id-tgl_external").click()
    time.sleep(2)
    screenshots(driver, screenshot_dir, 'settings_network_external_access-' + ui_mode)
コード例 #9
0
def test_index(driver, device_user, device_password, ui_mode, screenshot_dir):
    user = driver.find_element_by_name("login")
    user.send_keys(device_user)
    password = driver.find_element_by_name("password")
    password.send_keys(device_password)
    password.submit()
    time.sleep(5)
    screenshots(driver, screenshot_dir, 'index-' + ui_mode)
コード例 #10
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_not_installed_app(driver, ui_mode, screenshot_dir):
    menu(driver, ui_mode, screenshot_dir, 'appcenter')
    nextcloud = "//span[text()='Nextcloud file sharing']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, nextcloud)))
    driver.find_element_by_xpath(nextcloud).click()
    header = "//h1[text()='Nextcloud file sharing']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    screenshots(driver, screenshot_dir, 'app_not_installed-' + ui_mode)
コード例 #11
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_install_app(driver, ui_mode, screenshot_dir):
    install = 'btn_install'
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.element_to_be_clickable((By.ID, install)))
    driver.find_element_by_id(install).click()
    confirm = 'btn_confirm'
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.ID, confirm)))
    driver.find_element_by_id(confirm).click()
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.invisibility_of_element_located((By.ID, install)))
    screenshots(driver, screenshot_dir, 'app_installed-' + ui_mode)
コード例 #12
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_remove_app(driver, ui_mode, screenshot_dir):
    remove = 'btn_remove'
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.ID, remove)))
    driver.find_element_by_id(remove).click()
    confirm = 'btn_confirm'
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.ID, confirm)))
    driver.find_element_by_id(confirm).click()
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.invisibility_of_element_located((By.ID, remove)))
    screenshots(driver, screenshot_dir, 'app_removed-' + ui_mode)
コード例 #13
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_installed_app(driver, ui_mode, screenshot_dir):
    menu(driver, ui_mode, screenshot_dir, 'appcenter')
    header = "//h1[text()='App Center']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    files = "//span[text()='File browser']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, files)))
    driver.find_element_by_xpath(files).click()
    header = "//h1[text()='File browser']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    screenshots(driver, screenshot_dir, 'app_installed-' + ui_mode)
コード例 #14
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_settings_access(driver, ui_mode, screenshot_dir):
    settings(driver, screenshot_dir, ui_mode, 'access')
    header = "//h1[text()='Access']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    btn = 'external_mode'
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.element_to_be_clickable((By.ID, btn)))
    screenshots(driver, screenshot_dir, 'settings_access-' + ui_mode)
    driver.find_element_by_id(btn).click()
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.ID, "tgl_ip_autodetect")))
    screenshots(driver, screenshot_dir, 'settings_access_external_access-' + ui_mode)
コード例 #15
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_index(driver, ui_mode, device_user, device_password, screenshot_dir):
    user = driver.find_element_by_id("username")
    user.send_keys(device_user)
    password = driver.find_element_by_id("password")
    password.send_keys(device_password)
    login = driver.find_element_by_id("btn_login")
    login.click()
    screenshots(driver, screenshot_dir, 'index-progress-' + ui_mode)
    header = "//h1[text()='Applications']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    screenshots(driver, screenshot_dir, 'index-' + ui_mode)
コード例 #16
0
ファイル: test-ui.py プロジェクト: catbei2020/platform
def test_index(driver, ui_mode, device_user, device_password):
    user = driver.find_element_by_id("name")
    user.send_keys(device_user)
    password = driver.find_element_by_id("password")
    password.send_keys(device_password)
    password.submit()
    time.sleep(5)
    screenshots(driver, screenshot_dir, 'index-progress-' + ui_mode)
    wait_driver = WebDriverWait(driver, 20)
    wait_driver.until(EC.presence_of_element_located((By.CLASS_NAME, 'menubutton')))
    time.sleep(5)
    screenshots(driver, screenshot_dir, 'index-' + ui_mode)
コード例 #17
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def wait_for(driver, ui_mode, screenshot_dir, method):
    retries = 10
    retry = 0
    exception = None
    while retry < retries:
        try:
            method()
            return
        except Exception as e:
            exception = e
            print('error (attempt {0}/{1}): {2}'.format(retry + 1, retries, str(e)))
            time.sleep(1)
        retry += 1
    screenshots(driver, screenshot_dir, 'exception-' + ui_mode)
    raise exception
コード例 #18
0
ファイル: test-ui.py プロジェクト: metiqls/platform
def test_activate(driver, ui_mode, device_host, screenshot_dir,
                  domain, device_user, device_password, redirect_user, redirect_password):
    driver.get("http://{0}".format(device_host))
    header = "//h1[text()='Activate']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
    screenshots(driver, screenshot_dir, 'activate-empty')
    redirect_email = driver.find_element_by_id('email')
    wait_for(driver, ui_mode, screenshot_dir, lambda: redirect_email.send_keys(""))
    redirect_email.send_keys(redirect_user)
    driver.find_element_by_id('redirect_password').send_keys(redirect_password)
    driver.find_element_by_id('user_domain').send_keys(domain)
    driver.find_element_by_id('device_username').send_keys(device_user)
    driver.find_element_by_id('device_password').send_keys(device_password)
    screenshots(driver, screenshot_dir, 'activate-ready')
    driver.find_element_by_id('btn_activate').click()
    header = "//h1[text()='Log in']"
    wait_or_screenshot(driver, ui_mode, screenshot_dir, EC.presence_of_element_located((By.XPATH, header)))
コード例 #19
0
def test_login(driver, app_domain, device_user, device_password,
               screenshot_dir, ui_mode):

    driver.get("https://{0}/wp-login.php".format(app_domain))
    wait_driver = WebDriverWait(driver, 120)
    wait_driver.until(EC.element_to_be_clickable((By.ID, 'user_login')))

    user = driver.find_element_by_id("user_login")
    user.send_keys(device_user)
    password = driver.find_element_by_id("user_pass")
    password.send_keys(device_password)
    screenshots(driver, screenshot_dir, 'login-' + ui_mode)
    password.send_keys(Keys.RETURN)

    time.sleep(10)

    screenshots(driver, screenshot_dir, 'login-complete-' + ui_mode)
コード例 #20
0
def test_media(driver, app_domain, screenshot_dir, ui_mode):

    if ui_mode == "desktop":
        driver.get("https://{0}/wp-admin/media-new.php".format(app_domain))
        time.sleep(2)
        screenshots(driver, screenshot_dir, 'media-new-' + ui_mode)
        driver.find_element_by_css_selector(
            'p[class="upload-flash-bypass"] a').click()
        file = driver.find_element_by_css_selector(
            'input[id="async-upload"][type="file"]')
        file.send_keys(join(DIR, 'images', 'profile.jpeg'))
        time.sleep(2)
        screenshots(driver, screenshot_dir, 'media-' + ui_mode)
        save = driver.find_element_by_css_selector(
            'input[id="html-upload"][type="submit"]')
        save.click()
        time.sleep(5)
        screenshots(driver, screenshot_dir, 'media-done-' + ui_mode)
コード例 #21
0
def test_settings(driver, device_host, ui_mode, screenshot_dir):
    driver.get("http://{0}/settings.html".format(device_host))
    time.sleep(5)
    screenshots(driver, screenshot_dir, 'settings-' + ui_mode)
コード例 #22
0
def test_login(driver, ui_mode, device_host, screenshot_dir):
    driver.get("http://{0}".format(device_host))
    time.sleep(2)
    screenshots(driver, screenshot_dir, 'login-' + ui_mode)
コード例 #23
0
def test_internal_ui(driver, device_host, screenshot_dir):
    driver.get("http://{0}:81".format(device_host))
    time.sleep(2)
    screenshots(driver, screenshot_dir, 'activate')
コード例 #24
0
def test_not_installed_app(driver, device_host, ui_mode, screenshot_dir):
    driver.get("http://{0}/app.html?app_id=nextcloud".format(device_host))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'app_not_installed-' + ui_mode)
コード例 #25
0
def test_profile(driver, app_domain, screenshot_dir, ui_mode):

    driver.get("https://{0}/wp-admin/profile.php".format(app_domain))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'profile-' + ui_mode)
コード例 #26
0
def test_login(driver, app_domain, ui_mode, screenshot_dir):
    url = "https://{0}".format(app_domain)
    driver.get(url)
    time.sleep(10)

    screenshots(driver, screenshot_dir, 'login-' + ui_mode)
コード例 #27
0
def test_settings_activation(driver, device_host, ui_mode, screenshot_dir):
    driver.get("http://{0}/activation.html".format(device_host))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'settings_activation-' + ui_mode)
コード例 #28
0
def test_certificates(driver, app_domain, ui_mode, screenshot_dir):
    driver.get("https://{0}/certificates".format(app_domain))
    time.sleep(2)
    screenshots(driver, screenshot_dir, 'certificates-' + ui_mode)
コード例 #29
0
def test_users(driver, app_domain, screenshot_dir, ui_mode):

    driver.get("https://{0}/wp-admin/users.php".format(app_domain))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'users-' + ui_mode)
コード例 #30
0
def test_admin(driver, app_domain, screenshot_dir, ui_mode):

    driver.get("https://{0}/wp-admin".format(app_domain))
    time.sleep(10)
    screenshots(driver, screenshot_dir, 'admin-' + ui_mode)