Пример #1
0
def callback():

    login = '******'
    password = '******'
    try:
        # Login via email

        qalib.WHICH_PLATFORM = ""

        browser, logs = qalib.set_up("chrome", "stdout", "false")

        qalib.load_main_page(browser, logs)
    except:
        result.append("Main page opened")

    try:
        qalib.element_click(browser, logs, 3, By.XPATH,
                            '//*[@id="hs-eu-confirmation-button"]')
        result.append("Cookie is accepted")
    except:
        result.append("Something wrong with cookies")
    try:

        qalib.login(browser, logs, login, password)

        #qalib.wait_until_with_exception(browser, logs, 10, EC.visibility_of_element_located((By.XPATH, "//h2[@class='MuiTypography-root-8 MuiTypography-subtitle2-20']")))

        result.append("Login via email successfully passed")
    except:
        result.append("Login via email failed")

    qalib.result_of_the_test(result)
Пример #2
0
def callback():

    login = '******'
    password = '******'
    try:

        qalib.WHICH_PLATFORM = "dev."

        browser, logs = qalib.set_up("chrome", "stdout", "false")

        qalib.load_main_page(browser, logs)
        result.append("Main page successfully opened")

    except:
        result.append("Opening main page failed")

    try:
        qalib.element_click(browser, logs, 3, By.XPATH,
                            '//*[@id="hs-eu-confirmation-button"]')
        result.append("Cookie is accepted")
    except:
        result.append("Something wrong with cookies")
    try:

        qalib.element_click(browser, logs, 3, By.XPATH,
                            "//h2[contains(text(),'login')]")
        sleep(2)
        qalib.element_click(
            browser, logs, 3, By.XPATH,
            "//div[@class='social-auth__icon social-auth__icon-facebook']")

        window_before = browser.window_handles[0]

        window_after = browser.window_handles[1]

        browser.switch_to_window(window_after)

        qalib.element_send_keys(browser, logs, 3, By.ID, "email", login)

        qalib.element_send_keys(browser, logs, 3, By.ID, "pass", password)

        qalib.element_click(browser, logs, 3, By.NAME, value="login")

        browser.switch_to_window(window_before)
        sleep(4)

        qalib.wait_until_with_exception(browser, logs, 10,
                                        EC.title_is('OPN Platform'))
        sleep(4)

        result.append("Login via facebook successfully passed")

    except:
        result.append("Login via facebook failed")

    qalib.result_of_the_test(result)
Пример #3
0
def callback():

    login = '******'
    password = '******'
    try:
        # Login via linkedin

        qalib.WHICH_PLATFORM = ""

        browser, logs = qalib.set_up("chrome", "stdout", "false")

        qalib.load_main_page(browser, logs)
        result.append("Main page successfully opened")

    except:
        result.append("Opening main page failed")

    try:
        qalib.element_click(browser, logs, 3, By.XPATH,
                            '//*[@id="hs-eu-confirmation-button"]')
        result.append("Cookie is accepted")
    except:
        result.append("Something wrong with cookies")

    try:

        qalib.element_click(browser, logs, 3, By.XPATH,
                            "//h2[contains(text(),'login')]")
        sleep(2)
        qalib.element_click(
            browser, logs, 3, By.XPATH,
            "//div[@class='social-auth__icon social-auth__icon-linkedin']")
        qalib.wait_until_with_exception(
            browser, logs, 10,
            EC.title_is('LinkedIn Login, LinkedIn Sign in | LinkedIn'))
        result.append("Page successfully forwarded to linkedin")
    except:
        result.append("Something wrong with linkedin")
    try:
        browser.find_element_by_xpath("//input[@id='username']").send_keys(
            login)
        browser.find_element_by_xpath("//input[@id='password']").send_keys(
            password)
        qalib.element_click(
            browser, logs, 3, By.XPATH,
            "//button[@class='btn__primary--large from__button--floating']")
        qalib.wait_until_with_exception(browser, logs, 10,
                                        EC.title_is('OPN Platform'))

        result.append("Login via linkedin successfully passed")
    except:
        result.append("Login via linkedin failed")

    qalib.result_of_the_test(result)
Пример #4
0
def callback():

    # login = '******'
    # gpassword = '******'
    try:

        qalib.WHICH_PLATFORM = ""

        browser, logs = qalib.set_up("chrome", "stdout", "false")

        qalib.load_main_page(browser, logs)
        result.append("Success")
    except:
        result.append("Fail")

    try:
        qalib.element_click(browser, logs, 3, By.XPATH,
                            '//*[@id="hs-eu-confirmation-button"]')
        result.append("Cookie is accepted")
    except:
        result.append("Something wrong with cookies")

    qalib.element_click(browser, logs, qalib.DEFAULT_SLEEP, By.XPATH,
                        "//h2[contains(text(),'login')]")
    qalib.element_click(
        browser, logs, qalib.DEFAULT_SLEEP, By.CLASS_NAME,
        'MuiTypography-root MuiTypography-caption MuiTypography-colorPrimary')
    print('Clicking forgot-password button..')
    initial_handle = browser.current_window_handle

    qalib.element_send_keys(browser, logs, qalib.DEFAULT_SLEEP, By.ID,
                            'outlined-helperText', '*****@*****.**')

    qalib.result_of_the_test(result)
    qalib.tear_down(browser, logs)
Пример #5
0
def callback():

    social_login = "******"
    headless_flag = "false"
    lib.WHICH_PLATFORM = ""
    logs_pipe = "stdout"
    browser_flag = "chrome"

    if headless_flag not in ['false', 'true']\
            or lib.WHICH_PLATFORM not in ['dev',  '']\
            or browser_flag not in ['chrome', 'firefox']:  # TODO
        print('Incorrect argument(-s)')
        exit(lib.CODE_INCORRECT_ARGUMENTS)

    if headless_flag == 'false':
        headless_flag = False
    elif headless_flag == 'true':
        headless_flag = True

    browser, logs = lib.set_up(browser_flag, logs_pipe, headless_flag)

    lib.load_register_main_page(browser, logs)

    initial_handle = browser.current_window_handle

    lib.element_click(browser, logs, 3, By.XPATH,
                      '//*[@id="hs-eu-confirmation-button"]')

    lib.element_click(
        browser, logs, 3, By.XPATH,
        "//div[@class='social-auth__icon social-auth__icon-google']")

    lib.wait_until_with_exception(browser, logs, lib.DEFAULT_TIMEOUT,
                                  EC.number_of_windows_to_be(2))

    for handle in browser.window_handles:
        if handle == initial_handle:
            continue

        sleep(3)

        browser.switch_to.window(handle)

        lib.wait_until_with_exception(browser, logs, lib.DEFAULT_TIMEOUT,
                                      EC.title_contains('Вход'))
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.XPATH,
                              '//*[@id="identifierId"]',
                              '*****@*****.**', Keys.TAB, Keys.TAB,
                              Keys.ENTER)

        lib.wait_until_with_exception(
            browser, logs, lib.DEFAULT_TIMEOUT,
            EC.visibility_of_element_located(
                (By.XPATH, '//*[@id="password"]/div[1]/div/div[1]/input')))
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.XPATH,
                              '//*[@id="password"]/div[1]/div/div[1]/input',
                              'Amsterdam99!', Keys.ENTER)

        browser.switch_to_window(initial_handle)

        # try:
        #     lib.wait_until_with_exception(browser, logs, lib.DEFAULT_TIMEOUT,
        #                                   EC.text_to_be_present_in_element(By.XPATH, '/html[1]/body[1]/div[1]/div[1]/div[2]/div[3]/div[2]', "User is already signed with another authorization type"))
        #     print("Passed")
        # except Exception:
        #     pass

        # lib.wait_until_with_exception(browser, logs, lib.DEFAULT_TIMEOUT,
        #                              EC.text_to_be_present_in_element(By.XPATH, "//h2[@class='MuiTypography-root MuiTypography-h5']", "Company info"))

        sleep(5)
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.NAME,
                              'companyName', 'Test Registration')
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.NAME,
                              'companyDescription', 'Just for test')
        s2 = browser.find_element_by_id("select-country")
        print(s2.options)
        for opt in s1.options:
            s1.select_by_visible_text('Europe')
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.NAME,
                              'address', 'Test Street')
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.NAME,
                              'email', '*****@*****.**')
        lib.element_click(browser, logs, lib.DEFAULT_SLEEP, By.XPATH,
                          "//div[@class='register-company_container']//form")

    print(social_login + ' Registration test finished successfully', file=logs)
    result = [social_login + ' registration test finished successfully']
    lib.result_of_the_test(result)
    lib.tear_down(browser, logs)
Пример #6
0
def callback():

    login = '******'
    password = '******'
    try:

        qalib.WHICH_PLATFORM = ""

        browser, logs = qalib.set_up("chrome", "stdout", "false")

        qalib.load_main_page(browser, logs)
        sleep(4)
        result.append("Main page successfully opened")

    except:
        result.append("Opening main page failed")

    try:
        qalib.element_click(browser, logs, 3, By.XPATH,
                            '//*[@id="hs-eu-confirmation-button"]')
        result.append("Cookie is accepted")
    except:
        result.append("Something wrong with cookies")

    try:

        qalib.element_click(browser, logs, 3, By.XPATH,
                            "//h2[contains(text(),'login')]")
        sleep(2)
        qalib.element_click(
            browser, logs, 3, By.XPATH,
            "//div[@class='social-auth__icon social-auth__icon-google']")

        window_before = browser.window_handles[0]

        window_after = browser.window_handles[1]

        browser.switch_to_window(window_after)

        sleep(3)

        qalib.element_send_keys(browser, logs, 3, By.ID, "identifierId", login,
                                Keys.ENTER)

        qalib.element_send_keys(browser, logs, 3, By.ID, "password", password,
                                Keys.ENTER)

        browser.switch_to_window(window_before)
        sleep(4)

        qalib.wait_until_with_exception(browser, logs, 10,
                                        EC.title_is('OPN Platform'))
        sleep(4)

        result.append("Login via facebook successfully passed")

    except:
        result.append("Login via facebook failed")

    qalib.result_of_the_test(result)
    qalib.tear_down(browser, logs)
Пример #7
0
def callback():

    social_login = "******"
    headless_flag = "false"
    lib.WHICH_PLATFORM = ""
    logs_pipe = "stdout"
    browser_flag = "chrome"

    if headless_flag not in ['false', 'true']\
            or lib.WHICH_PLATFORM not in ['dev',  '']\
            or browser_flag not in ['chrome', 'firefox']:  # TODO
        print('Incorrect argument(-s)')
        exit(lib.CODE_INCORRECT_ARGUMENTS)

    if headless_flag == 'false':
        headless_flag = False
    elif headless_flag == 'true':
        headless_flag = True

    browser, logs = lib.set_up(browser_flag, logs_pipe, headless_flag)

    lib.load_register_main_page(browser, logs)

    initial_handle = browser.current_window_handle

    lib.element_click(browser, logs, 3, By.XPATH,
                      '//*[@id="hs-eu-confirmation-button"]')

    lib.element_click(
        browser, logs, 3, By.XPATH,
        "//div[@class='social-auth__icon social-auth__icon-google']")

    lib.wait_until_with_exception(browser, logs, lib.DEFAULT_TIMEOUT,
                                  EC.number_of_windows_to_be(2))

    for handle in browser.window_handles:
        if handle == initial_handle:
            continue

        sleep(3)

        browser.switch_to.window(handle)

        lib.wait_until_with_exception(browser, logs, lib.DEFAULT_TIMEOUT,
                                      EC.title_contains('Вход'))
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.XPATH,
                              '//*[@id="identifierId"]',
                              '*****@*****.**', Keys.TAB, Keys.TAB,
                              Keys.ENTER)

        lib.wait_until_with_exception(
            browser, logs, lib.DEFAULT_TIMEOUT,
            EC.visibility_of_element_located(
                (By.XPATH, '//*[@id="password"]/div[1]/div/div[1]/input')))
        lib.element_send_keys(browser, logs, lib.DEFAULT_SLEEP, By.XPATH,
                              '//*[@id="password"]/div[1]/div/div[1]/input',
                              'Amsterdam99!', Keys.ENTER)

        browser.switch_to_window(initial_handle)
        sleep(5)
        lib.element_click(browser, logs, lib.DEFAULT_SLEEP, By.XPATH,
                          "	//span[@class='MuiButton-label']")
        sleep(5)

    print(social_login + ' Registration test finished successfully', file=logs)
    result = [social_login + ' registration test finished successfully']
    lib.result_of_the_test(result)
    lib.tear_down(browser, logs)