Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@enrol @enrol_meta @javascript
2
Feature: 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 | C1C1 |
17
      | Course 2 | C2C2 |
18
      | Course 3 | C3C3 |
19
      | Course 4 | C4C4 |
20
    And the following "groups" exist:
21
      | name | course | idnumber |
22
      | Groupcourse 1 | C3C3 | G1 |
23
      | Groupcourse 2 | C3C3 | G2 |
24
    And the following "course enrolments" exist:
25
      | user | course | role | status |
26
      | student1 | C1C1 | student | 0 |
27
      | student2 | C1C1 | student | 0 |
28
      | student3 | C1C1 | student | 0 |
29
      | student4 | C1C1 | student | 0 |
30
      | student1 | C2C2 | student | 0 |
31
      | student2 | C2C2 | student | 0 |
32
      | student1 | C4C4 | student | 0 |
33
      | student2 | C4C4 | student | 1 |
34
    And the following config values are set as admin:
35
      | enableasyncbackup | 0 |
36
    And I log in as "admin"
37
    And I navigate to "Plugins > Enrolments > Manage enrol plugins" in site administration
38
    And I click on "Enable" "link" in the "Course meta link" "table_row"
39
    And I am on course index
40
 
41
  Scenario: Add meta enrolment instance without groups
42
    When I add "Course meta link" enrolment method in "Course 3" with:
43
      | Link course  | C1C1 |
44
    And I am on the "Course 3" "enrolled users" page
45
    Then I should see "No groups" in the "Student 1" "table_row"
46
    And I should see "No groups" in the "Student 4" "table_row"
47
 
48
  Scenario: Add meta enrolment instance with groups
49
    When I add "Course meta link" enrolment method in "Course 3" with:
50
      | Link course  | C1C1      |
51
      | Add to group | Groupcourse 1 |
52
    And I add "Course meta link" enrolment method in "Course 3" with:
53
      | Link course  | C2C2      |
54
      | Add to group | Groupcourse 2 |
55
    And I am on the "Course 3" "enrolled users" page
56
    Then I should see "Groupcourse 1" in the "Student 1" "table_row"
57
    And I should see "Groupcourse 1" in the "Student 2" "table_row"
58
    And I should see "Groupcourse 1" in the "Student 3" "table_row"
59
    And I should see "Groupcourse 1" in the "Student 4" "table_row"
60
    And I should see "Groupcourse 2" in the "Student 1" "table_row"
61
    And I should see "Groupcourse 2" in the "Student 2" "table_row"
62
    And I should not see "Groupcourse 2" in the "Student 3" "table_row"
63
    And I should not see "Groupcourse 2" in the "Student 4" "table_row"
64
 
65
  Scenario: Add meta enrolment instance with auto-created groups
66
    When I add "Course meta link" enrolment method in "Course 3" with:
67
      | Link course  | C1C1      |
68
      | Add to group | Create new group |
69
    And I am on the "Course 3" "enrolled users" page
70
    Then I should see "Course 1 course" in the "Student 1" "table_row"
71
    And I should see "Course 1 course" in the "Student 2" "table_row"
72
    And I should see "Course 1 course" in the "Student 3" "table_row"
73
    And I should see "Course 1 course" in the "Student 4" "table_row"
74
    And I am on the "Course 3" "groups" page
75
    And the "Groups" select box should contain "Course 1 course (4)"
76
 
77
  Scenario: Backup and restore of meta enrolment instance
78
    When I add "Course meta link" enrolment method in "Course 3" with:
79
      | Link course  | C1C1      |
80
      | Add to group | Groupcourse 1 |
81
    And I add "Course meta link" enrolment method in "Course 3" with:
82
      | Link course  | C2C2      |
83
    When I backup "Course 3" course using this options:
84
      | Confirmation | Filename | test_backup.mbz |
85
    And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
86
    And I press "Continue"
87
    And I set the field "targetid" to "1"
88
    And I click on "Continue" "button" in the ".bcs-new-course" "css_element"
89
    And I press "Next"
90
    And I set the field "Course name" to "Course 5"
91
    And I press "Next"
92
    And I press "Perform restore"
93
    And I trigger cron
94
    And I am on the "Course 5 copy 1" "enrolment methods" page
95
    Then I should see "Course meta link (Course 1)"
96
    And I should see "Course meta link (Course 2)"
97
    And I am on the "Course 5 copy 1" "enrolled users" page
98
    And I should see "Groupcourse 1" in the "Student 1" "table_row"
99
    And I should see "Groupcourse 1" in the "Student 2" "table_row"
100
    And I should see "Groupcourse 1" in the "Student 3" "table_row"
101
    And I should see "Groupcourse 1" in the "Student 4" "table_row"
102
    And I click on "[data-enrolinstancename='Course meta link (Course 2)'] a[data-action=showdetails]" "css_element" in the "Student 1" "table_row"
103
    And I should see "Course meta link (Course 2)" in the "Enrolment method" "table_row"
104
 
105
  Scenario: Unenrol a user from the course participants page that was enrolled via course meta link.
106
    Given I add "Course meta link" enrolment method in "Course 3" with:
107
      | Link course  | C4C4 |
108
    And I navigate to course participants
109
    # Suspended users can be unenrolled.
110
    When I click on "//a[@data-action='unenrol']" "xpath_element" in the "student2" "table_row"
111
    And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
112
    Then I should not see "Student 2" in the "participants" "table"