Пример #1
0
def create_course_with_unit():
    """
    Prepare for tests by creating a course with a section, subsection, and unit.
    Performs the following:
        Clear out all courseware
        Create a course with a section, subsection, and unit
        Create a user and make that user a course author
        Log the user into studio
        Open the course from the dashboard
        Expand the section and click on the New Unit link
    The end result is the page where the user is editing the new unit
    """
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict["COURSE"] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(parent_location=section.location, category="sequential", display_name="Subsection One")
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()
    world.css_click("a.course-link")

    world.wait_for_js_to_load()
    css_selectors = ["div.section-item a.expand-collapse", "a.new-unit-item"]
    for selector in css_selectors:
        world.css_click(selector)

    world.wait_for_mathjax()
    world.wait_for_xmodule()

    assert world.is_css_present("ul.new-component-type")
Пример #2
0
def disable_jquery_animations():
    """
    Disable JQuery animations on the page.  Any state changes
    will occur immediately to the final state.
    """

    # Ensure that jquery is loaded
    world.wait_for_js_to_load()

    # Disable jQuery animations
    world.browser.execute_script("jQuery.fx.off = true;")
Пример #3
0
def disable_jquery_animations():
    """
    Disable JQuery animations on the page.  Any state changes
    will occur immediately to the final state.
    """

    # Ensure that jquery is loaded
    world.wait_for_js_to_load()

    # Disable jQuery animations
    world.browser.execute_script("jQuery.fx.off = true;")
Пример #4
0
def i_have_populated_a_new_course(_step):
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict['COURSE'] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()

    world.css_click('a.course-link')
    world.wait_for_js_to_load()
Пример #5
0
def i_have_populated_a_new_course(_step):
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict['COURSE'] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()

    world.css_click('a.course-link')
    world.wait_for_js_to_load()
Пример #6
0
def create_course_with_unit():
    """
    Prepare for tests by creating a course with a section, subsection, and unit.
    Performs the following:
        Clear out all courseware
        Create a course with a section, subsection, and unit
        Create a user and make that user a course author
        Log the user into studio
        Open the course from the dashboard
        Expand the section and click on the New Unit link
    The end result is the page where the user is editing the new unit
    """
    world.clear_courses()
    course = world.CourseFactory.create()
    world.scenario_dict['COURSE'] = course
    section = world.ItemFactory.create(parent_location=course.location)
    world.ItemFactory.create(
        parent_location=section.location,
        category='sequential',
        display_name='Subsection One',
    )
    user = create_studio_user(is_staff=False)
    add_course_author(user, course)

    log_into_studio()
    world.css_click('a.course-link')

    world.wait_for_js_to_load()
    css_selectors = [
        'div.section-item a.expand-collapse-icon', 'a.new-unit-item'
    ]
    for selector in css_selectors:
        world.css_click(selector)

    world.wait_for_mathjax()
    world.wait_for_xmodule()

    assert world.is_css_present('ul.new-component-type')
Пример #7
0
def i_select_advanced_settings(step):

    world.wait_for_js_to_load()  # pylint: disable=no-member
    world.wait_for_js_variable_truthy('window.studioNavMenuActive')  # pylint: disable=no-member

    for _ in range(5):
        world.click_course_settings()  # pylint: disable=no-member

        # The click handlers are set up so that if you click <body>
        # the menu disappears.  This means that if we're even a *little*
        # bit off on the last item ('Advanced Settings'), the menu
        # will close and the test will fail.
        # For this reason, we retrieve the link and visit it directly
        # This is what the browser *should* be doing, since it's just a native
        # link with no JavaScript involved.
        link_css = 'li.nav-course-settings-advanced a'
        try:
            world.wait_for_visible(link_css)  # pylint: disable=no-member
            break
        except AssertionError:
            continue

    link = world.css_find(link_css).first['href']
    world.visit(link)
Пример #8
0
def i_select_advanced_settings(step):

    world.wait_for_js_to_load()  # pylint: disable=no-member
    world.wait_for_js_variable_truthy('window.studioNavMenuActive')  # pylint: disable=no-member

    for _ in range(5):
        world.click_course_settings()  # pylint: disable=no-member

        # The click handlers are set up so that if you click <body>
        # the menu disappears.  This means that if we're even a *little*
        # bit off on the last item ('Advanced Settings'), the menu
        # will close and the test will fail.
        # For this reason, we retrieve the link and visit it directly
        # This is what the browser *should* be doing, since it's just a native
        # link with no JavaScript involved.
        link_css = 'li.nav-course-settings-advanced a'
        try:
            world.wait_for_visible(link_css)  # pylint: disable=no-member
            break
        except AssertionError:
            continue

    link = world.css_find(link_css).first['href']
    world.visit(link)
Пример #9
0
def click_course_content():
    world.wait_for_js_to_load()
    course_content_css = 'li.nav-course-courseware'
    css_click(course_content_css)
Пример #10
0
def click_tools():
    world.wait_for_js_to_load()
    tools_css = 'li.nav-course-tools'
    css_click(tools_css)
Пример #11
0
def click_course_settings():
    world.wait_for_js_to_load()
    course_settings_css = 'li.nav-course-settings'
    css_click(course_settings_css)
Пример #12
0
def click_course_content():
    world.wait_for_js_to_load()
    course_content_css = 'li.nav-course-courseware'
    css_click(course_content_css)
Пример #13
0
def click_tools():
    world.wait_for_js_to_load()
    tools_css = 'li.nav-course-tools'
    css_click(tools_css)
Пример #14
0
def click_course_settings():
    world.wait_for_js_to_load()
    course_settings_css = 'li.nav-course-settings'
    css_click(course_settings_css)
Пример #15
0
def reload_the_page(step):
    world.wait_for_ajax_complete()
    world.browser.reload()
    world.wait_for_js_to_load()
Пример #16
0
def reload_the_page(step):
    world.wait_for_ajax_complete()
    world.browser.reload()
    world.wait_for_js_to_load()
Пример #17
0
def go_to_uploads(_step):
    world.wait_for_js_to_load()
    world.click_course_content()
    menu_css = 'li.nav-course-courseware-textbooks a'
    world.css_click(menu_css)
def go_to_uploads(_step):
    world.wait_for_js_to_load()
    world.click_course_content()
    menu_css = 'li.nav-course-courseware-textbooks a'
    world.css_click(menu_css)