diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 95938242ca..96b840ae96 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -5,8 +5,6 @@ from lettuce import world, step from nose.tools import assert_true from nose.tools import assert_equal -from xmodule.modulestore.django import _MODULESTORES, modulestore -from xmodule.templates import update_templates from auth.authz import get_user_by_email from selenium.webdriver.common.keys import Keys @@ -50,31 +48,31 @@ def i_press_the_category_delete_icon(step, category): @step('I have opened a new course in Studio$') def i_have_opened_a_new_course(step): + open_new_course() + + +####### HELPER FUNCTIONS ############## +def open_new_course(): world.clear_courses() log_into_studio() create_a_course() -####### HELPER FUNCTIONS ############## def create_studio_user( uname='robot', email='robot+studio@edx.org', password='test', is_staff=False): - studio_user = world.UserFactory.build( + studio_user = world.UserFactory( username=uname, email=email, password=password, is_staff=is_staff) - studio_user.set_password(password) - studio_user.save() registration = world.RegistrationFactory(user=studio_user) registration.register(studio_user) registration.activate() - user_profile = world.UserProfileFactory(user=studio_user) - def fill_in_course_info( name='Robot Super Course', @@ -153,7 +151,7 @@ def set_date_and_time(date_css, desired_date, time_css, desired_time): world.css_fill(time_css, desired_time) e = world.css_find(time_css).first e._element.send_keys(Keys.TAB) - time.sleep(float(1)) + time.sleep(float(1)) @step('I have created a Video component$') diff --git a/cms/djangoapps/contentstore/features/component_settings_editor.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py similarity index 76% rename from cms/djangoapps/contentstore/features/component_settings_editor.py rename to cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 0a4e761fbd..a2710a19cd 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -1,10 +1,9 @@ +# disable missing docstring #pylint: disable=C0111 -#pylint: disable=W0621 from lettuce import world from nose.tools import assert_equal - -import time +from terrain.steps import reload_the_page @world.absorb @@ -24,9 +23,7 @@ def click_new_component_button(step, component_button_css): @world.absorb def click_component_from_menu(instance_id, expected_css): - new_instance = world.browser.find_by_id(instance_id) - assert_equal(1, len(new_instance)) - # TODO: why is this sleep necessary? - time.sleep(float(1)) - new_instance[0].click() + elem_css = "a[data-location='%s']" % instance_id + assert_equal(1, len(world.css_find(elem_css))) + world.css_click(elem_css) assert_equal(1, len(world.css_find(expected_css))) diff --git a/lms/djangoapps/courseware/features/video.py b/lms/djangoapps/courseware/features/video.py index 4aa1a399c9..982e75afd7 100644 --- a/lms/djangoapps/courseware/features/video.py +++ b/lms/djangoapps/courseware/features/video.py @@ -9,23 +9,26 @@ from common import * @step('when I view it it does autoplay') def does_autoplay(step): - assert world.css_find('.video')[0]['data-autoplay'] == 'True' - assert world.css_find('.video_control')[0].has_class('pause') + assert(world.css_find('.video')[0]['data-autoplay'] == 'True') + @step('the course has a Video component') def view_video(step): - model_course = 'model_course' coursename = TEST_COURSE_NAME.replace(' ', '_') i_am_registered_for_the_course(step, coursename) + # Make sure we have a video - video = create_video_component(coursename) - url = django_url('/courses/edx/%s/Test_Course/courseware/' % model_course) + video = add_video_to_course(coursename) + chapter_name = TEST_SECTION_NAME.replace(" ", "_") + section_name = chapter_name + url = django_url('/courses/edx/Test_Course/Test_Course/courseware/%s/%s' % + (chapter_name, section_name)) + world.browser.visit(url) - print('\n\n\n') - print world.browser.html - print('\n\n\n') -def create_video_component(course): - return world.ItemFactory.create(parent_location=section_location(course), - template='i4x://edx/templates/video/default') +def add_video_to_course(course): + template_name = 'i4x://edx/templates/video/default' + world.ItemFactory.create(parent_location=section_location(course), + template=template_name, + display_name='Video') diff --git a/lms/templates/video.html b/lms/templates/video.html index 2a864b2f18..267372176a 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -3,8 +3,24 @@ % endif %if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']: -
- +