Merge branch 'MDL-54672-master-given-i-enrol' of git://github.com/mudrd8mz/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-05-21 12:26:01 +02:00
commit 446e0299b9
2 changed files with 29 additions and 2 deletions

View file

@ -86,9 +86,8 @@ class behat_enrol extends behat_base {
$this->execute("behat_forms::press_button", get_string('enrolusers', 'enrol')); $this->execute("behat_forms::press_button", get_string('enrolusers', 'enrol'));
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignroles', 'role'), $rolename));
if ($this->running_javascript()) { if ($this->running_javascript()) {
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignroles', 'role'), $rolename));
// We have a div here, not a tr. // We have a div here, not a tr.
$userliteral = behat_context_helper::escape($userfullname); $userliteral = behat_context_helper::escape($userfullname);
@ -100,6 +99,7 @@ class behat_enrol extends behat_base {
$this->execute("behat_forms::press_button", get_string('finishenrollingusers', 'enrol')); $this->execute("behat_forms::press_button", get_string('finishenrollingusers', 'enrol'));
} else { } else {
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignrole', 'role'), $rolename));
$this->execute('behat_forms::i_set_the_field_to', array("addselect", $userfullname)); $this->execute('behat_forms::i_set_the_field_to', array("addselect", $userfullname));
$this->execute("behat_forms::press_button", "add"); $this->execute("behat_forms::press_button", "add");
} }

View file

@ -0,0 +1,27 @@
@enrol
Feature: User can be enrolled into a course
In order to let them participate in course activities
As an admin
I must be able to enrol users
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Studie | One | student1@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course 001 | C001 |
And I log in as "admin"
And I follow "Courses"
And I follow "Course 001"
Scenario: User can be enrolled without javascript
When I enrol "Studie One" user as "Student"
And I navigate to "Enrolled users" node in "Course administration > Users"
Then I should see "Studie One"
@javascript
Scenario: User can be enrolled with javascript enrol element
When I enrol "Studie One" user as "Student"
And I navigate to "Enrolled users" node in "Course administration > Users"
Then I should see "Studie One"