Ejemplo n.º 1
0
def i_click_on_the_tab_and_check(step):
    for tab_title in step.hashes:
        tab_text = tab_title['TabName']
        title = tab_title['PageTitle']
        world.click_link(tab_text)
        world.wait_for(lambda _driver:title in world.browser.title)
        assert(title in world.browser.title)
Ejemplo n.º 2
0
def i_verify_all_the_content_of_each_course(step):
    all_possible_courses = get_courses()
    logger.debug('Courses found:')
    for c in all_possible_courses:
        logger.debug(c.id)
    ids = [c.id for c in all_possible_courses]

    # Get a list of all the registered courses
    registered_courses = world.browser.find_by_css('article.my-course')
    if len(all_possible_courses) < len(registered_courses):
        assert False, "user is registered for more courses than are uniquely posssible"
    else:
        pass

    for test_course in registered_courses:
        test_course.css_click('a')
        check_for_errors()

        # Get the course. E.g. 'MITx/6.002x/2012_Fall'
        current_course = sub('/info', '',
                             sub('.*/courses/', '', world.browser.url))
        validate_course(current_course, ids)

        world.click_link('Courseware')
        assert world.is_css_present('accordion')
        check_for_errors()
        browse_course(current_course)

        # clicking the user link gets you back to the user's home page
        world.css_click('.user-link')
        check_for_errors()
Ejemplo n.º 3
0
def i_verify_all_the_content_of_each_course(step):
    all_possible_courses = get_courses()
    logger.debug('Courses found:')
    for c in all_possible_courses:
        logger.debug(c.id)
    ids = [c.id for c in all_possible_courses]

    # Get a list of all the registered courses
    registered_courses = world.browser.find_by_css('article.my-course')
    if len(all_possible_courses) < len(registered_courses):
        assert False, "user is registered for more courses than are uniquely posssible"
    else:
        pass

    for test_course in registered_courses:
        test_course.css_click('a')
        check_for_errors()

        # Get the course. E.g. 'MITx/6.002x/2012_Fall'
        current_course = sub('/info', '', sub('.*/courses/', '', world.browser.url))
        validate_course(current_course, ids)

        world.click_link('Courseware')
        assert world.is_css_present('accordion')
        check_for_errors()
        browse_course(current_course)

        # clicking the user link gets you back to the user's home page
        world.css_click('.user-link')
        check_for_errors()
Ejemplo n.º 4
0
def i_click_on_the_tab_and_check(step):
    for tab_title in step.hashes:
        tab_text = tab_title['TabName']
        title = tab_title['PageTitle']
        world.click_link(tab_text)
        world.wait_for(lambda _driver: title in world.browser.title)
        assert (title in world.browser.title)
Ejemplo n.º 5
0
def upload_file(_step, is_test_file, file_name):
    world.click_link('Upload New File')

    if not is_test_file:
        _write_test_file(file_name, "test file")

    # uploading the file itself
    path = os.path.join(TEST_ROOT, 'uploads/', file_name)
    world.browser.execute_script("$('input.file-input').css('display', 'block')")
    world.browser.attach_file('file', os.path.abspath(path))
    close_css = 'a.close-button'
    world.css_click(close_css)
Ejemplo n.º 6
0
def upload_file(_step, is_test_file, file_name):
    world.click_link('Upload New File')

    if not is_test_file:
        _write_test_file(file_name, "test file")

    # uploading the file itself
    path = os.path.join(TEST_ROOT, 'uploads/', file_name)
    world.browser.execute_script(
        "$('input.file-input').css('display', 'block')")
    world.browser.attach_file('file', os.path.abspath(path))
    close_css = 'a.close-button'
    world.css_click(close_css)
def i_click_on_the_tab(step, tab_text):
    world.click_link(tab_text)
Ejemplo n.º 8
0
def click_the_link_with_the_text_group1(step, linktext):
    world.click_link(linktext)
Ejemplo n.º 9
0
def click_the_link_called(step, text):
    world.click_link(text)
Ejemplo n.º 10
0
def return_to_course(step):
    step.given('I visit the homepage')
    world.click_link("View Course")
    world.click_link("Courseware")
Ejemplo n.º 11
0
def click_the_link_with_the_text_group1(step, linktext):
    world.click_link(linktext)
Ejemplo n.º 12
0
def click_the_link_called(step, text):
    world.click_link(text)
Ejemplo n.º 13
0
def and_i_return_to_the_courseware(step):
    world.visit('/')
    world.click_link("View Course")
    world.click_link("Courseware")
Ejemplo n.º 14
0
def and_i_return_to_the_course(step):
    world.visit('/')
    world.click_link("View Course")
    course = 'a[href*="/courseware"]'
    world.css_click(course)
def i_click_on_the_link(step, link_text):
    world.click_link(link_text)
Ejemplo n.º 16
0
def and_i_return_to_the_courseware(step):
    world.visit('/')
    world.click_link("View Course")
    world.click_link("Courseware")
Ejemplo n.º 17
0
def and_i_return_to_the_course(step):
    world.visit('/')
    world.click_link("View Course")
    course = 'a[href*="/courseware"]'
    world.css_click(course)
Ejemplo n.º 18
0
def i_click_on_the_tab(step, tab_text):
    world.click_link(tab_text)
    world.save_the_html()
Ejemplo n.º 19
0
def i_visit_the_staff_grading_page(step):
    world.click_link('Instructor')
    world.click_link('Staff grading')
Ejemplo n.º 20
0
def return_to_course(step):
    step.given('I visit the homepage')
    world.click_link("View Course")
    world.click_link("Courseware")