BLD 1020: Easy access to Group Configurations page from Content Experiment component.
This commit is contained in:
@@ -56,6 +56,13 @@ class GroupConfiguration(object):
|
||||
"""
|
||||
self.find_css('a.group-toggle').first.click()
|
||||
|
||||
@property
|
||||
def is_expanded(self):
|
||||
"""
|
||||
Group configuration usage information is expanded.
|
||||
"""
|
||||
return self.find_css('a.group-toggle.hide-groups').present
|
||||
|
||||
def add_group(self):
|
||||
"""
|
||||
Add new group.
|
||||
|
||||
@@ -179,3 +179,16 @@ class Component(PageObject):
|
||||
Click on settings Save button.
|
||||
"""
|
||||
self._click_button('save_settings')
|
||||
|
||||
def go_to_group_configuration_page(self):
|
||||
"""
|
||||
Go to the Group Configuration used by the component.
|
||||
"""
|
||||
self.q(css=self._bounded_selector('span.message-text a')).first.click()
|
||||
|
||||
@property
|
||||
def group_configuration_link_name(self):
|
||||
"""
|
||||
Get Group Configuration name from link.
|
||||
"""
|
||||
return self.q(css=self._bounded_selector('span.message-text a')).first.text[0]
|
||||
|
||||
@@ -713,7 +713,6 @@ class GroupConfigurationsTest(ContainerBase, SplitTestMixin):
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
vertical = self.course_fixture.get_nested_xblocks(category="vertical")[0]
|
||||
self.course_fixture.create_xblock(
|
||||
vertical.locator,
|
||||
@@ -729,3 +728,50 @@ class GroupConfigurationsTest(ContainerBase, SplitTestMixin):
|
||||
config.edit()
|
||||
self.assertTrue(config.delete_button_is_disabled)
|
||||
self.assertIn('Cannot delete when in use by an experiment', config.delete_note)
|
||||
|
||||
def test_easy_access_from_experiment(self):
|
||||
"""
|
||||
Scenario: When a Content Experiment uses a Group Configuration,
|
||||
ensure that the link to that Group Configuration works correctly.
|
||||
|
||||
Given I have a course with two Group Configurations
|
||||
And Content Experiment is assigned to one Group Configuration
|
||||
Then I see a link to Group Configuration
|
||||
When I click on the Group Configuration link
|
||||
Then I see the Group Configurations page
|
||||
And I see that appropriate Group Configuration is expanded.
|
||||
"""
|
||||
# Create a new group configurations
|
||||
self.course_fixture._update_xblock(self.course_fixture._course_location, {
|
||||
"metadata": {
|
||||
u"user_partitions": [
|
||||
UserPartition(0, "Name", "Description.", [Group("0", "Group A"), Group("1", "Group B")]).to_json(),
|
||||
UserPartition(1, 'Name of second Group Configuration', 'Second group configuration.', [Group("0", 'Alpha'), Group("1", 'Beta'), Group("2", 'Gamma')]).to_json(),
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
# Assign newly created group configuration to unit
|
||||
vertical = self.course_fixture.get_nested_xblocks(category="vertical")[0]
|
||||
self.course_fixture.create_xblock(
|
||||
vertical.locator,
|
||||
XBlockFixtureDesc('split_test', 'Test Content Experiment', metadata={'user_partition_id': 1})
|
||||
)
|
||||
|
||||
unit = UnitPage(self.browser, vertical.locator)
|
||||
unit.visit()
|
||||
experiment = unit.components[0]
|
||||
|
||||
group_configuration_link_name = experiment.group_configuration_link_name
|
||||
|
||||
experiment.go_to_group_configuration_page()
|
||||
self.page.wait_for_page()
|
||||
|
||||
# Appropriate Group Configuration is expanded.
|
||||
self.assertFalse(self.page.group_configurations[0].is_expanded)
|
||||
self.assertTrue(self.page.group_configurations[1].is_expanded)
|
||||
|
||||
self.assertEqual(
|
||||
group_configuration_link_name,
|
||||
self.page.group_configurations[1].name
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user