TNL-6017 Receive Updates checkbox saved in discussion forums.
This commit is contained in:
@@ -688,6 +688,26 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin):
|
||||
"waiting for server to return result"
|
||||
).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):
|
||||
return self.q(css=self.ALERT_SELECTOR + " .message").text
|
||||
|
||||
@@ -720,6 +740,13 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin):
|
||||
"New post action succeeded"
|
||||
).fulfill()
|
||||
|
||||
def click_element(self, selector):
|
||||
"""
|
||||
Clicks the element specified by selector
|
||||
"""
|
||||
element = self.q(css=selector)
|
||||
return element.click()
|
||||
|
||||
@property
|
||||
def new_post_button(self):
|
||||
"""
|
||||
|
||||
@@ -206,6 +206,25 @@ class DiscussionHomePageTest(BaseDiscussionTestCase):
|
||||
self.page.click_new_post_button()
|
||||
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')
|
||||
def test_page_accessibility(self):
|
||||
self.page.a11y_audit.config.set_rules({
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
HtmlUtils.append(this.$('.forum-content').empty(), HtmlUtils.template(discussionHomeTemplate)({}));
|
||||
this.$('.forum-nav-thread-list a').removeClass('is-active').find('.sr')
|
||||
.remove();
|
||||
this.$('input.email-setting').bind('click', this.updateEmailNotifications);
|
||||
this.$('input.email-setting').bind('click', this.discussionThreadListView.updateEmailNotifications);
|
||||
DiscussionUtil.safeAjax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
|
||||
@@ -168,6 +168,9 @@ FEATURES['ENABLE_COURSEWARE_SEARCH'] = True
|
||||
# Enable dashboard search for tests
|
||||
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
|
||||
FEATURES['ENABLE_OPENBADGES'] = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user