Commit be32d74a by attiyaishaque

TNL-6017 Receive Updates checkbox saved in discussion forums.

parent b2cd0359
...@@ -688,6 +688,26 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin): ...@@ -688,6 +688,26 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin):
"waiting for server to return result" "waiting for server to return result"
).fulfill() ).fulfill()
def is_element_visible(self, selector):
"""
Returns true if the element matching the specified selector is visible.
"""
query = self.q(css=selector)
return query.present and query.visible
def is_checkbox_selected(self, selector):
"""
Returns true or false depending upon the matching checkbox is checked.
"""
return self.q(css=selector).selected
def refresh_and_wait_for_load(self):
"""
Refresh the page and wait for all resources to load.
"""
self.browser.refresh()
self.wait_for_page()
def get_search_alert_messages(self): def get_search_alert_messages(self):
return self.q(css=self.ALERT_SELECTOR + " .message").text return self.q(css=self.ALERT_SELECTOR + " .message").text
...@@ -720,6 +740,13 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin): ...@@ -720,6 +740,13 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin):
"New post action succeeded" "New post action succeeded"
).fulfill() ).fulfill()
def click_element(self, selector):
"""
Clicks the element specified by selector
"""
element = self.q(css=selector)
return element.click()
@property @property
def new_post_button(self): def new_post_button(self):
""" """
......
...@@ -206,6 +206,25 @@ class DiscussionHomePageTest(BaseDiscussionTestCase): ...@@ -206,6 +206,25 @@ class DiscussionHomePageTest(BaseDiscussionTestCase):
self.page.click_new_post_button() self.page.click_new_post_button()
self.assertIsNotNone(self.page.new_post_form) self.assertIsNotNone(self.page.new_post_form)
def test_receive_update_checkbox(self):
"""
Scenario: I can save the receive update email notification checkbox
on Discussion home page.
Given that I am on the Discussion home page
When I click on the 'Receive update' checkbox
Then it should always shown selected.
"""
receive_updates_selector = '.email-setting'
receive_updates_checkbox = self.page.is_element_visible(receive_updates_selector)
self.assertTrue(receive_updates_checkbox)
self.assertFalse(self.page.is_checkbox_selected(receive_updates_selector))
self.page.click_element(receive_updates_selector)
self.assertTrue(self.page.is_checkbox_selected(receive_updates_selector))
self.page.refresh_and_wait_for_load()
self.assertTrue(self.page.is_checkbox_selected(receive_updates_selector))
@attr('a11y') @attr('a11y')
def test_page_accessibility(self): def test_page_accessibility(self):
self.page.a11y_audit.config.set_rules({ self.page.a11y_audit.config.set_rules({
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
HtmlUtils.append(this.$('.forum-content').empty(), HtmlUtils.template(discussionHomeTemplate)({})); HtmlUtils.append(this.$('.forum-content').empty(), HtmlUtils.template(discussionHomeTemplate)({}));
this.$('.forum-nav-thread-list a').removeClass('is-active').find('.sr') this.$('.forum-nav-thread-list a').removeClass('is-active').find('.sr')
.remove(); .remove();
this.$('input.email-setting').bind('click', this.updateEmailNotifications); this.$('input.email-setting').bind('click', this.discussionThreadListView.updateEmailNotifications);
DiscussionUtil.safeAjax({ DiscussionUtil.safeAjax({
url: url, url: url,
type: 'GET', type: 'GET',
......
...@@ -168,6 +168,9 @@ FEATURES['ENABLE_COURSEWARE_SEARCH'] = True ...@@ -168,6 +168,9 @@ FEATURES['ENABLE_COURSEWARE_SEARCH'] = True
# Enable dashboard search for tests # Enable dashboard search for tests
FEATURES['ENABLE_DASHBOARD_SEARCH'] = True FEATURES['ENABLE_DASHBOARD_SEARCH'] = True
# discussion home panel, which includes a subscription on/off setting for discussion digest emails.
FEATURES['ENABLE_DISCUSSION_HOME_PANEL'] = True
# Enable support for OpenBadges accomplishments # Enable support for OpenBadges accomplishments
FEATURES['ENABLE_OPENBADGES'] = True FEATURES['ENABLE_OPENBADGES'] = True
......
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