Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions cms/djangoapps/contentstore/features/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,27 +396,3 @@ def create_other_user(_step, name, has_extra_perms, role_name):
def log_out(_step):
world.visit('logout')


@step(u'I click on "edit a draft"$')
def i_edit_a_draft(_step):
world.css_click("a.create-draft")


@step(u'I click on "replace with draft"$')
def i_replace_w_draft(_step):
world.css_click("a.publish-draft")


@step(u'I click on "delete draft"$')
def i_delete_draft(_step):
world.css_click("a.delete-draft")


@step(u'I publish the unit$')
def publish_unit(_step):
world.select_option('visibility-select', 'public')


@step(u'I unpublish the unit$')
def unpublish_unit(_step):
world.select_option('visibility-select', 'private')
15 changes: 8 additions & 7 deletions cms/djangoapps/contentstore/features/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# pylint: disable=W0613

from lettuce import world, step
from nose.tools import assert_true, assert_in # pylint: disable=E0611
from nose.tools import assert_true, assert_in, assert_equal # pylint: disable=E0611

DISPLAY_NAME = "Display Name"

Expand Down Expand Up @@ -48,7 +48,7 @@ def add_a_multi_step_component(step, is_advanced, category):
def see_a_multi_step_component(step, category):

# Wait for all components to finish rendering
selector = 'li.component div.xblock-student_view'
selector = 'li.studio-xblock-wrapper div.xblock-student_view'
world.wait_for(lambda _: len(world.css_find(selector)) == len(step.hashes))

for idx, step_hash in enumerate(step.hashes):
Expand Down Expand Up @@ -79,7 +79,7 @@ def see_a_problem_component(step, category):
assert_true(world.is_css_present(component_css),
'No problem was added to the unit.')

problem_css = 'li.component div.xblock-student_view'
problem_css = 'li.studio-xblock-wrapper div.xblock-student_view'
actual_text = world.css_text(problem_css)
assert_in(category.upper(), actual_text)

Expand All @@ -93,7 +93,7 @@ def add_component_category(step, component, category):

@step(u'I delete all components$')
def delete_all_components(step):
count = len(world.css_find('ol.components li.component'))
count = len(world.css_find('ol.reorderable-container li.studio-xblock-wrapper'))
step.given('I delete "' + str(count) + '" component')


Expand Down Expand Up @@ -124,7 +124,7 @@ def delete_components(step, number):

@step(u'I see no components')
def see_no_components(steps):
assert world.is_css_not_present('li.component')
assert world.is_css_not_present('li.studio-xblock-wrapper')


@step(u'I delete a component')
Expand Down Expand Up @@ -162,8 +162,9 @@ def find_problem(_driver):

@step(u'I see the display name is "([^"]*)"')
def check_component_display_name(step, display_name):
label = world.css_text(".component-header")
assert display_name == label
# The display name for the unit uses the same structure, must differentiate by level-element.
label = world.css_html("section.level-element>header>div>div>span.xblock-display-name")
assert_equal(display_name, label)


@step(u'I change the display name to "([^"]*)"')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def ensure_settings_visible():


@world.absorb
def edit_component():
def edit_component(index=0):
world.wait_for(lambda _driver: world.css_visible('a.edit-button'))
world.css_click('a.edit-button')
world.css_click('a.edit-button', index)
world.wait_for_ajax_complete()


Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/features/course-export.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ def i_click_on_error_dialog(step):
# we don't know the actual ID of the vertical. So just check that we did go to a
# vertical page in the course (there should only be one).
vertical_usage_key = course_key.make_usage_key("vertical", "")
vertical_url = reverse_usage_url('unit_handler', vertical_usage_key)
vertical_url = reverse_usage_url('container_handler', vertical_usage_key)
assert_equal(1, world.browser.url.count(vertical_url))
32 changes: 0 additions & 32 deletions cms/djangoapps/contentstore/features/problem-editor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,6 @@ Feature: CMS.Problem Editor
When I edit and select Settings
Then Edit High Level Source is visible

# This is a very specific scenario that was failing with some of the
# DB rearchitecture changes. It had to do with children IDs being stored
# with @draft at the end. To reproduce, must update children while in draft mode.
Scenario: Problems can be deleted after being public
Given I have created a Blank Common Problem
And I have created another Blank Common Problem
When I publish the unit
And I click on "edit a draft"
And I delete "1" component
And I click on "replace with draft"
And I click on "edit a draft"
And I delete "1" component
Then I see no components

# This is a very specific scenario for a bug where editing a component in draft
# impacted the published version.
Scenario: Changes to draft problem do not impact published version
Given I have created a Blank Common Problem
When I publish the unit
And I click on "edit a draft"
And I change the display name to "draft"
And I click on "delete draft"
Then the problem display name is "Blank Common Problem"

Scenario: Problems can be made private after being made public
Given I have created a Blank Common Problem
When I publish the unit
And I click on "edit a draft"
And I click on "delete draft"
And I unpublish the unit
Then I can edit the problem

Scenario: Cheat sheet visible on toggle
Given I have created a Blank Common Problem
And I can edit the problem
Expand Down
4 changes: 1 addition & 3 deletions cms/djangoapps/contentstore/features/problem-editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,13 @@ def i_can_edit_problem(_step):

@step(u'I edit first blank advanced problem for annotation response$')
def i_edit_blank_problem_for_annotation_response(_step):
edit_css = """$('.component-header:contains("Blank Advanced Problem")').parent().find('a.edit-button').click()"""
world.edit_component(1)
text = """
<problem>
<annotationresponse>
<annotationinput><text>Text of annotation</text></annotationinput>
</annotationresponse>
</problem>"""
world.browser.execute_script(edit_css)
world.wait_for_ajax_complete()
type_in_codemirror(0, text)
world.save_component()

Expand Down
8 changes: 4 additions & 4 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def check_components_on_page(self, component_types, expected_types):

# just pick one vertical
descriptor = store.get_items(course.id, category='vertical',)
resp = self.client.get_html(get_url('unit_handler', descriptor[0].location))
resp = self.client.get_html(get_url('container_handler', descriptor[0].location))
self.assertEqual(resp.status_code, 200)
_test_no_locations(self, resp)

Expand All @@ -153,7 +153,7 @@ def test_malformed_edit_unit_request(self):
# just pick one vertical
usage_key = course_items[0].id.make_usage_key('vertical', None)

resp = self.client.get_html(get_url('unit_handler', usage_key))
resp = self.client.get_html(get_url('container_handler', usage_key))
self.assertEqual(resp.status_code, 400)
_test_no_locations(self, resp, status_code=400)

Expand Down Expand Up @@ -1185,7 +1185,7 @@ def _check_verticals(self, items):
# Assert is here to make sure that the course being tested actually has verticals (units) to check.
self.assertGreater(len(items), 0)
for descriptor in items:
resp = self.client.get_html(get_url('unit_handler', descriptor.location))
resp = self.client.get_html(get_url('container_handler', descriptor.location))
self.assertEqual(resp.status_code, 200)
_test_no_locations(self, resp)

Expand Down Expand Up @@ -1585,7 +1585,7 @@ def test_get_html(handler):

# go look at the Edit page
unit_key = course_key.make_usage_key('vertical', 'test_vertical')
resp = self.client.get_html(get_url('unit_handler', unit_key))
resp = self.client.get_html(get_url('container_handler', unit_key))
self.assertEqual(resp.status_code, 200)
_test_no_locations(self, resp)

Expand Down
Loading