MDL-59756 user: More Behat tests for the status field and friends
* Add coverage for the rendering of the edit/unenrol icons in the status column. * Add coverage for the rendering of the edit icon in the enrolment details modal. * Avoid usage of xpath_element selectors whenever possible.
This commit is contained in:
@@ -24,11 +24,11 @@ Feature: Edit user enrolment
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
When I click on "//a[@data-action='editenrolment']" "xpath_element" in the "student1" "table_row"
|
||||
When I click on "Edit enrolment" "icon" in the "student1" "table_row"
|
||||
And I should see "Edit Student 1's enrolment"
|
||||
And I set the field "Status" to "Suspended"
|
||||
And I click on "Save changes" "button"
|
||||
And I click on "//a[@data-action='editenrolment']" "xpath_element" in the "student2" "table_row"
|
||||
And I click on "Edit enrolment" "icon" in the "student2" "table_row"
|
||||
And I should see "Edit Student 2's enrolment"
|
||||
And I set the field "timeend[enabled]" to "1"
|
||||
And I set the field "timeend[day]" to "1"
|
||||
@@ -44,7 +44,7 @@ Feature: Edit user enrolment
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
When I click on "//a[@data-action='unenrol']" "xpath_element" in the "student1" "table_row"
|
||||
When I click on "Unenrol" "icon" in the "student1" "table_row"
|
||||
And I click on "Yes" "button"
|
||||
Then I should not see "Student 1" in the "participants" "table"
|
||||
|
||||
@@ -53,26 +53,72 @@ Feature: Edit user enrolment
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
When I click on "//a[@data-action='showdetails']" "xpath_element" in the "student1" "table_row"
|
||||
When I click on "Enrolment details" "icon" in the "student1" "table_row"
|
||||
Then I should see "Enrolment details"
|
||||
And I should see "Student 1" in the "Full name" "table_row"
|
||||
And I should see "Active" in the "//td[@class='user-enrol-status']" "xpath_element"
|
||||
And I should see "Manual enrolments" in the "Enrolment method" "table_row"
|
||||
And I press "Cancel"
|
||||
And I click on "//a[@data-action='showdetails']" "xpath_element" in the "student2" "table_row"
|
||||
And I click on "Enrolment details" "icon" in the "student2" "table_row"
|
||||
And I should see "Enrolment details"
|
||||
And I should see "Student 2" in the "Full name" "table_row"
|
||||
And I should see "Suspended" in the "//td[@class='user-enrol-status']" "xpath_element"
|
||||
And I should see "Manual enrolments" in the "Enrolment method" "table_row"
|
||||
And "Edit enrolment" "icon" should exist in the "Enrolment method" "table_row"
|
||||
|
||||
@javascript
|
||||
Scenario: View a student's enrolment details for a student enrolled via course meta link where editing can't be done
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student3 | Student | 3 | student3@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 2 | C2 | topics |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role | status |
|
||||
| student3 | C2 | student | 0 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Manage enrol plugins" node in "Site administration > Plugins > Enrolments"
|
||||
And I click on "Enable" "link" in the "Course meta link" "table_row"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add "Course meta link" enrolment method with:
|
||||
| Link course | C2 |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I navigate to course participants
|
||||
Then I should see "Student 3" in the "participants" "table"
|
||||
And "Edit enrolment" "icon" should not exist in the "student3" "table_row"
|
||||
And "Unenrol" "icon" should not exist in the "student3" "table_row"
|
||||
And I click on "Enrolment details" "icon" in the "student3" "table_row"
|
||||
And I should see "Enrolment details"
|
||||
And I should see "Student 3" in the "Full name" "table_row"
|
||||
And I should see "Active" in the "//td[@class='user-enrol-status']" "xpath_element"
|
||||
And I should see "Course meta link (Course 2)" in the "Enrolment method" "table_row"
|
||||
And "Edit enrolment" "icon" should not exist in the "Enrolment method" "table_row"
|
||||
|
||||
@javascript
|
||||
Scenario: Edit a student's enrolment details from the status dialogue
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
When I click on "Enrolment details" "icon" in the "student2" "table_row"
|
||||
And I click on "Edit enrolment" "icon" in the "Enrolment method" "table_row"
|
||||
And I should see "Edit Student 2's enrolment"
|
||||
And I set the field "Status" to "Active"
|
||||
And I click on "Save changes" "button"
|
||||
Then I should see "Active" in the "student2" "table_row"
|
||||
|
||||
# Without JS, the user should be redirected to the original edit enrolment form.
|
||||
Scenario: Edit a user's enrolment without JavaScript
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
When I click on "//a[@data-action='editenrolment']" "xpath_element" in the "student1" "table_row"
|
||||
When I click on "Edit enrolment" "link" in the "student1" "table_row"
|
||||
And I should see "Student 1"
|
||||
And I set the field "Status" to "Suspended"
|
||||
And I click on "Save changes" "button"
|
||||
And I click on "//a[@data-action='editenrolment']" "xpath_element" in the "student2" "table_row"
|
||||
And I click on "Edit enrolment" "link" in the "student2" "table_row"
|
||||
And I should see "Student 2"
|
||||
And I set the field "timeend[enabled]" to "1"
|
||||
And I set the field "timeend[day]" to "1"
|
||||
@@ -88,6 +134,6 @@ Feature: Edit user enrolment
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
When I click on "//a[@data-action='unenrol']" "xpath_element" in the "student1" "table_row"
|
||||
When I click on "Unenrol" "link" in the "student1" "table_row"
|
||||
And I click on "Continue" "button"
|
||||
Then I should not see "Student 1" in the "participants" "table"
|
||||
|
||||
Reference in New Issue
Block a user