MDL-54672 behat: Fix i_enrol_user_as() step in non-js sessions
During the recent reimplementation of the step (eb9ca848), we did not
notice that javascript variant uses the string `assignroles` while the
non-js variant uses string `assignrole`. This caused any "Given I enrol"
steps to fail in non-javascript sessions.
This commit is contained in:
@@ -86,9 +86,8 @@ class behat_enrol extends behat_base {
|
||||
|
||||
$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()) {
|
||||
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignroles', 'role'), $rolename));
|
||||
|
||||
// We have a div here, not a tr.
|
||||
$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'));
|
||||
|
||||
} 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::press_button", "add");
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user