MDL-49963 behat: fixed scenario and step definition

1. Participants are sorted by last access and they could
   be different on different db's. So sort them by last name
   before checking.
2. Use Give-When-Then steps.
This commit is contained in:
Rajesh Taneja 2016-03-22 13:46:13 +08:00
parent 55e90f2270
commit a8d9cb87ba

View File

@ -56,149 +56,150 @@ Feature: View course participants
@javascript
Scenario: Use select and deselect all buttons
When I log in as "teacher1"
Given I log in as "teacher1"
And I follow "Course 1"
And I follow "Participants"
And I press "Select all"
When I press "Select all"
Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
And I press "Deselect all"
Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
@javascript
Scenario: Use select all users on this page, select all n users and deselect all
And the following "course enrolments" exist:
Given the following "course enrolments" exist:
| user | course | role |
| student20 | C1 | student |
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Participants"
And I follow "Surname"
And I press "Select all users on this page"
Then I should not see "Student 11"
Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
Then I should not see "Student 9"
And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
And I press "Deselect all"
Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
And I press "Select all 21 users"
Then I should see "Student 11"
Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
Then the field with xpath "//tbody//tr[21]//input[@class='usercheckbox']" matches value "1"
And I should see "Student 9"
And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
And the field with xpath "//tbody//tr[21]//input[@class='usercheckbox']" matches value "1"
And I press "Deselect all"
Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
Then the field with xpath "//tbody//tr[21]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
And the field with xpath "//tbody//tr[21]//input[@class='usercheckbox']" matches value "0"