Commit 2c8148c7 by Jesse Zoldak

Convert tests for adding advanced problem components from lettuce to bok-choy

TE-1201
parent bfdd1883
...@@ -57,24 +57,6 @@ Feature: CMS.Component Adding ...@@ -57,24 +57,6 @@ Feature: CMS.Component Adding
| Numerical Input | | Numerical Input |
| Text Input | | Text Input |
Scenario Outline: I can add Advanced Problem components
Given I am in Studio editing a new unit
When I add a "<Component>" "Advanced Problem" component
Then I see a "<Component>" 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 # Disabled 1/21/14 due to flakiness seen in master
# Scenario: I can add Advanced Latex Problem components # Scenario: I can add Advanced Latex Problem components
# Given I am in Studio editing a new unit # Given I am in Studio editing a new unit
......
...@@ -61,7 +61,7 @@ def add_advanced_component(page, menu_index, name): ...@@ -61,7 +61,7 @@ def add_advanced_component(page, menu_index, name):
click_css(page, component_css, 0) 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. Click one of the "Add New Component" buttons.
...@@ -81,8 +81,14 @@ def add_component(page, item_type, specific_type): ...@@ -81,8 +81,14 @@ def add_component(page, item_type, specific_type):
'Wait for the add component menu to disappear' '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()
all_options = page.q(css='.new-component-{} ul.new-component-template li button span'.format(item_type)) 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() chosen_option.click()
wait_for_notification(page) wait_for_notification(page)
page.wait_for_ajax() page.wait_for_ajax()
......
"""
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
"""
__test__ = True
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 "<Component>" "Advanced Problem" component
Then I see a "<Component>" 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment