1 |
efrain |
1 |
@mod @mod_customcert
|
|
|
2 |
Feature: Being able to correctly display options on the certificate activity edit form
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "courses" exist:
|
|
|
6 |
| fullname | shortname | category |
|
|
|
7 |
| Course 1 | C1 | 0 |
|
|
|
8 |
And the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
And the following "course enrolments" exist:
|
|
|
12 |
| user | course | role |
|
|
|
13 |
| teacher1 | C1 | editingteacher |
|
|
|
14 |
And the following "activities" exist:
|
|
|
15 |
| activity | name | intro | course | idnumber |
|
|
|
16 |
| customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 |
|
|
|
17 |
|
|
|
18 |
Scenario: Edit an activity as an Editing Teacher I can see all custom certificate options
|
|
|
19 |
And I log in as "teacher1"
|
|
|
20 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
21 |
And I follow "Custom certificate 1"
|
|
|
22 |
And I navigate to "Settings" in current page administration
|
|
|
23 |
And I should see "Email students"
|
|
|
24 |
And I should see "Email teachers"
|
|
|
25 |
And I should see "Email others"
|
|
|
26 |
And I should see "Allow anyone to verify a certificate"
|
|
|
27 |
And I should see "Required minutes in course"
|
|
|
28 |
And I should see "Set protection"
|
|
|
29 |
|
|
|
30 |
@javascript
|
|
|
31 |
Scenario: Create an activity as an Editing Teacher without required capabilities I can't see all custom certificate options
|
|
|
32 |
And I log in as "admin"
|
|
|
33 |
And I set the following system permissions of "Teacher" role:
|
|
|
34 |
| capability | permission |
|
|
|
35 |
| mod/customcert:manageemailstudents | Prevent |
|
|
|
36 |
| mod/customcert:manageemailteachers | Prevent |
|
|
|
37 |
| mod/customcert:manageemailothers | Prevent |
|
|
|
38 |
| mod/customcert:manageverifyany | Prevent |
|
|
|
39 |
| mod/customcert:managerequiredtime | Prevent |
|
|
|
40 |
| mod/customcert:manageprotection | Prevent |
|
|
|
41 |
And I log out
|
|
|
42 |
When I log in as "teacher1"
|
|
|
43 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
44 |
And I add a "Custom certificate" to section "1"
|
|
|
45 |
And I should not see "Email students"
|
|
|
46 |
And I should not see "Email teachers"
|
|
|
47 |
And I should not see "Email others"
|
|
|
48 |
And I should not see "Allow anyone to verify a certificate"
|
|
|
49 |
And I should not see "Required minutes in course"
|
|
|
50 |
And I should not see "Set protection"
|
|
|
51 |
|
|
|
52 |
Scenario: Edit an activity as an Editing Teacher without required capabilities I can't see all custom certificate options
|
|
|
53 |
And I log in as "admin"
|
|
|
54 |
And I set the following system permissions of "Teacher" role:
|
|
|
55 |
| capability | permission |
|
|
|
56 |
| mod/customcert:manageemailstudents | Prevent |
|
|
|
57 |
| mod/customcert:manageemailteachers | Prevent |
|
|
|
58 |
| mod/customcert:manageemailothers | Prevent |
|
|
|
59 |
| mod/customcert:manageverifyany | Prevent |
|
|
|
60 |
| mod/customcert:managerequiredtime | Prevent |
|
|
|
61 |
| mod/customcert:manageprotection | Prevent |
|
|
|
62 |
And I log out
|
|
|
63 |
When I log in as "teacher1"
|
|
|
64 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
65 |
And I follow "Custom certificate 1"
|
|
|
66 |
And I navigate to "Settings" in current page administration
|
|
|
67 |
And I should not see "Email students"
|
|
|
68 |
And I should not see "Email teachers"
|
|
|
69 |
And I should not see "Email others"
|
|
|
70 |
And I should not see "Allow anyone to verify a certificate"
|
|
|
71 |
And I should not see "Required minutes in course"
|
|
|
72 |
And I should not see "Set protection"
|
|
|
73 |
|
|
|
74 |
@javascript
|
|
|
75 |
Scenario: Add an activity using default custom certificate options
|
|
|
76 |
And I log in as "teacher1"
|
|
|
77 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
78 |
And I add a "Custom certificate" to section "0"
|
|
|
79 |
And the field "emailstudents" matches value "0"
|
|
|
80 |
And the field "emailteachers" matches value "0"
|
|
|
81 |
And the field "emailothers" matches value ""
|
|
|
82 |
And the field "verifyany" matches value "0"
|
|
|
83 |
And the field "requiredtime" matches value "0"
|
|
|
84 |
And the field "protection_print" matches value "0"
|
|
|
85 |
And the field "protection_modify" matches value "0"
|
|
|
86 |
And the field "protection_copy" matches value "0"
|
|
|
87 |
|
|
|
88 |
@javascript
|
|
|
89 |
Scenario: Add an activity using configured custom certificate options
|
|
|
90 |
And the following config values are set as admin:
|
|
|
91 |
| emailstudents | 1 | customcert |
|
|
|
92 |
| emailteachers | 1 | customcert |
|
|
|
93 |
| emailothers | test@moodle.com | customcert |
|
|
|
94 |
| verifyany | 1 | customcert |
|
|
|
95 |
| requiredtime | 5 | customcert |
|
|
|
96 |
| protection_print | 1 | customcert |
|
|
|
97 |
| protection_modify | 1 | customcert |
|
|
|
98 |
| protection_copy | 1 | customcert |
|
|
|
99 |
And I log in as "teacher1"
|
|
|
100 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
101 |
And I add a "Custom certificate" to section "1"
|
|
|
102 |
And the field "emailstudents" matches value "1"
|
|
|
103 |
And the field "emailteachers" matches value "1"
|
|
|
104 |
And the field "emailothers" matches value "test@moodle.com"
|
|
|
105 |
And the field "verifyany" matches value "1"
|
|
|
106 |
And the field "requiredtime" matches value "5"
|
|
|
107 |
And the field "protection_print" matches value "1"
|
|
|
108 |
And the field "protection_modify" matches value "1"
|
|
|
109 |
And the field "protection_copy" matches value "1"
|