Add back missing 'New Post" button
TNL-1097
This commit is contained in:
@@ -552,3 +552,25 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin):
|
|||||||
lambda: _match_messages(text).results == [],
|
lambda: _match_messages(text).results == [],
|
||||||
"waiting for dismissed alerts to disappear"
|
"waiting for dismissed alerts to disappear"
|
||||||
).fulfill()
|
).fulfill()
|
||||||
|
|
||||||
|
def click_new_post_button(self):
|
||||||
|
"""
|
||||||
|
Clicks the 'New Post' button.
|
||||||
|
"""
|
||||||
|
self.new_post_button.click()
|
||||||
|
EmptyPromise(
|
||||||
|
lambda: (
|
||||||
|
self.new_post_form
|
||||||
|
),
|
||||||
|
"New post action succeeded"
|
||||||
|
).fulfill()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def new_post_button(self):
|
||||||
|
elements = self.q(css="ol.course-tabs .new-post-btn")
|
||||||
|
return elements.first if elements.visible and len(elements) == 1 else None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def new_post_form(self):
|
||||||
|
elements = self.q(css=".forum-new-post-form")
|
||||||
|
return elements[0] if elements.visible and len(elements) == 1 else None
|
||||||
|
|||||||
@@ -111,6 +111,33 @@ class DiscussionResponsePaginationTestMixin(BaseDiscussionMixin):
|
|||||||
self.assertFalse(self.thread_page.has_add_response_button())
|
self.assertFalse(self.thread_page.has_add_response_button())
|
||||||
|
|
||||||
|
|
||||||
|
@attr('shard_1')
|
||||||
|
class DiscussionHomePageTest(UniqueCourseTest):
|
||||||
|
"""
|
||||||
|
Tests for the discussion home page.
|
||||||
|
"""
|
||||||
|
|
||||||
|
SEARCHED_USERNAME = "gizmo"
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(DiscussionHomePageTest, self).setUp()
|
||||||
|
CourseFixture(**self.course_info).install()
|
||||||
|
AutoAuthPage(self.browser, course_id=self.course_id).visit()
|
||||||
|
self.page = DiscussionTabHomePage(self.browser, self.course_id)
|
||||||
|
self.page.visit()
|
||||||
|
|
||||||
|
def test_new_post_button(self):
|
||||||
|
"""
|
||||||
|
Scenario: I can create new posts from the Discussion home page.
|
||||||
|
Given that I am on the Discussion home page
|
||||||
|
When I click on the 'New Post' button
|
||||||
|
Then I should be shown the new post form
|
||||||
|
"""
|
||||||
|
self.assertIsNotNone(self.page.new_post_button)
|
||||||
|
self.page.click_new_post_button()
|
||||||
|
self.assertIsNotNone(self.page.new_post_form)
|
||||||
|
|
||||||
|
|
||||||
@attr('shard_1')
|
@attr('shard_1')
|
||||||
class DiscussionTabSingleThreadTest(UniqueCourseTest, DiscussionResponsePaginationTestMixin):
|
class DiscussionTabSingleThreadTest(UniqueCourseTest, DiscussionResponsePaginationTestMixin):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ def url_class(is_active):
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
% endfor
|
% endfor
|
||||||
|
<%block name="extratabs" />
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Reference in New Issue
Block a user