1 |
efrain |
1 |
@customfield @customfield_checkbox @javascript
|
|
|
2 |
Feature: Managers can manage course custom fields checkbox
|
|
|
3 |
In order to have additional data on the course
|
|
|
4 |
As a manager
|
|
|
5 |
I need to create, edit, remove and sort custom 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 |
And I log in as "admin"
|
|
|
12 |
And I navigate to "Courses > Default settings > Course custom fields" in site administration
|
|
|
13 |
|
|
|
14 |
Scenario: Create a custom course checkbox field
|
|
|
15 |
When I click on "Add a new custom field" "link"
|
|
|
16 |
And I click on "Checkbox" "link"
|
|
|
17 |
And I set the following fields to these values:
|
|
|
18 |
| Name | Test field |
|
|
|
19 |
| Short name | testfield |
|
|
|
20 |
And I click on "Save changes" "button" in the "Adding a new Checkbox" "dialogue"
|
|
|
21 |
Then I should see "Test field"
|
|
|
22 |
And I log out
|
|
|
23 |
|
|
|
24 |
Scenario: Edit a custom course checkbox field
|
|
|
25 |
When I click on "Add a new custom field" "link"
|
|
|
26 |
And I click on "Checkbox" "link"
|
|
|
27 |
And I set the following fields to these values:
|
|
|
28 |
| Name | Test field |
|
|
|
29 |
| Short name | testfield |
|
|
|
30 |
And I click on "Save changes" "button" in the "Adding a new Checkbox" "dialogue"
|
|
|
31 |
And I click on "Edit" "link" in the "Test field" "table_row"
|
|
|
32 |
And I set the following fields to these values:
|
|
|
33 |
| Name | Edited field |
|
|
|
34 |
And I click on "Save changes" "button" in the "Updating Test field" "dialogue"
|
|
|
35 |
Then I should see "Edited field"
|
|
|
36 |
And I should not see "Test field"
|
|
|
37 |
|
|
|
38 |
Scenario: Delete a custom course checkbox field
|
|
|
39 |
When I click on "Add a new custom field" "link"
|
|
|
40 |
And I click on "Checkbox" "link"
|
|
|
41 |
And I set the following fields to these values:
|
|
|
42 |
| Name | Test field |
|
|
|
43 |
| Short name | testfield |
|
|
|
44 |
And I click on "Save changes" "button" in the "Adding a new Checkbox" "dialogue"
|
|
|
45 |
And I click on "Delete" "link" in the "Test field" "table_row"
|
|
|
46 |
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
|
|
47 |
Then I should not see "Test field"
|
|
|
48 |
And I log out
|
|
|
49 |
|
|
|
50 |
Scenario: A checkbox checked by default must be shown on listing but allow uncheck that will keep showing
|
|
|
51 |
Given the following "users" exist:
|
|
|
52 |
| username | firstname | lastname | email |
|
|
|
53 |
| teacher1 | Teacher | Example 1 | teacher1@example.com |
|
|
|
54 |
And the following "courses" exist:
|
|
|
55 |
| fullname | shortname | format |
|
|
|
56 |
| Course 1 | C1 | topics |
|
|
|
57 |
And the following "course enrolments" exist:
|
|
|
58 |
| user | course | role |
|
|
|
59 |
| teacher1 | C1 | editingteacher |
|
|
|
60 |
When I click on "Add a new custom field" "link"
|
|
|
61 |
And I click on "Checkbox" "link"
|
|
|
62 |
And I set the following fields to these values:
|
|
|
63 |
| Name | Test field |
|
|
|
64 |
| Short name | testfield |
|
|
|
65 |
| Checked by default | Yes |
|
|
|
66 |
And I click on "Save changes" "button" in the "Adding a new Checkbox" "dialogue"
|
|
|
67 |
And I log out
|
|
|
68 |
And I log in as "teacher1"
|
|
|
69 |
And I am on site homepage
|
|
|
70 |
Then I should see "Test field: Yes"
|
|
|
71 |
When I am on "Course 1" course homepage
|
|
|
72 |
And I navigate to "Settings" in current page administration
|
|
|
73 |
And I expand all fieldsets
|
|
|
74 |
And I set the field "Test field" to ""
|
|
|
75 |
And I press "Save and display"
|
|
|
76 |
And I am on site homepage
|
|
|
77 |
Then I should see "Test field: No"
|
|
|
78 |
And I log out
|