diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index e06f27bcea..42e3193cf3 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -56,10 +56,8 @@ def i_have_opened_a_new_course(_step): @step('(I select|s?he selects) the new course') def select_new_course(_step, whom): - course_link_xpath = '//div[contains(@class, "courses")]//a[contains(@class, "class-link")]//span[contains(., "{name}")]/..'.format( - name="Robot Super Course") - element = world.browser.find_by_xpath(course_link_xpath) - element.click() + course_link_css = 'a.course-link' + world.css_click(course_link_css) @step(u'I press the "([^"]*)" notification button$') @@ -179,8 +177,7 @@ def create_a_course(): user.groups.add(group) user.save() world.browser.reload() - - course_link_css = 'span.class-name' + course_link_css = 'a.course-link' world.css_click(course_link_css) course_title_css = 'span.course-title' assert_true(world.is_css_present(course_title_css)) diff --git a/cms/djangoapps/contentstore/features/course-overview.py b/cms/djangoapps/contentstore/features/course-overview.py index 8baad68fdf..3fcb134f5b 100644 --- a/cms/djangoapps/contentstore/features/course-overview.py +++ b/cms/djangoapps/contentstore/features/course-overview.py @@ -52,7 +52,7 @@ def have_a_course_with_two_sections(step): def navigate_to_the_course_overview_page(step): create_studio_user(is_staff=True) log_into_studio() - course_locator = '.class-name' + course_locator = 'a.course-link' world.css_click(course_locator) diff --git a/cms/djangoapps/contentstore/features/course-team.py b/cms/djangoapps/contentstore/features/course-team.py index 57545060c1..2871d7a7af 100644 --- a/cms/djangoapps/contentstore/features/course-team.py +++ b/cms/djangoapps/contentstore/features/course-team.py @@ -55,6 +55,8 @@ def delete_other_user(_step, name): email="{0}{1}".format(name, EMAIL_EXTENSION)) world.css_click(to_delete_css) # confirm prompt + # need to wait for the animation to be done, there isn't a good success condition that won't work both on latest chrome and jenkins + world.wait(.5) world.css_click(".wrapper-prompt-warning .action-primary") @@ -93,7 +95,7 @@ def other_user_login(_step, name): @step(u'I( do not)? see the course on my page') @step(u's?he does( not)? see the course on (his|her) page') def see_course(_step, inverted, gender='self'): - class_css = 'span.class-name' + class_css = 'h3.course-title' all_courses = world.css_find(class_css, wait_time=1) all_names = [item.html for item in all_courses] if inverted: diff --git a/cms/djangoapps/contentstore/features/courses.py b/cms/djangoapps/contentstore/features/courses.py index 2feafce361..f18b06ec64 100644 --- a/cms/djangoapps/contentstore/features/courses.py +++ b/cms/djangoapps/contentstore/features/courses.py @@ -30,7 +30,7 @@ def i_create_a_course(step): @step('I click the course link in My Courses$') def i_click_the_course_link_in_my_courses(step): - course_css = 'span.class-name' + course_css = 'a.course-link' world.css_click(course_css) ############ ASSERTIONS ################### @@ -44,7 +44,7 @@ def courseware_page_has_loaded_in_studio(step): @step('I see the course listed in My Courses$') def i_see_the_course_in_my_courses(step): - course_css = 'span.class-name' + course_css = 'h3.class-title' assert world.css_has_text(course_css, world.scenario_dict['COURSE'].display_name) diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index df63b26b3b..32d591b5df 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -24,13 +24,10 @@ def go_to_uploads(_step): def upload_file(_step, file_name): upload_css = 'a.upload-button' world.css_click(upload_css) - - file_css = 'input.file-input' - upload = world.css_find(file_css) #uploading the file itself path = os.path.join(TEST_ROOT, 'uploads/', file_name) - upload._element.send_keys(os.path.abspath(path)) - + 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) @@ -80,6 +77,9 @@ def check_download(_step, file_name): r = get_file(file_name) downloaded_text = r.text assert cur_text == downloaded_text + #resetting the file back to its original state + with open(os.path.abspath(path), 'w') as cur_file: + cur_file.write("This is an arbitrary file for testing uploads") @step(u'I modify "([^"]*)"$')