MDL-38619 behat: New test

According to MDLQA-1445, an administrator
can upload users to a cohort.
This commit is contained in:
David Monllao
2013-03-28 11:17:33 +08:00
parent f0e4cf5e31
commit ba097b8253
2 changed files with 60 additions and 0 deletions
@@ -0,0 +1,55 @@
@admin @cohorts
Feature: Upload users to a cohort
In order to quickly fill site-wide groups with users
As a moodle admin
I need to upload a file with users data containing cohort assigns
@javascript
Scenario: Upload users and assign them to a course with cohort enrolment method enabled
Given the following "cohorts" exists:
| name | idnumber |
| Cohort 1 | ASD |
| Cohort 2 | DSA |
And the following "courses" exists:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
And I log in as "admin"
And I follow "Course 1"
And I add "Cohort sync" enrolment method with:
| Cohort | Cohort 1 |
And I am on homepage
And I follow "Course 2"
And I add "Cohort sync" enrolment method with:
| Cohort | Cohort 2 |
And I expand "Course administration" node
And I expand "Site administration" node
And I expand "Users" node
And I expand "Accounts" node
When I follow "Upload users"
And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filepicker
And I press "Upload users"
And I press "Upload users"
And I press "Continue"
And I follow "Cohorts"
And I click on "Assign" "link" in the "//table[@id='cohorts']//tr[contains(., 'Cohort 1')]" "xpath_element"
Then the "Current users" select box should contain "Tom Jones (tomjones@example.com)"
And the "Current users" select box should contain "Bob Jones (bobjones@example.com)"
And I press "Back to cohorts"
And I click on "Assign" "link" in the "//table[@id='cohorts']//tr[contains(., 'Cohort 2')]" "xpath_element"
And the "Current users" select box should contain "Mary Smith (marysmith@example.com)"
And the "Current users" select box should contain "Alice Smith (alicesmith@example.com)"
And I am on homepage
And I follow "Course 1"
And I expand "Users" node
And I follow "Enrolled users"
And I should see "Tom Jones"
And I should see "Bob Jones"
And I should not see "Mary Smith"
And I am on homepage
And I follow "Course 2"
And I expand "Users" node
And I follow "Enrolled users"
And I should see "Mary Smith"
And I should see "Alice Smith"
And I should not see "Tom Jones"
+5
View File
@@ -0,0 +1,5 @@
username,password,firstname,lastname,email,cohort1
tomjones,Pass1234*,Tom,Jones,[email protected],ASD
marysmith,Pass1234*,Mary,Smith,[email protected],DSA
bobjones,Pass1234*,Bob,Jones,[email protected],ASD
alicesmith,Pass1234*,Alice,Smith,[email protected],DSA
1 username password firstname lastname email cohort1
2 tomjones Pass1234* Tom Jones [email protected] ASD
3 marysmith Pass1234* Mary Smith [email protected] DSA
4 bobjones Pass1234* Bob Jones [email protected] ASD
5 alicesmith Pass1234* Alice Smith [email protected] DSA