1 |
efrain |
1 |
@core @core_course @core_customfield @javascript
|
|
|
2 |
Feature: Fields locked control who is able to edit it
|
|
|
3 |
In order to display custom fields on course listing
|
|
|
4 |
As a manager
|
|
|
5 |
I can change the visibility of the fields
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "custom field categories" exist:
|
|
|
9 |
| name | component | area | itemid |
|
|
|
10 |
| Category for test | core_course | course | 0 |
|
|
|
11 |
Given the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
14 |
| student1 | Student | 1 | student@example.com |
|
|
|
15 |
And the following "courses" exist:
|
|
|
16 |
| fullname | shortname | format |
|
|
|
17 |
| Course 1 | C1 | topics |
|
|
|
18 |
And the following "course enrolments" exist:
|
|
|
19 |
| user | course | role |
|
|
|
20 |
| teacher1 | C1 | editingteacher |
|
|
|
21 |
|
|
|
22 |
Scenario: Editing locked and not locked custom fields
|
|
|
23 |
When I log in as "admin"
|
|
|
24 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
25 |
And I click on "Add a new custom field" "link"
|
|
|
26 |
And I click on "Short text" "link"
|
|
|
27 |
And I set the following fields to these values:
|
|
|
28 |
| Name | Test field1 |
|
|
|
29 |
| Short name | testfield1 |
|
|
|
30 |
| Locked | No |
|
|
|
31 |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
|
|
|
32 |
And I click on "Add a new custom field" "link"
|
|
|
33 |
And I click on "Short text" "link"
|
|
|
34 |
And I set the following fields to these values:
|
|
|
35 |
| Name | Test field2 |
|
|
|
36 |
| Short name | testfield2 |
|
|
|
37 |
| Locked | Yes |
|
|
|
38 |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
|
|
|
39 |
And I am on "Course 1" course homepage
|
|
|
40 |
And I navigate to "Settings" in current page administration
|
|
|
41 |
And I set the following fields to these values:
|
|
|
42 |
| Test field1 | testcontent1 |
|
|
|
43 |
| Test field2 | testcontent2 |
|
|
|
44 |
And I press "Save and display"
|
|
|
45 |
And I am on site homepage
|
|
|
46 |
Then I should see "Test field1: testcontent1"
|
|
|
47 |
And I should see "Test field2: testcontent2"
|
|
|
48 |
And I log out
|
|
|
49 |
And I log in as "teacher1"
|
|
|
50 |
And I am on "Course 1" course homepage
|
|
|
51 |
And I navigate to "Settings" in current page administration
|
|
|
52 |
And I expand all fieldsets
|
|
|
53 |
And the field "Test field1" matches value "testcontent1"
|
|
|
54 |
And I should not see "Test field2"
|
|
|
55 |
And I press "Save and display"
|
|
|
56 |
And I am on site homepage
|
|
|
57 |
And I should see "Test field1: testcontent1"
|
|
|
58 |
And I should see "Test field2: testcontent2"
|