'Scenario: Ensure that the group configuration can be created and edited correctly.
Given I have a course without group configurations
When I click button \'Create new Group Configuration\'
And I set new name and description, change name for the 2nd default group, add one new group
And I click button \'Create\'
Then I see the new group configuration is added and has correct data
When I edit the group group_configuration
And I change the name and description, add new group, remove old one and change name for the Group A
And I click button \'Save\'
Then I see the group configuration is saved successfully and has the new data'

def test_can_create_and_edit_group_configuration(self):

    self.page.visit()
    self.assertEqual(len(self.page.experiment_group_configurations), 0)
    self.page.create_experiment_group_configuration()
    config = self.page.experiment_group_configurations[0]
    config.name = 'New    Group    Configuration    Name'
    config.description = 'New    Description    of    the    group    configuration.'
    config.groups[1].name = 'New    Group    Name'
    config.add_group()
    self.assertEqual(config.get_text('.action-primary'), 'Create')
    self.assertFalse(config.delete_button_is_present)
    config.save()
    self._assert_fields(config, name='New    Group    Configuration    Name', description='New    Description    of    the    group    configuration.', groups=['Group    A', 'New    Group    Name', 'Group    C'])
    config.edit()
    self.assertTrue(config.id)
    config.name = 'Second    Group    Configuration    Name'
    config.description = 'Second    Description    of    the    group    configuration.'
    self.assertEqual(config.get_text('.action-primary'), 'Save')
    config.add_group()
    config.groups[1].remove()
    config.groups[0].name = 'First    Group'
    config.save()
    self._assert_fields(config, name='Second    Group    Configuration    Name', description='Second    Description    of    the    group    configuration.', groups=['First    Group', 'Group    C', 'Group    D'])
