Skip to content

Commit

Permalink
Merge branch 'MDL-50055-master' of git://github.com/andrewnicols/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed May 5, 2015
2 parents 9f3adc9 + e8cf633 commit 96ec51b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 17 deletions.
2 changes: 0 additions & 2 deletions enrol/guest/tests/behat/guest_access.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
| Description | Test forum description |
And I click on "Edit settings" "link" in the "Administration" "block"

@javascript
Scenario: Allow guest access without password
Given I set the following fields to these values:
| Allow guest access | Yes |
Expand All @@ -35,7 +34,6 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
When I follow "Test forum name"
Then I should not see "Subscribe to this forum"

@javascript
Scenario: Allow guest access with password
Given I set the following fields to these values:
| Allow guest access | Yes |
Expand Down
10 changes: 3 additions & 7 deletions enrol/meta/tests/behat/enrol_meta.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Feature: Enrolments are synchronised with meta courses
And I am on homepage
And I follow "Courses"

@javascript
Scenario: Add meta enrolment instance without groups
When I follow "Course 3"
And I add "Course meta link" enrolment method with:
Expand All @@ -44,12 +43,11 @@ Feature: Enrolments are synchronised with meta courses
And I should see "Student 4"
And I should not see "Groupcourse" in the "table.userenrolment" "css_element"

@javascript
Scenario: Add meta enrolment instance with groups
When I follow "Course 3"
And I navigate to "Enrolment methods" node in "Course administration > Users"
And I set the field "Add method" to "Course meta link"
And I wait to be redirected
And I press "Go"
And I set the following fields to these values:
| Link course | Course 1 |
| Add to group | Groupcourse 1 |
Expand All @@ -68,12 +66,11 @@ Feature: Enrolments are synchronised with meta courses
And I should not see "Groupcourse 2" in the "Student 3" "table_row"
And I should not see "Groupcourse 2" in the "Student 4" "table_row"

@javascript
Scenario: Add meta enrolment instance with auto-created groups
When I follow "Course 3"
And I navigate to "Enrolment methods" node in "Course administration > Users"
And I set the field "Add method" to "Course meta link"
And I wait to be redirected
And I press "Go"
And I set the following fields to these values:
| Link course | Course 1 |
| Add to group | Create new group |
Expand All @@ -86,12 +83,11 @@ Feature: Enrolments are synchronised with meta courses
And I navigate to "Groups" node in "Course administration > Users"
And the "Groups" select box should contain "Course 1 course (4)"

@javascript
Scenario: Backup and restore of meta enrolment instance
When I follow "Course 3"
And I navigate to "Enrolment methods" node in "Course administration > Users"
And I set the field "Add method" to "Course meta link"
And I wait to be redirected
And I press "Go"
And I set the following fields to these values:
| Link course | Course 1 |
| Add to group | Groupcourse 1 |
Expand Down
8 changes: 3 additions & 5 deletions enrol/self/tests/behat/self_enrolment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
| user | course | role |
| teacher1 | C1 | editingteacher |

# Note: Please keep the javascript tag on this Scenario to ensure that we
# test use of the singleselect functionality.
@javascript
Scenario: Self-enrolment enabled as guest
Given I log in as "teacher1"
Expand All @@ -29,7 +31,6 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I press "Continue"
And I should see "Log in"

@javascript
Scenario: Self-enrolment enabled
Given I log in as "teacher1"
And I follow "Course 1"
Expand All @@ -43,7 +44,6 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
Then I should see "Topic 1"
And I should not see "Enrolment options"

@javascript
Scenario: Self-enrolment enabled requiring an enrolment key
Given I log in as "teacher1"
And I follow "Course 1"
Expand All @@ -61,14 +61,12 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I should not see "Enrolment options"
And I should not see "Enrol me in this course"

@javascript
Scenario: Self-enrolment disabled
Given I log in as "student1"
And I am on site homepage
When I follow "Course 1"
Then I should see "You can not enrol yourself in this course"

@javascript
Scenario: Self-enrolment enabled requiring a group enrolment key
Given I log in as "teacher1"
And I follow "Course 1"
Expand All @@ -91,4 +89,4 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I press "Enrol me"
Then I should see "Topic 1"
And I should not see "Enrolment options"
And I should not see "Enrol me in this course"
And I should not see "Enrol me in this course"
6 changes: 3 additions & 3 deletions enrol/tests/behat/behat_enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class behat_enrol extends behat_base {
* @param TableNode $table
*/
public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {

return array(
new Given('I expand "' . get_string('users', 'admin') . '" node'),
new Given('I follow "' . get_string('type_enrol_plural', 'plugin') . '"'),
new Given('I set the field "' . get_string('addinstance', 'enrol') . '" to "' . $this->escape($enrolmethod) . '"'),
new Given('I select "' . $this->escape($enrolmethod) . '" from the "' .
get_string('addinstance', 'enrol') . '" singleselect'),
new Given('I set the following fields to these values:', $table),
new Given('I press "' . get_string('addinstance', 'enrol') . '"')
new Given('I press "' . get_string('addinstance', 'enrol') . '"'),
);
}

Expand Down
17 changes: 17 additions & 0 deletions lib/tests/behat/behat_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,21 @@ protected function set_field_value($fieldlocator, $value) {
$field->set_value($value);
}

/**
* Select a value from single select and redirect.
*
* @Given /^I select "(?P<singleselect_option_string>(?:[^"]|\\")*)" from the "(?P<singleselect_name_string>(?:[^"]|\\")*)" singleselect$/
*/
public function i_select_from_the_singleselect($option, $singleselect) {
$actions = array(
new Given('I set the field "' . $this->escape($singleselect) . '" to "' . $this->escape($option) . '"'),
);

if (!$this->running_javascript()) {
$actions[] = new Given('I press "' . get_string('go') . '"');
}

return $actions;
}

}

0 comments on commit 96ec51b

Please sign in to comment.