From 9e93d5588c081efb451e28c999532136a13f037c Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 7 Aug 2013 10:14:50 -0400 Subject: [PATCH 1/5] Changed css_selector --- cms/djangoapps/contentstore/features/common.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index e06f27bcea..077134659b 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -179,8 +179,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)) From 5941f5b79528bacc7699070b5a9d3958b688d975 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 7 Aug 2013 11:30:50 -0400 Subject: [PATCH 2/5] Fixed the other places that the css occurs --- cms/djangoapps/contentstore/features/common.py | 6 ++---- cms/djangoapps/contentstore/features/course-team.py | 2 +- cms/djangoapps/contentstore/features/courses.py | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 077134659b..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$') diff --git a/cms/djangoapps/contentstore/features/course-team.py b/cms/djangoapps/contentstore/features/course-team.py index 57545060c1..6bea1b40f0 100644 --- a/cms/djangoapps/contentstore/features/course-team.py +++ b/cms/djangoapps/contentstore/features/course-team.py @@ -93,7 +93,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) From 5919456f249e3e7fb0755eb25c278b6574a163aa Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 7 Aug 2013 12:03:25 -0400 Subject: [PATCH 3/5] Fixed some course-team bugs and other css stuff --- cms/djangoapps/contentstore/features/course-overview.py | 2 +- cms/djangoapps/contentstore/features/course-team.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 6bea1b40f0..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") From a38f71cdbc1174dc39ea0f15b4c2eb70589c46e7 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 7 Aug 2013 13:06:25 -0400 Subject: [PATCH 4/5] Fixed the upload test --- cms/djangoapps/contentstore/features/upload.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index df63b26b3b..369cc24ae8 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) From ed620e635b21e7e5aaf651b0140c21ad5f853245 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Wed, 7 Aug 2013 13:07:38 -0400 Subject: [PATCH 5/5] Reset the file within the test itself --- cms/djangoapps/contentstore/features/upload.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index 369cc24ae8..32d591b5df 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -77,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 "([^"]*)"$')