Discard changes rewrite.
STUD-1860
This commit is contained in:
@@ -88,22 +88,13 @@ class ContainerPage(PageObject):
|
||||
"""
|
||||
return self.q(css='.action-publish').first
|
||||
|
||||
# def discard_changes(self):
|
||||
# """
|
||||
# Discards draft changes and reloads the page.
|
||||
# NOT YET IMPLEMENTED-- part of future story
|
||||
# """
|
||||
#
|
||||
# self.q(css='.action-discard').first.click()
|
||||
#
|
||||
# # TODO: work with Jay/Christine on this. I can't find something to wait on
|
||||
# # that guarantees the button will be clickable.
|
||||
# time.sleep(2)
|
||||
#
|
||||
# self.q(css='a.button.action-primary').first.click()
|
||||
# self.wait_for_ajax()
|
||||
#
|
||||
# return ContainerPage(self.browser, self.locator).visit()
|
||||
def discard_changes(self):
|
||||
"""
|
||||
Discards draft changes (which will then re-render the page).
|
||||
"""
|
||||
click_css(self, 'a.action-discard', 0, require_notification=False)
|
||||
self.q(css='a.button.action-primary').first.click()
|
||||
self.wait_for_ajax()
|
||||
|
||||
def view_published_version(self):
|
||||
"""
|
||||
|
||||
@@ -375,6 +375,8 @@ class UnitPublishingTest(ContainerBase):
|
||||
"""
|
||||
Tests of the publishing control and related widgets on the Unit page.
|
||||
"""
|
||||
PUBLISHED_STATUS = "Publishing Status\nPublished"
|
||||
DRAFT_STATUS = "Publishing Status\nDraft (Unpublished changes)"
|
||||
|
||||
def setup_fixtures(self):
|
||||
"""
|
||||
@@ -407,26 +409,26 @@ class UnitPublishingTest(ContainerBase):
|
||||
Test the state changes when a published unit has draft changes.
|
||||
"""
|
||||
unit = self.go_to_unit_page()
|
||||
self.assertEqual("Publishing Status\nPublished", unit.publish_title)
|
||||
self.assertEqual(self.PUBLISHED_STATUS, unit.publish_title)
|
||||
# Should not be able to click on Publish action -- but I don't know how to test that it is not clickable.
|
||||
# TODO: continue discussion with Muhammad and Jay about this.
|
||||
|
||||
# Add a component to the page so it will have unpublished changes.
|
||||
add_discussion(unit)
|
||||
self.assertEqual("Publishing Status\nDraft (Unpublished changes)", unit.publish_title)
|
||||
self.assertEqual(self.DRAFT_STATUS, unit.publish_title)
|
||||
unit.publish_action.click()
|
||||
unit.wait_for_ajax()
|
||||
self.assertEqual("Publishing Status\nPublished", unit.publish_title)
|
||||
self.assertEqual(self.PUBLISHED_STATUS, unit.publish_title)
|
||||
|
||||
# TODO: part of future story.
|
||||
# def test_discard_changes(self):
|
||||
# """
|
||||
# Test the state after discard changes.
|
||||
# """
|
||||
# unit = self.go_to_unit_page()
|
||||
# add_discussion(unit)
|
||||
# unit = unit.discard_changes()
|
||||
# self.assertEqual("Publishing Status\nPublished", unit.publish_title)
|
||||
def test_discard_changes(self):
|
||||
"""
|
||||
Test the state after discard changes.
|
||||
"""
|
||||
unit = self.go_to_unit_page()
|
||||
add_discussion(unit)
|
||||
self.assertEqual(self.DRAFT_STATUS, unit.publish_title)
|
||||
unit.discard_changes()
|
||||
self.assertEqual(self.PUBLISHED_STATUS, unit.publish_title)
|
||||
|
||||
def test_view_live_no_changes(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user