diff --git a/cms/djangoapps/contentstore/features/component.feature b/cms/djangoapps/contentstore/features/component.feature index 29b8db2400..95a37018e7 100644 --- a/cms/djangoapps/contentstore/features/component.feature +++ b/cms/djangoapps/contentstore/features/component.feature @@ -2,17 +2,6 @@ Feature: CMS.Component Adding As a course author, I want to be able to add a wide variety of components - Scenario: I can add single step components - Given I am in Studio editing a new unit - When I add this type of single step component: - | Component | - | Discussion | - | Video | - Then I see this type of single step component: - | Component | - | Discussion | - | Video | - Scenario: I can add HTML components Given I am in Studio editing a new unit When I add this type of HTML component: @@ -57,24 +46,6 @@ Feature: CMS.Component Adding | Numerical Input | | Text Input | - Scenario Outline: I can add Advanced Problem components - Given I am in Studio editing a new unit - When I add a "" "Advanced Problem" component - Then I see a "" Problem component - # Flush out the database before the next example executes - And I reset the database - - Examples: - | Component | - | Blank Advanced Problem | - | Circuit Schematic Builder | - | Custom Python-Evaluated Input | - | Drag and Drop | - | Image Mapped Input | - | Math Expression Input | - | Problem with Adaptive Hint | - - # Disabled 1/21/14 due to flakiness seen in master # Scenario: I can add Advanced Latex Problem components # Given I am in Studio editing a new unit @@ -89,32 +60,6 @@ Feature: CMS.Component Adding # | Problem Written in LaTeX | # | Problem with Adaptive Hint in Latex | - Scenario: I see a prompt on delete - Given I am in Studio editing a new unit - And I add a "Discussion" "single step" component - And I delete a component - Then I am shown a prompt - - Scenario: I can delete Components - Given I am in Studio editing a new unit - And I add a "Discussion" "single step" component - And I add a "Text" "HTML" component - And I add a "Blank Common Problem" "Problem" component - And I add a "Blank Advanced Problem" "Advanced Problem" component - And I delete all components - Then I see no components - - Scenario: I can duplicate a component - Given I am in Studio editing a new unit - And I add a "Blank Common Problem" "Problem" component - And I add a "Multiple Choice" "Problem" component - And I duplicate the first component - Then I see a Problem component with display name "Duplicate of 'Blank Common Problem'" in position "1" - And I reload the page - Then I see a Problem component with display name "Blank Common Problem" in position "0" - And I see a Problem component with display name "Duplicate of 'Blank Common Problem'" in position "1" - And I see a Problem component with display name "Multiple Choice" in position "2" - Scenario: I can set the display name of a component Given I am in Studio editing a new unit When I add a "Text" "HTML" component diff --git a/common/test/acceptance/pages/studio/utils.py b/common/test/acceptance/pages/studio/utils.py index f3c28712dd..5ac2148234 100644 --- a/common/test/acceptance/pages/studio/utils.py +++ b/common/test/acceptance/pages/studio/utils.py @@ -61,7 +61,7 @@ def add_advanced_component(page, menu_index, name): click_css(page, component_css, 0) -def add_component(page, item_type, specific_type): +def add_component(page, item_type, specific_type, is_advanced_problem=False): """ Click one of the "Add New Component" buttons. @@ -81,8 +81,21 @@ def add_component(page, item_type, specific_type): 'Wait for the add component menu to disappear' ) + # "Common Problem Types" are shown by default. + # For advanced problem types you must first select the "Advanced" tab. + if is_advanced_problem: + advanced_tab = page.q(css='.problem-type-tabs a').filter(text='Advanced').first + advanced_tab.click() + + # Wait for the advanced tab to be active + css = '.problem-type-tabs li.ui-tabs-active a' + page.wait_for( + lambda: len(page.q(css=css).filter(text='Advanced').execute()) > 0, + 'Waiting for the Advanced problem tab to be active' + ) + all_options = page.q(css='.new-component-{} ul.new-component-template li button span'.format(item_type)) - chosen_option = all_options.filter(lambda el: el.text == specific_type).first + chosen_option = all_options.filter(text=specific_type).first chosen_option.click() wait_for_notification(page) page.wait_for_ajax() diff --git a/common/test/acceptance/tests/studio/test_studio_components.py b/common/test/acceptance/tests/studio/test_studio_components.py new file mode 100644 index 0000000000..c4527cc631 --- /dev/null +++ b/common/test/acceptance/tests/studio/test_studio_components.py @@ -0,0 +1,67 @@ +""" +Acceptance tests for adding components in Studio. +""" +import ddt + +from .base_studio_test import ContainerBase +from ...fixtures.course import XBlockFixtureDesc +from ...pages.studio.container import ContainerPage +from ...pages.studio.utils import add_component + + +@ddt.ddt +class AdvancedProblemComponentTest(ContainerBase): + """ + Feature: CMS.Component Adding + As a course author, I want to be able to add a wide variety of components + """ + def setUp(self, is_staff=True): + """ + Create a course with a section, subsection, and unit to which to add the component. + """ + super(AdvancedProblemComponentTest, self).setUp(is_staff=is_staff) + + def populate_course_fixture(self, course_fixture): + course_fixture.add_advanced_settings( + {u"advanced_modules": {"value": ["split_test"]}} + ) + + course_fixture.add_children( + XBlockFixtureDesc('chapter', 'Test Section').add_children( + XBlockFixtureDesc('sequential', 'Test Subsection').add_children( + XBlockFixtureDesc('vertical', 'Test Unit') + ) + ) + ) + + @ddt.data( + 'Blank Advanced Problem', + 'Circuit Schematic Builder', + 'Custom Python-Evaluated Input', + 'Drag and Drop', + 'Image Mapped Input', + 'Math Expression Input', + 'Problem with Adaptive Hint', + ) + def test_add_advanced_problem(self, component): + """ + Scenario Outline: I can add Advanced Problem components + Given I am in Studio editing a new unit + When I add a "" "Advanced Problem" component + Then I see a "" Problem component + + Examples: + | Component | + | Blank Advanced Problem | + | Circuit Schematic Builder | + | Custom Python-Evaluated Input | + | Drag and Drop | + | Image Mapped Input | + | Math Expression Input | + | Problem with Adaptive Hint | + """ + self.go_to_unit_page() + page = ContainerPage(self.browser, None) + add_component(page, 'problem', component, is_advanced_problem=True) + problem = page.xblocks[1] + self.assertEqual(problem.name, component)