source: moodle/trunk/fuentes/enrol/meta/tests/behat/enrol_meta.feature

Last change on this file was 1331, checked in by jrpelegrina, 3 years ago

Updated to moodle 3.0.3

File size: 5.5 KB
Line 
1@enrol @enrol_meta
2Feature: Enrolments are synchronised with meta courses
3  In order to simplify enrolments in parent courses
4  As a teacher
5  I need to be able to set up meta enrolments
6
7  Background:
8    Given the following "users" exist:
9      | username | firstname | lastname | email |
10      | student1 | Student | 1 | student1@asd.com |
11      | student2 | Student | 2 | student2@asd.com |
12      | student3 | Student | 3 | student3@asd.com |
13      | student4 | Student | 4 | student4@asd.com |
14    And the following "courses" exist:
15      | fullname | shortname |
16      | Course 1 | C1 |
17      | Course 2 | C2 |
18      | Course 3 | C3 |
19    And the following "groups" exist:
20      | name | course | idnumber |
21      | Groupcourse 1 | C3 | G1 |
22      | Groupcourse 2 | C3 | G2 |
23    And the following "course enrolments" exist:
24      | user | course | role |
25      | student1 | C1 | student |
26      | student2 | C1 | student |
27      | student3 | C1 | student |
28      | student4 | C1 | student |
29      | student1 | C2 | student |
30      | student2 | C2 | student |
31    And I log in as "admin"
32    And I navigate to "Manage enrol plugins" node in "Site administration > Plugins > Enrolments"
33    And I click on "Enable" "link" in the "Course meta link" "table_row"
34    And I am on homepage
35    And I follow "Courses"
36
37  Scenario: Add meta enrolment instance without groups
38    When I follow "Course 3"
39    And I add "Course meta link" enrolment method with:
40      | Link course  | Course 1 |
41    And I navigate to "Enrolled users" node in "Course administration > Users"
42    Then I should see "Student 1"
43    And I should see "Student 4"
44    And I should not see "Groupcourse" in the "table.userenrolment" "css_element"
45
46  Scenario: Add meta enrolment instance with groups
47    When I follow "Course 3"
48    And I navigate to "Enrolment methods" node in "Course administration > Users"
49    And I set the field "Add method" to "Course meta link"
50    And I press "Go"
51    And I set the following fields to these values:
52      | Link course  | Course 1      |
53      | Add to group | Groupcourse 1 |
54    And I press "Add method and create another"
55    And I set the following fields to these values:
56      | Link course  | Course 2      |
57      | Add to group | Groupcourse 2 |
58    And I press "Add method"
59    And I navigate to "Enrolled users" node in "Course administration > Users"
60    Then I should see "Groupcourse 1" in the "Student 1" "table_row"
61    And I should see "Groupcourse 1" in the "Student 2" "table_row"
62    And I should see "Groupcourse 1" in the "Student 3" "table_row"
63    And I should see "Groupcourse 1" in the "Student 4" "table_row"
64    And I should see "Groupcourse 2" in the "Student 1" "table_row"
65    And I should see "Groupcourse 2" in the "Student 2" "table_row"
66    And I should not see "Groupcourse 2" in the "Student 3" "table_row"
67    And I should not see "Groupcourse 2" in the "Student 4" "table_row"
68
69  Scenario: Add meta enrolment instance with auto-created groups
70    When I follow "Course 3"
71    And I navigate to "Enrolment methods" node in "Course administration > Users"
72    And I set the field "Add method" to "Course meta link"
73    And I press "Go"
74    And I set the following fields to these values:
75      | Link course  | Course 1      |
76      | Add to group | Create new group |
77    And I press "Add method"
78    And I navigate to "Enrolled users" node in "Course administration > Users"
79    Then I should see "Course 1 course" in the "Student 1" "table_row"
80    And I should see "Course 1 course" in the "Student 2" "table_row"
81    And I should see "Course 1 course" in the "Student 3" "table_row"
82    And I should see "Course 1 course" in the "Student 4" "table_row"
83    And I navigate to "Groups" node in "Course administration > Users"
84    And the "Groups" select box should contain "Course 1 course (4)"
85
86  Scenario: Backup and restore of meta enrolment instance
87    When I follow "Course 3"
88    And I navigate to "Enrolment methods" node in "Course administration > Users"
89    And I set the field "Add method" to "Course meta link"
90    And I press "Go"
91    And I set the following fields to these values:
92      | Link course  | Course 1      |
93      | Add to group | Groupcourse 1 |
94    And I press "Add method and create another"
95    And I set the following fields to these values:
96      | Link course  | Course 2      |
97    And I press "Add method"
98    When I backup "Course 3" course using this options:
99      | Confirmation | Filename | test_backup.mbz |
100    And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
101    And I press "Continue"
102    And I set the field "targetid" to "1"
103    And I click on "Continue" "button" in the ".bcs-new-course" "css_element"
104    And I press "Next"
105    And I set the field "Course name" to "Course 4"
106    And I press "Next"
107    And I press "Perform restore"
108    And I trigger cron
109    And I am on homepage
110    And I follow "Courses"
111    And I follow "Course 4"
112    And I navigate to "Enrolment methods" node in "Course administration > Users"
113    Then I should see "Course meta link (Course 1)"
114    And I should see "Course meta link (Course 2)"
115    And I navigate to "Enrolled users" node in "Course administration > Users"
116    And I should see "Groupcourse 1" in the "Student 1" "table_row"
117    And I should see "Groupcourse 1" in the "Student 2" "table_row"
118    And I should see "Groupcourse 1" in the "Student 3" "table_row"
119    And I should see "Groupcourse 1" in the "Student 4" "table_row"
120    And I should see "Course 2" in the "Student 1" "table_row"
121    And I should not see "Course 2" in the "Student 3" "table_row"
Note: See TracBrowser for help on using the repository browser.