예제 #1
0
def test_():
    driver = login.log_in()

    time.sleep(wt)
    if f.driver_off(driver):
        return
    f.close_driver(driver)
예제 #2
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        driver = f.open_71_arrival_without_sort_page(driver)
        if f.driver_off(driver):
            raise
    except:
        return

    try:
        driver = f._71_included_in_consolidation_enter_number(
            driver, pth.correct_71_block_num)
        if f.driver_off(driver):
            raise

        time.sleep(3)
        background_colour = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((
                By.XPATH,
                '//*[@id="root"]/section/section[2]/section/section/div[2]/div[3]/div[2]/div/div'
            )))
        background_colour = background_colour.get_attribute('style')
        if background_colour != 'background-color: rgb(124, 184, 47);':
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 5: '):
            assert 0, 'fail step 5'

    time.sleep(wt)
    f.close_driver(driver)
예제 #3
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        exit_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '//*[@id="root"]/section/section[1]/div/div/div[2]/div/button[2]'
            )))

        exit_button.click()

        element_login = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.NAME, 'login')))

        element_password = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.NAME, 'password')))

        enter_button = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, 'css-1hnkt5t')))
    except:
        f.close_driver(driver)
        with allure.step('step 3: '):
            assert 0, 'fail step 3'
    time.sleep(wt)
    f.close_driver(driver)
예제 #4
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        driver = f.open_79_included_in_consolidation_page(
            driver, pth.destination_1)
        if f.driver_off(driver):
            raise
    except:
        return

    time.sleep(wt)
    f.close_driver(driver)
예제 #5
0
def pony_driver_init():
    if pth.browser == 'Safari':
        driver = webdriver.Safari()
    if pth.browser == 'Firefox':
        driver = webdriver.Firefox(executable_path=pth.driver_path)
    if pth.browser == 'Chrome':
        driver = webdriver.Chrome(executable_path=pth.driver_path)
    driver.get(pth.pegas_url)
    try:
        title = WebDriverWait(driver, 10).until(EC.title_is('Пегас'))
    except:
        f.close_driver(driver)
        with allure.step('step 0: '):
            assert 0, 'fail step 0'
    else:
        return driver
예제 #6
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        driver = f.open_71_arrival_without_sort_page(driver)
        if f.driver_off(driver):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 3: '):
            assert 0, 'fail step 3'

    time.sleep(wt)
    f.close_driver(driver)
예제 #7
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        driver = f.click_menu_button(driver)
        if f.driver_off(driver):
            raise

        driver = f.click_service_button(driver)
        if f.driver_off(driver):
            raise

        driver = f.click_hosting_management_button(driver)
        if f.driver_off(driver):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 3: '):
            assert 0, 'fail step 3'

    try:
        driver = f.click_editing_user_groups_button(driver)
        if f.driver_off(driver):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 4: '):
            assert 0, 'fail step 4'

    time.sleep(wt)
    f.close_driver(driver)
예제 #8
0
def test_():
    try:
        driver = login.pony_driver_init()
        if f.driver_off(driver):
            return

        element_login = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.NAME, 'login')))

        element_password = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.NAME, 'password')))

        enter_button = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, 'css-1hnkt5t')))
    except:
        f.close_driver(driver)
        with allure.step('step 3: '):
            assert 0, 'fail step 3'

    element_login.send_keys(pth.incorrect_login)
    time.sleep(1)  # иначе может вводить всё в одно поле
    element_password.send_keys(pth.incorrect_password)
    enter_button.click()
    try:
        warning = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, 'css-hnp1e7')))
        if warning.text != 'Неверный логин или пароль':
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 4: '):
            assert 0, 'fail step 4'

    time.sleep(wt)
    f.close_driver(driver)
예제 #9
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        driver = f.open_79_included_in_consolidation_page(
            driver, pth.destination_1)
        if f.driver_off(driver):
            raise
    except:
        return

    try:
        full_screen_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '//*[@id="root"]/section/section[2]/section/section/div[2]/div[3]/div[2]/div/div/div[1]/div/button/span[2]'
            )))

        full_screen_button.click()

        full_screen_form_heading = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located(
                (By.XPATH, '/html/body/div[4]/div/div[2]/div/div[1]/h4/span')))

        if full_screen_form_heading.text != 'Полноэкранный режим':
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 8: '):
            assert 0, 'fail step 8'

    try:
        driver = f._79_included_in_consolidation_full_screen_enter_number(
            driver, pth.incorrect_79_block_num)
        if f.driver_off(driver):
            raise

        element_warning = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located(
                (By.XPATH, '/html/body/div[2]/div/div[1]/span')))

        if element_warning.text != 'Parameter HostName can not be empty':
            raise

        element_block = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located(
                (By.XPATH, '/html/body/div[4]/div/div[2]/div/div[2]/div')))

        if element_block.get_attribute(
                'style') != 'background-color: rgb(194, 48, 48);':
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 9: '):
            assert 0, 'fail step 9'

    time.sleep(wt)
    f.close_driver(driver)
예제 #10
0
def log_in():
    try:
        driver = pony_driver_init()
        if driver == 0:
            return 0

        element_login = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.NAME, 'login')))

        element_password = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.NAME, 'password')))

        enter_button = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, 'css-1hnkt5t')))
    except:
        f.close_driver(driver)
        with allure.step('step 1: '):
            assert 0, 'fail step 1'

    element_login.send_keys(pth.correct_login)
    time.sleep(1)  # иначе может вводить всё в одно поле
    element_password.send_keys(pth.correct_password)
    enter_button.click()
    try:
        main_page_heading = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((
                By.XPATH,
                '//*[@id="root"]/section/section[1]/div/div/button/span/div')))
        if main_page_heading.text != 'ПЕГАС 2.0':
            raise

        menu_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located(
                (By.CLASS_NAME, 'bp3-intent-success')))
    except:
        f.close_driver(driver)
        with allure.step('step 2: '):
            assert 0, 'fail step 2'
    return driver
예제 #11
0
def test_():
    driver = login.log_in()
    if f.driver_off(driver):
        return

    try:
        driver = f.click_menu_button(driver)
        if f.driver_off(driver):
            raise

        driver = f.click_service_button(driver)
        if f.driver_off(driver):
            raise

        driver = f.click_hosting_management_button(driver)
        if f.driver_off(driver):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 3: '):
            assert 0, 'fail step 3'

    try:
        driver = f.click_editing_user_groups_button(driver)
        if f.driver_off(driver):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 4: '):
            assert 0, 'fail step 4'

    try:
        driver = f.click_creating_group_button(driver)
        if f.driver_off(driver):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 5: '):
            assert 0, 'fail step 5'

    try:
        element_group_name = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((
                By.XPATH,
                '/html/body/div[3]/div/div[2]/div/div[2]/form/div[1]/div/div/input'
            )))

        element_group_name.send_keys(pth.random_name)

        saving_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '/html/body/div[3]/div/div[2]/div/div[2]/form/div[2]/button[1]'
            )))

        saving_button.click()

        element_editing_user_groups_page_heading = WebDriverWait(
            driver, 10).until(
                EC.presence_of_element_located(
                    (By.XPATH,
                     '//*[@id="root"]/section/section[2]/section/div/h1')))

        if element_editing_user_groups_page_heading.text != 'Редактирование групп пользователей':
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 6: '):
            assert 0, 'fail step 6'

    try:
        if not f.check_group_created(driver, pth.random_name):
            raise

        if not f.check_group_existence(driver, pth.random_name):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 7: '):
            assert 0, 'fail step 7'

    try:
        marker_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '//*[@id="root"]/section/section[2]/section/section/div/div/div[2]/div[1]/table/tbody/tr[1]/td[1]/label/span'
            )))

        marker_button.click()

        delete_group_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                '//*[@id="root"]/section/section[2]/section/section/div/div/div[1]/div[1]/button[4]'
            )))

        delete_group_button.click()

        element_deleting_group_heading = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located(
                (By.XPATH, '/html/body/div[4]/div/div[2]/div/div[1]/h4/span')))

        if element_deleting_group_heading.text != 'Удаление группы пользователей':
            raise

        delete_button = WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 '/html/body/div[4]/div/div[2]/div/div[3]/div/div/a[1]')))

        delete_button.click()

        if f.check_group_existence(driver, pth.random_name):
            raise
    except:
        f.close_driver(driver)
        with allure.step('step 8: '):
            assert 0, 'fail step 8'

    time.sleep(wt)
    f.close_driver(driver)