1 |
efrain |
1 |
@core @core_course @javascript
|
|
|
2 |
Feature: Users can request and approve courses
|
|
|
3 |
As a moodle admin
|
|
|
4 |
In order to improve course creation process
|
|
|
5 |
I need to be able to enable course approval
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| user1 | User | 1 | user1@example.com |
|
|
|
11 |
| user2 | User | 2 | user2@example.com |
|
|
|
12 |
| user3 | User | 3 | user3@example.com |
|
|
|
13 |
|
|
|
14 |
Scenario: Simple course request workflow
|
|
|
15 |
Given the following "system role assigns" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| user2 | Acceptance test site | manager |
|
|
|
18 |
And the following config values are set as admin:
|
|
|
19 |
| lockrequestcategory | 1 |
|
|
|
20 |
And the following "role capability" exists:
|
|
|
21 |
| role | user |
|
|
|
22 |
| moodle/course:request | allow |
|
|
|
23 |
When I log in as "user1"
|
|
|
24 |
And I am on course index
|
|
|
25 |
And I click on "More actions" "button"
|
|
|
26 |
And I click on "Request a course" "link"
|
|
|
27 |
And I set the following fields to these values:
|
|
|
28 |
| Course full name | My new course |
|
|
|
29 |
| Course short name | Mynewcourse |
|
|
|
30 |
| Supporting information | pretty please |
|
|
|
31 |
And I press "Request a course"
|
|
|
32 |
And I should see "Course request submitted."
|
|
|
33 |
And I press "Continue"
|
|
|
34 |
And I am on course index
|
|
|
35 |
And I should not see "My new course"
|
|
|
36 |
And I log out
|
|
|
37 |
And I log in as "user2"
|
|
|
38 |
And I am on course index
|
|
|
39 |
And I click on "More actions" "button"
|
|
|
40 |
And I click on "Courses pending approval" "link"
|
|
|
41 |
And the following should exist in the "pendingcourserequests" table:
|
|
|
42 |
| Requested by | Course short name | Course full name | Category | Reason for course request |
|
|
|
43 |
| User 1 | Mynewcourse | My new course | Category 1 | pretty please |
|
|
|
44 |
And I click on "Approve" "button" in the "My new course" "table_row"
|
|
|
45 |
And I press "Save and return"
|
|
|
46 |
And I should see "There are no courses pending approval"
|
|
|
47 |
And I press "Back to course listing"
|
|
|
48 |
And I should see "My new course"
|
|
|
49 |
And I log out
|
|
|
50 |
And I log in as "user1"
|
|
|
51 |
And I am on course index
|
|
|
52 |
And I follow "My new course"
|
|
|
53 |
And I navigate to course participants
|
|
|
54 |
And I should see "Teacher" in the "User 1" "table_row"
|
|
|
55 |
And I log out
|
|
|
56 |
|
|
|
57 |
Scenario: Course request with category selection
|
|
|
58 |
Given the following "categories" exist:
|
|
|
59 |
| name | category | idnumber |
|
|
|
60 |
| Science category | 0 | SCI |
|
|
|
61 |
| English category | 0 | ENG |
|
|
|
62 |
| Other category | 0 | MISC |
|
|
|
63 |
Given the following "roles" exist:
|
|
|
64 |
| name | shortname | description | archetype |
|
|
|
65 |
| Course requestor | courserequestor | My custom role 1 | |
|
|
|
66 |
And the following "role assigns" exist:
|
|
|
67 |
| user | role | contextlevel | reference |
|
|
|
68 |
| user1 | courserequestor | Category | SCI |
|
|
|
69 |
| user1 | courserequestor | Category | ENG |
|
|
|
70 |
| user2 | manager | Category | SCI |
|
|
|
71 |
| user3 | manager | Category | ENG |
|
|
|
72 |
And the following "role capability" exists:
|
|
|
73 |
| role | courserequestor |
|
|
|
74 |
| moodle/course:request | allow |
|
|
|
75 |
And I log in as "user1"
|
|
|
76 |
And I am on course index
|
|
|
77 |
And I follow "English category"
|
|
|
78 |
And I click on "More actions" "button"
|
|
|
79 |
And I click on "Request a course" "link"
|
|
|
80 |
And I should see "English category" in the ".form-autocomplete-selection" "css_element"
|
|
|
81 |
And I set the following fields to these values:
|
|
|
82 |
| Course full name | My new course |
|
|
|
83 |
| Course short name | Mynewcourse |
|
|
|
84 |
| Supporting information | pretty please |
|
|
|
85 |
And I press "Request a course"
|
|
|
86 |
And I log out
|
|
|
87 |
And I log in as "user2"
|
|
|
88 |
And I am on course index
|
|
|
89 |
And I follow "English category"
|
|
|
90 |
And I should not see "More" in the "region-main" "region"
|
|
|
91 |
And I should not see "Courses pending approval"
|
|
|
92 |
And I am on course index
|
|
|
93 |
And I follow "Science category"
|
|
|
94 |
And I click on "More actions" "button"
|
|
|
95 |
And I click on "Courses pending approval" "link"
|
|
|
96 |
And I should not see "Mynewcourse"
|
|
|
97 |
And I press "Back to course listing"
|
|
|
98 |
And I log out
|
|
|
99 |
And I log in as "user3"
|
|
|
100 |
And I am on course index
|
|
|
101 |
And I follow "English category"
|
|
|
102 |
And I click on "More actions" "button"
|
|
|
103 |
And I click on "Courses pending approval" "link"
|
|
|
104 |
And the following should exist in the "pendingcourserequests" table:
|
|
|
105 |
| Requested by | Course short name | Course full name | Category | Reason for course request |
|
|
|
106 |
| User 1 | Mynewcourse | My new course | English category | pretty please |
|
|
|
107 |
And I click on "Approve" "button" in the "Mynewcourse" "table_row"
|
|
|
108 |
And I press "Save and return"
|
|
|
109 |
And I am on course index
|
|
|
110 |
And I follow "English category"
|
|
|
111 |
And I should see "My new course"
|
|
|
112 |
And I log out
|