diff --git a/cms/djangoapps/contentstore/features/courses.feature b/cms/djangoapps/contentstore/features/courses.feature deleted file mode 100644 index 5bd6fcb05ae17d6c59b570f754229636efdf6636..0000000000000000000000000000000000000000 --- a/cms/djangoapps/contentstore/features/courses.feature +++ /dev/null @@ -1,21 +0,0 @@ -@shard_2 -Feature: CMS.Create Course - In order offer a course on the edX platform - As a course author - I want to create courses - - Scenario: Error message when org/course/run tuple is too long - Given There are no courses - And I am logged into Studio - When I click the New Course button - And I create a course with "course name", "012345678901234567890123456789", "012345678901234567890123456789", and "0123456" - Then I see an error about the length of the org/course/run tuple - And the "Create" button is disabled - - Scenario: Course name is not included in the "too long" computation - Given There are no courses - And I am logged into Studio - When I click the New Course button - And I create a course with "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", "org", "coursenum", and "run" - And I press the "Create" button - Then the Courseware page has loaded in Studio diff --git a/cms/djangoapps/contentstore/features/courses.py b/cms/djangoapps/contentstore/features/courses.py deleted file mode 100644 index de94f437ae3eb5dc54b4aadedad30dac2da66300..0000000000000000000000000000000000000000 --- a/cms/djangoapps/contentstore/features/courses.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=missing-docstring -# pylint: disable=redefined-outer-name -# pylint: disable=unused-argument - -from lettuce import step, world - -from common import * - - -############### ACTIONS #################### - - -@step('There are no courses$') -def no_courses(step): - world.clear_courses() - create_studio_user() - - -@step('I click the New Course button$') -def i_click_new_course(step): - world.css_click('.new-course-button') - - -@step('I fill in the new course information$') -def i_fill_in_a_new_course_information(step): - fill_in_course_info() - - -@step('I create a course with "([^"]*)", "([^"]*)", "([^"]*)", and "([^"]*)"') -def i_create_course(step, name, org, number, run): - fill_in_course_info(name=name, org=org, num=number, run=run) - - -@step('I create a new course$') -def i_create_a_course(step): - create_a_course() - - -@step('I click the course link in Studio Home$') -def i_click_the_course_link_in_studio_home(step): # pylint: disable=invalid-name - course_css = 'a.course-link' - world.css_click(course_css) - - -@step('I see an error about the length of the org/course/run tuple') -def i_see_error_about_length(step): - assert world.css_has_text( - '#course_creation_error', - 'The combined length of the organization, course number, ' - 'and course run fields cannot be more than 65 characters.' - ) - -############ ASSERTIONS ################### - - -@step('the Courseware page has loaded in Studio$') -def courseware_page_has_loaded_in_studio(step): - course_title_css = 'span.course-title' - assert world.is_css_present(course_title_css) - - -@step('I see the course listed in Studio Home$') -def i_see_the_course_in_studio_home(step): - course_css = 'h3.class-title' - assert world.css_has_text(course_css, world.scenario_dict['COURSE'].display_name) - - -@step('I am on the "([^"]*)" tab$') -def i_am_on_tab(step, tab_name): - header_css = 'div.inner-wrapper h1' - assert world.css_has_text(header_css, tab_name) - - -@step('I see a link for adding a new section$') -def i_see_new_section_link(step): - link_css = '.outline .button-new' - assert world.css_has_text(link_css, 'New Section') diff --git a/common/test/acceptance/pages/studio/index.py b/common/test/acceptance/pages/studio/index.py index 0dfcc67f474ac2f564573903e674410abb63f785..a0afcb9ecb7d5eaf5214ecf871c4fe58805f8bb8 100644 --- a/common/test/acceptance/pages/studio/index.py +++ b/common/test/acceptance/pages/studio/index.py @@ -290,6 +290,27 @@ class DashboardPage(PageObject, HelpMixin): ) return self.q(css='#settings-language-value') + @property + def course_creation_error_message(self): + """ + Returns the course creation error + """ + self.wait_for_element_visibility( + '#course_creation_error>p', + 'Length error is present' + ) + return self.q(css='#course_creation_error>p').text[0] + + def is_create_button_disabled(self): + """ + Returns: True if Create button is disbaled + """ + self.wait_for_element_presence( + '.action.action-primary.new-course-save.is-disabled', + "Create button is disabled" + ) + return True + class HomePage(DashboardPage): """ diff --git a/common/test/acceptance/tests/studio/test_studio_course_create.py b/common/test/acceptance/tests/studio/test_studio_course_create.py index 8eb6c0a43685c4d5629cc28e97d45f659d31ec81..aece1d8c8a7dc53a950b3d5de4ca8be252a355d5 100644 --- a/common/test/acceptance/tests/studio/test_studio_course_create.py +++ b/common/test/acceptance/tests/studio/test_studio_course_create.py @@ -2,6 +2,8 @@ Acceptance tests for course creation. """ import uuid +import random +import string from nose.plugins.attrib import attr @@ -144,3 +146,66 @@ class CreateCourseTest(AcceptanceTest): self.assertTrue(self.dashboard_page.has_course( org=new_org, number=self.course_number, run=self.course_run )) + + def test_error_appears_with_long_tuple(self): + """ + Scenario: Ensure that the course creation is not successful with 66 characters long tuple. + Given I have filled course creation from with combined length of 66 characters for Organization, course Number + and course Run. + And I have a valid course name + Then form validation should not pass + And I see error for combined length longer than 65 + """ + course_org = "012345678901234567890123456789" + course_number = ''.join(random.choice(string.digits) for _ in range(30)) + course_run = "0123456" + self.auth_page.visit() + self.dashboard_page.visit() + self.assertTrue(self.dashboard_page.new_course_button.present) + self.dashboard_page.click_new_course_button() + self.assertTrue(self.dashboard_page.is_new_course_form_visible()) + self.dashboard_page.fill_new_course_form( + self.course_name, course_org, course_number, course_run + ) + self.assertEqual( + self.dashboard_page.course_creation_error_message, + 'The combined length of the organization, course number, and course run fields cannot be more than 65 ' + 'characters.' + ) + self.assertTrue(self.dashboard_page.is_create_button_disabled()) + + def test_no_error_appears_for_long_course_name(self): + """ + Scenario: Ensure that the course creation with 66 characters long course name is successful. + Given I have filled course creation form with 66 characters long course name. + And I have filled remaining form within the allowed characters length. + When I click 'Create' button + Form validation should pass + Then I see the course listing page with newly created course + """ + course_name = ''.join(random.choice(string.ascii_uppercase) for _ in range(66)) + self.auth_page.visit() + self.dashboard_page.visit() + self.assertFalse(self.dashboard_page.has_course( + org=self.course_org, number=self.course_number, run=self.course_run + )) + self.dashboard_page.click_new_course_button() + self.assertTrue(self.dashboard_page.is_new_course_form_visible()) + self.dashboard_page.fill_new_course_form( + course_name, self.course_org, self.course_number, self.course_run + ) + self.dashboard_page.submit_new_course_form() + # Successful creation of course takes user to course outline page + course_outline_page = CourseOutlinePage( + self.browser, + self.course_org, + self.course_number, + self.course_run + ) + course_outline_page.visit() + course_outline_page.wait_for_page() + self.dashboard_page.visit() + # Assert that course is present on dashboard + self.assertTrue(self.dashboard_page.has_course( + org=self.course_org, number=self.course_number, run=self.course_run + ))