Esempio n. 1
0
def i_created_raw_html(step):
    step.given('I am in Studio editing a new unit')
    world.create_component_instance(
        step=step,
        category='html',
        component_type='Raw HTML'
    )
Esempio n. 2
0
def xml_only_video(step):
    # Create a new video *without* metadata. This requires a certain
    # amount of rummaging to make sure all the correct data is present
    step.given('I have clicked the new unit button')

    # Wait for the new unit to be created and to load the page
    world.wait(1)

    location = world.scenario_dict['COURSE'].location
    store = get_modulestore(location)

    parent_location = store.get_items(Location(category='vertical', revision='draft'))[0].location

    youtube_id = 'ABCDEFG'
    world.scenario_dict['YOUTUBE_ID'] = youtube_id

    # Create a new Video component, but ensure that it doesn't have
    # metadata. This allows us to test that we are correctly parsing
    # out XML
    video = world.ItemFactory.create(
        parent_location=parent_location,
        category='video',
        data='<video youtube="1.00:%s"></video>' % youtube_id
    )

    # Refresh to see the new video
    reload_the_page(step)
Esempio n. 3
0
def see_section_content(step, section):
    world.wait(0.5)
    if section == "2":
        text = 'The correct answer is Option 2'
    elif section == "1":
        text = 'The correct answer is Choice 3'
    step.given('I should see "' + text + '" somewhere on the page')
def given_the_switchboard_is_configured_for_ldap_lookup_with_location(step):
    context_helper.add_or_replace_context('__switchboard_directory', 'Switchboard', 'internal')
    step.given('Given the LDAP server is configured and active')
    ldap_action_webi.add_or_replace_ldap_server('openldap-dev', 'openldap-dev.lan-quebec.avencall.com')
    ldap_action_webi.add_or_replace_ldap_filter(
        name='openldap-dev',
        server='openldap-dev',
        base_dn='dc=lan-quebec,dc=avencall,dc=com',
        username='******',
        password='******',
        display_name=['cn', 'st'])

    directory_action_webi.add_or_replace_directory(
        'openldap',
        'ldapfilter://openldap-dev',
        'cn,telephoneNumber,st',
        '',
        {'name': 'cn',
         'number': 'telephoneNumber',
         'location': 'st'}
    )
    directory_action_webi.add_or_replace_display(
        'switchboard',
        [('Icon', 'status', ''),
         ('Name', 'name', '{db-name}'),
         ('Number', 'number_office', '{db-number}'),
         ('Location', '', '{db-location}')]
    )
    directory_action_webi.assign_filter_and_directories_to_context(
        '__switchboard_directory',
        'switchboard',
        ['openldap']
    )
Esempio n. 5
0
def test_open_url_without_tree(step):
    step.given('I go to the "/" view without tree')

    # make sure that text in place
    assert_true('Test Header' in world.response_body)

    assert_equal(world.tree, None)
Esempio n. 6
0
def adminlogin(step,usrID):
    step.given('I fill in the input with name "#login-email" with "*****@*****.**"')
    step.given('I fill in the input with name "#login-password" with "jason-uguru-2"')
    step.given('I click the element with css selector "#sign-in-button"')
    step.given('I visit "https://uguru.me/admin/users/5919/"')
    step.given('I click the element with css selector "[href="/admin/users/'+usrID+'/login"]"')
    time.sleep(8)
Esempio n. 7
0
def xml_only_video(step):
    # Create a new video *without* metadata. This requires a certain
    # amount of rummaging to make sure all the correct data is present
    step.given("I have clicked the new unit button")

    # Wait for the new unit to be created and to load the page
    world.wait(1)

    course = world.scenario_dict["COURSE"]
    store = get_modulestore(course.location)

    parent_location = store.get_items(course.id, category="vertical", revision="draft")[0].location

    youtube_id = "ABCDEFG"
    world.scenario_dict["YOUTUBE_ID"] = youtube_id

    # Create a new Video component, but ensure that it doesn't have
    # metadata. This allows us to test that we are correctly parsing
    # out XML
    world.ItemFactory.create(
        parent_location=parent_location,
        category="video",
        data='<video youtube="1.00:%s"></video>' % youtube_id,
        modulestore=store,
    )
Esempio n. 8
0
def xml_only_video(step):
    # Create a new video *without* metadata. This requires a certain
    # amount of rummaging to make sure all the correct data is present
    step.given('I have clicked the new unit button')

    # Wait for the new unit to be created and to load the page
    world.wait(1)

    course = world.scenario_dict['COURSE']
    store = modulestore()

    parent_location = store.get_items(course.id, qualifiers={'category': 'vertical'})[0].location

    youtube_id = 'ABCDEFG'
    world.scenario_dict['YOUTUBE_ID'] = youtube_id

    # Create a new Video component, but ensure that it doesn't have
    # metadata. This allows us to test that we are correctly parsing
    # out XML
    world.ItemFactory.create(
        parent_location=parent_location,
        category='video',
        data='<video youtube="1.00:%s"></video>' % youtube_id,
        modulestore=store,
        user_id=world.scenario_dict["USER"].id
    )
Esempio n. 9
0
def i_created_blank_html_page(step):
    step.given('I am in Studio editing a new unit')
    world.create_component_instance(
        step=step,
        category='html',
        component_type='Text'
    )
Esempio n. 10
0
def i_created_etext_in_latex(step):
    step.given('I am in Studio editing a new unit')
    step.given('I have enabled latex compiler')
    world.create_component_instance(
        step=step,
        category='html',
        component_type='E-text Written in LaTeX'
    )
def i_created_unit_with_advanced_module(step, advanced_module):
    world.create_course_with_unit()

    url = world.browser.url
    step.given("I select the Advanced Settings")
    change_value(step, ADVANCED_MODULES_KEY, '["{}"]'.format(advanced_module))
    world.visit(url)
    world.wait_for_xmodule()
Esempio n. 12
0
def when_i_update_the_question_with_invalid_details(step):
    world.theme = Theme.objects.create(name='Sample Theme')
    question_data = {'text': '',
                     'instructions': '',
                     'export_label': '',
                     'theme': ''}
    world.page.fill_form(question_data)
    step.given('And I click save question button')
Esempio n. 13
0
def i_created_unit_with_advanced_module(step, advanced_module):
    step.given('I am in Studio editing a new unit')

    url = world.browser.url
    step.given("I select the Advanced Settings")
    change_value(step, ADVANCED_MODULES_KEY, '["{}"]'.format(advanced_module))
    world.visit(url)
    world.wait_for_xmodule()
Esempio n. 14
0
def open_course_with_locked(step, lock_state, file_name):
    step.given('I have opened a new course in studio')
    step.given('I go to the files and uploads page')
    _write_test_file(file_name, "test file")
    step.given('I upload the file "' + file_name + '"')
    if lock_state == "locked":
        step.given('I lock "' + file_name + '"')
        step.given('I reload the page')
Esempio n. 15
0
def i_created_etext_in_latex(step):
    world.create_course_with_unit()
    step.given('I have enabled latex compiler')
    world.create_component_instance(
        step=step,
        category='html',
        component_type='E-text Written in LaTeX'
    )
Esempio n. 16
0
def wait_until_source_status_code_is(step, code1, code2, secs):
    start = datetime.utcnow()
    step.given('I get the source "{id}"'.format(id=world.source['resource']))
    while (world.source['status']['code'] != int(code1) and
           world.source['status']['code'] != int(code2)):
           time.sleep(3)
           assert datetime.utcnow() - start < timedelta(seconds=int(secs))
           step.given('I get the source "{id}"'.format(id=world.source['resource']))
    assert world.source['status']['code'] == int(code1)
Esempio n. 17
0
def visit_model_add_admin(step, model_name):
    step.given("Given the user navigates to the \"%s\" admin" % model_name)
    try:
        # This works in Django 1.3
        world.browser.click_link_by_href("add/")
    except ElementDoesNotExist:
        # This works in Django 1.4
        el = world.browser.find_by_css('.addlink').first
        el.click()
Esempio n. 18
0
def create_latex_problem(step):
    step.given('I am in Studio editing a new unit')
    step.given('I have enabled latex compiler')
    world.create_component_instance(
        step=step,
        category='problem',
        component_type='Problem Written in LaTeX',
        is_advanced=True
    )
def create_latex_problem(step):
    world.create_course_with_unit()
    step.given('I have enabled latex compiler')
    world.create_component_instance(
        step=step,
        category='problem',
        component_type='Problem Written in LaTeX',
        is_advanced=True
    )
def wait_until_prediction_status_code_is(step, code1, code2, secs):
    start = datetime.utcnow()
    step.given('I get the prediction "{id}"'.format(id=world.prediction["resource"]))
    status = get_status(world.prediction)
    while status["code"] != int(code1) and status["code"] != int(code2):
        time.sleep(3)
        assert datetime.utcnow() - start < timedelta(seconds=int(secs))
        step.given('I get the prediction "{id}"'.format(id=world.prediction["resource"]))
        status = get_status(world.prediction)
    assert status["code"] == int(code1)
Esempio n. 21
0
def test_fill_particular_form(step):
    step.given('I go to the "/" view')
    name, val = "name", "name val"
    step.given('Fill the field "%s" with "%s" in form #2' % (name, val))

    # should be filled first form because
    # 'name' and 'email' fields should be in first form
    form = world.tree.forms[1]

    assert_equal(form.inputs[name].value, val)
Esempio n. 22
0
def click_asset_from_index(step, file_name):
    # This is not ideal, but I'm having trouble with the middleware not having
    # the same user in the request when I hit the URL directly.
    course_link_css = 'a.course-link'
    world.css_click(course_link_css)
    step.given("I go to the files and uploads page")
    index = get_index(file_name)
    assert index != -1
    world.css_click('a.filename', index=index)
    _verify_body_text()
Esempio n. 23
0
def i_can_open_a_packfile_named_group1(step, group1):
    store = world.focus_obj
    step.given("Then I look at the menubar")
    step.given("I should find a \"File\" menu")
    step.given("When I look at the menu I should find a \"Open PackFile\" entry")
    step.given("And click on it")
    step.given("Then I should get a file select dbox.")
    world.dialog.child(roleName='text').text = group1
    world.dialog.button('Open').click()
    world.focus_obj = store
Esempio n. 24
0
def i_am_logged_in(step):
    step.given('I am in the login page')
    step.behave_as('''
    And I fill the form with the next info:
      | name     | value |
      | username | admin |
      | password | admin |
    ''')
    step.then('submit the form')
    step.then('see the logged in home page')
Esempio n. 25
0
def video_upload_is_enabled(step):
    if world.using_selenium:
        world.browser.get(django_url("/dashboard/sources/"))
        try:
            elt = world.browser.find_element_by_id("mediathread-video-upload")
            if elt:
                elt.click()
                step.given("I confirm the action")
        except NoSuchElementException:
            pass  # It's already enabled. That's ok.
Esempio n. 26
0
def test_form_not_contain_fields(step):
    step.given('I go to the "/" view')

    assert_equal(world.response_body.count(
                    '<input type="checkbox" name="theme_selections_'), 3)

    step.given("""
        There's form with following fields:
            | theme_selections_* |
    """)
def wait_until_batch_centroid_status_code_is(step, code1, code2, secs):
    start = datetime.utcnow()
    step.given('I get the batch centroid "{id}"'.format(id=world.batch_centroid['resource']))
    status = get_status(world.batch_centroid)
    while (status['code'] != int(code1) and
           status['code'] != int(code2)):
        time.sleep(3)
        assert datetime.utcnow() - start < timedelta(seconds=int(secs))
        step.given('I get the batch centroid "{id}"'.format(id=world.batch_centroid['resource']))
        status = get_status(world.batch_centroid)
    assert status['code'] == int(code1)
def wait_until_evaluation_status_code_is(step, code1, code2, secs):
    start = datetime.utcnow()
    step.given('I get the evaluation "{id}"'.format(id=world.evaluation['resource']))
    status = get_status(world.evaluation)
    while (status['code'] != int(code1) and
           status['code'] != int(code2)):
        time.sleep(3)
        assert datetime.utcnow() - start < timedelta(seconds=int(secs))
        step.given('I get the evaluation "{id}"'.format(id=world.evaluation['resource']))
        status = get_status(world.evaluation)
    assert status['code'] == int(code1)
Esempio n. 29
0
def wait_until_anomaly_status_code_is(step, code1, code2, secs):
    start = datetime.utcnow()
    step.given('I get the anomaly detector "{id}"'.format(id=world.anomaly['resource']))
    status = get_status(world.anomaly)
    while (status['code'] != int(code1) and
           status['code'] != int(code2)):
           time.sleep(3)
           assert datetime.utcnow() - start < timedelta(seconds=int(secs))
           step.given('I get the anomaly detector "{id}"'.format(id=world.anomaly['resource']))
           status = get_status(world.anomaly)
    assert status['code'] == int(code1)
Esempio n. 30
0
def i_created_a_video_component(step):
    step.given('I have created a Video component')

    # Store the current URL so we can return here
    video_url = world.browser.url

    # Upload subtitles for the video using the upload interface
    step.given('I have uploaded subtitles')

    # Return to the video
    world.visit(video_url)
Esempio n. 31
0
def return_to_course(step):
    step.given('I visit the homepage')
    world.click_link("View Course")
    world.click_link("Courseware")
Esempio n. 32
0
def go_into_course(step):
    step.given('I am registered for the course "6.002x"')
    step.given('And I am logged in')
    step.given('And I click on View Courseware')
def nav_to_the_courseware_page_of_a_course_with_multiple_sections(step):
    step.given('I have a course with multiple sections')
    step.given('I navigate to the course overview page')
Esempio n. 34
0
def cancel_does_not_save_changes(step):
    world.cancel_component(step)
    step.given("I edit and select Settings")
    step.given("I see the advanced settings and their expected values")
def i_am_on_advanced_course_settings(step):
    step.given('I have opened a new course in Studio')
    step.given('I select the Advanced Settings')
Esempio n. 36
0
def open_pages_page_in_new_course(step):
    step.given('I have opened a new course in Studio')
    step.given('I go to the pages page')
Esempio n. 37
0
def edit_new_unit(step):
    step.given('I have populated a new course in Studio')
    create_unit_from_course_outline()
Esempio n. 38
0
def see_sequence_content(step, sequence):
    step.given('I should see the content of section "2"')
Esempio n. 39
0
def see_section_content(step, section):
    if section == "2":
        text = 'The correct answer is Option 2'
    elif section == "1":
        text = 'The correct answer is Choice 3'
    step.given('I should see "' + text + '" somewhere on the page')
Esempio n. 40
0
def i_created_blank_html_page(step):
    step.given('I am in Studio editing a new unit')
    world.create_component_instance(step=step,
                                    category='html',
                                    component_type='Text')
Esempio n. 41
0
def i_created_etext_in_latex(step):
    step.given('I am in Studio editing a new unit')
    step.given('I have enabled latex compiler')
    world.create_component_instance(step=step,
                                    category='html',
                                    component_type='E-text Written in LaTeX')
Esempio n. 42
0
def i_created_raw_html(step):
    step.given('I am in Studio editing a new unit')
    world.create_component_instance(step=step,
                                    category='html',
                                    component_type='Raw HTML')
Esempio n. 43
0
def i_enabled_the_advanced_module(step, module):
    step.given('I have opened a new course section in Studio')
    world.css_click('.nav-course-settings')
    world.css_click('.nav-course-settings-advanced a')
    type_in_codemirror(0, '["%s"]' % module)
    press_the_notification_button(step, 'Save')
Esempio n. 44
0
def see_recent_section(step, section):
    step.given('I should see "You were most recently in %s" somewhere on the page' % subsection_name(int(section)))
Esempio n. 45
0
def i_created_etext_in_latex(step):
    world.create_course_with_unit()
    step.given('I have enabled latex compiler')
    world.create_component_instance(step=step,
                                    category='html',
                                    component_type='E-text Written in LaTeX')
Esempio n. 46
0
def i_should_see_be_on_the_studio_home_page(step):
    step.given('I should see the message "My Courses"')
Esempio n. 47
0
def prepare(step):
    step.given("I have 'msg_sender' test config")
    step.given("I stop 'mysql' service")
    step.given("I start 'mysql' service")
    step.given("I drop test database")
    step.given("I create test database")
    step.given("I create table 'messages'")
    step.given("I create table 'farms'")
    step.given("I create table 'farm_role_settings'")
    step.given("I create table 'servers'")
    step.given("I create table 'farm_roles'")
    step.given("I create table 'server_properties'")
    step.given("I create table 'farm_settings'")
    step.given("I create table 'role_behaviors'")
    step.given("I create table 'events'")
Esempio n. 48
0
def open_new_unit(step):
    step.given('I have opened a new course section in Studio')
    step.given('I have added a new subsection')
    step.given('I expand the first section')
    world.css_click('a.new-unit-item')
Esempio n. 49
0
def enable_latex_compiler(step):
    url = world.browser.url
    step.given("I select the Advanced Settings")
    change_value(step, 'Enable LaTeX Compiler', 'true')
    world.visit(url)
    world.wait_for_xmodule()
Esempio n. 50
0
def i_have_opened_checklists(step):
    step.given('I have opened a new course in Studio')
    step.given('I select Checklists from the Tools menu')
Esempio n. 51
0
def i_created_blank_common_problem(step):
    step.given('I am in Studio editing a new unit')
    step.given("I have created another Blank Common Problem")
Esempio n. 52
0
def i_am_brought_back_to_course_outline(step):
    step.given('I see the four default edX checklists')
    # In a previous step, we selected (1, 0) in order to click the 'Edit Course Outline' link.
    # Make sure the task is still showing as selected (there was a caching bug with the collection).
    verifyChecklist2Status(1, 7, 14)
Esempio n. 53
0
def i_export_the_course(step):
    step.given('I go to the export page')
    world.css_click('a.action-export')
Esempio n. 54
0
def i_am_brought_to_help_page_in_new_window(step):
    step.given('I see the four default edX checklists')
    windows = world.browser.windows
    assert_equal(2, len(windows))
    world.browser.switch_to_window(windows[1])
    assert_equal('http://help.edge.edx.org/', world.browser.url)
Esempio n. 55
0
def delete_all_components(step):
    count = len(world.css_find('ol.components li.component'))
    step.given('I delete "' + str(count) + '" component')
Esempio n. 56
0
def populate_course(step):
    step.given('I have added a new section')
    step.given('I have added a new subsection')
Esempio n. 57
0
def add_component_category(step, component, category):
    assert category in ('single step', 'HTML', 'Problem', 'Advanced Problem')
    given_string = 'I add this type of {} component:'.format(category)
    step.given('{}\n{}\n{}'.format(given_string, '|Component|',
                                   '|{}|'.format(component)))
Esempio n. 58
0
def logged_into_twitter(step):
    step.given('I have no cookies')
    step.given('I go to "http://twitter.com/"')
    step.given('I should see "Sign in"')
    world.browser.find_element_by_partial_link_text('Sign in').click()
    step.given('I fill in "username" with "%s"' % world.twitter_username)
    step.given('I fill in "password" with "%s"' % world.twitter_password)
    step.given('I press "Sign in"')
    elems = wait_for_elem(world.browser, '//*[contains(., "Your Tweets")]', 4)
    if not elems:
        world.browser.refresh()
    elems = wait_for_elem(world.browser, '//*[contains(., "Your Tweets")]', 4)
def i_have_opened_a_new_subsection(step):
    step.given('I have opened a new course section in Studio')
    step.given('I have added a new subsection')
    world.css_click('span.subsection-name-value')
Esempio n. 60
0
def create_static_page(step):
    step.given('I have opened the pages page in a new course')
    step.given('I add a new static page')