Commit 79c5137a by cahrens

Bok choy tests for division scheme.

EDUCATOR-424
parent c23c0b99
......@@ -263,10 +263,6 @@ class CohortManagementSection(PageObject):
no_content_group_button_css = '.cohort-management-details-association-course input.radio-no'
select_content_group_button_css = '.cohort-management-details-association-course input.radio-yes'
assignment_type_buttons_css = '.cohort-management-assignment-type-settings input'
discussion_form_selectors = {
'course-wide': '.cohort-course-wide-discussions-form',
'inline': '.cohort-inline-discussions-form'
}
def get_cohort_help_element_and_click_help(self):
"""
......@@ -689,9 +685,14 @@ class DiscussionManagementSection(PageObject):
discussion_form_selectors = {
'course-wide': '.cohort-course-wide-discussions-form',
'inline': '.cohort-inline-discussions-form'
'inline': '.cohort-inline-discussions-form',
'scheme': '.division-scheme-container',
}
NOT_DIVIDED_SCHEME = "none"
COHORT_SCHEME = "cohort"
ENROLLMENT_TRACK_SCHEME = "enrollment_track"
def is_browser_on_page(self):
return self.q(css=self.discussion_form_selectors['course-wide']).present
......@@ -801,6 +802,25 @@ class DiscussionManagementSection(PageObject):
"""
return self.q(css=self._bounded_selector('.check-discussion-category:checked')).is_present()
def get_selected_scheme(self):
"""
Returns the ID of the selected discussion division scheme
("NOT_DIVIDED_SCHEME", "COHORT_SCHEME", or "ENROLLMENT_TRACK_SCHEME)".
"""
return self.q(css=self._bounded_selector('.division-scheme:checked')).first.attrs('id')[0]
def select_division_scheme(self, scheme):
"""
Selects the radio button associated with the specified division scheme.
"""
self.q(css=self._bounded_selector("input#%s" % scheme)).first.click()
def division_scheme_visible(self, scheme):
"""
Returns whether or not the specified scheme is visible as an option.
"""
return self.q(css=self._bounded_selector("input#%s" % scheme)).visible
class MembershipPageAutoEnrollSection(PageObject):
"""
......
......@@ -76,22 +76,26 @@ class CohortTestMixin(object):
def enable_cohorting(self, course_fixture):
"""
enables cohorts and always_divide_inline_discussions for the current course fixture.
Enables cohorting for the specified course fixture.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings' # pylint: disable=protected-access
discussions_url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/discussions/settings' # pylint: disable=protected-access
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings'
data = json.dumps({'is_cohorted': True})
discussions_data = json.dumps({'always_divide_inline_discussions': True})
response = course_fixture.session.patch(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to enable cohorts")
def enable_always_divide_inline_discussions(self, course_fixture):
"""
Enables "always_divide_inline_discussions" (but does not enabling cohorting).
"""
discussions_url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/discussions/settings'
discussions_data = json.dumps({'always_divide_inline_discussions': True})
course_fixture.session.patch(discussions_url, data=discussions_data, headers=course_fixture.headers)
def disable_cohorting(self, course_fixture):
"""
Disables cohorting for the current course fixture.
Disables cohorting for the specified course fixture.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings' # pylint: disable=protected-access
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings'
data = json.dumps({'is_cohorted': False})
response = course_fixture.session.patch(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to disable cohorts")
......
......@@ -47,6 +47,7 @@ class CohortedDiscussionTestMixin(BaseDiscussionMixin, CohortTestMixin):
# Enable cohorts and verify that the post shows to cohort only.
self.enable_cohorting(self.course_fixture)
self.enable_always_divide_inline_discussions(self.course_fixture)
self.refresh_thread_page(self.thread_id)
self.assertEquals(
self.thread_page.get_group_visibility_label(),
......
......@@ -7,7 +7,6 @@ import uuid
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures import LMS_BASE_URL
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.common.logout import LogoutPage
......@@ -19,10 +18,11 @@ from common.test.acceptance.pages.studio.overview import CourseOutlinePage as St
from common.test.acceptance.pages.studio.settings_group_configurations import GroupConfigurationsPage
from common.test.acceptance.tests.helpers import remove_file
from common.test.acceptance.tests.studio.base_studio_test import ContainerBase
from common.test.acceptance.tests.discussion.helpers import CohortTestMixin
@attr(shard=1)
class CoursewareSearchCohortTest(ContainerBase):
class CoursewareSearchCohortTest(ContainerBase, CohortTestMixin):
"""
Test courseware search.
"""
......@@ -132,15 +132,6 @@ class CoursewareSearchCohortTest(ContainerBase):
)
)
def enable_cohorting(self, course_fixture):
"""
Enables cohorting for the current course.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings' # pylint: disable=protected-access
data = json.dumps({'is_cohorted': True})
response = course_fixture.session.patch(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to enable cohorts")
def create_content_groups(self):
"""
Creates two content groups in Studio Group Configurations Settings.
......
......@@ -10,9 +10,10 @@ from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDash
from common.test.acceptance.tests.helpers import assert_opened_help_link_is_correct, url_for_help
from common.test.acceptance.tests.lms.test_lms_instructor_dashboard import BaseInstructorDashboardTest
from common.test.acceptance.tests.studio.base_studio_test import ContainerBase
from common.test.acceptance.tests.discussion.helpers import CohortTestMixin
class TestCohortHelp(ContainerBase):
class TestCohortHelp(ContainerBase, CohortTestMixin):
"""
Tests help links in Cohort page
"""
......@@ -74,15 +75,6 @@ class TestCohortHelp(ContainerBase):
)
self.verify_help_link(href)
def enable_cohorting(self, course_fixture):
"""
Enables cohorting for the current course.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings' # pylint: disable=protected-access
data = json.dumps({'is_cohorted': True})
response = course_fixture.session.patch(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to enable cohorts")
class InstructorDashboardHelp(BaseInstructorDashboardTest):
"""
......
......@@ -7,7 +7,6 @@ import json
from bok_choy.page_object import XSS_INJECTION
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures import LMS_BASE_URL
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.common.utils import add_enrollment_course_modes, enroll_user_track
......@@ -16,6 +15,7 @@ from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDash
from common.test.acceptance.pages.studio.component_editor import ComponentVisibilityEditorView
from common.test.acceptance.pages.studio.settings_group_configurations import GroupConfigurationsPage
from common.test.acceptance.tests.lms.test_lms_user_preview import verify_expected_problem_visibility
from common.test.acceptance.tests.discussion.helpers import CohortTestMixin
from studio.base_studio_test import ContainerBase
AUDIT_TRACK = "Audit"
......@@ -23,7 +23,7 @@ VERIFIED_TRACK = "Verified"
@attr(shard=5)
class EndToEndCohortedCoursewareTest(ContainerBase):
class EndToEndCohortedCoursewareTest(ContainerBase, CohortTestMixin):
"""
End-to-end of cohorted courseware.
"""
......@@ -113,15 +113,6 @@ class EndToEndCohortedCoursewareTest(ContainerBase):
)
)
def enable_cohorting(self, course_fixture):
"""
Enables cohorting for the current course.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/settings' # pylint: disable=protected-access
data = json.dumps({'is_cohorted': True})
response = course_fixture.session.patch(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to enable cohorts")
def create_content_groups(self):
"""
Creates two content groups in Studio Group Configurations Settings.
......
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