1 |
efrain |
1 |
@mod @mod_data @datapreset @datapreset_proposals
|
|
|
2 |
Feature: Users can use the Proposals preset
|
|
|
3 |
In order to create a Proposals database
|
|
|
4 |
As a user
|
|
|
5 |
I need to apply and use the Proposals preset
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Alice | Student | student1@example.com |
|
|
|
11 |
| teacher1 | Pau | Teacher | teacher1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | intro | course | idnumber |
|
|
|
21 |
| data | Student projects | Database intro | C1 | data1 |
|
|
|
22 |
And I am on the "Student projects" "data activity" page logged in as teacher1
|
|
|
23 |
And I follow "Presets"
|
|
|
24 |
And I click on "fullname" "radio" in the "Proposals" "table_row"
|
|
|
25 |
And I click on "Use this preset" "button"
|
|
|
26 |
And the following "mod_data > entries" exist:
|
|
|
27 |
| database | user | Title | Summary | Content | Status |
|
|
|
28 |
| data1 | student1 | Project created by student | Summary 1 | Content for entry 1 | Pending |
|
|
|
29 |
| data1 | teacher1 | Project created by teacher | Summary 2 | And content for entry 2 | Rejected |
|
|
|
30 |
|
|
|
31 |
@javascript
|
|
|
32 |
Scenario: Proposals. Users view entries
|
|
|
33 |
When I am on the "Student projects" "data activity" page logged in as student1
|
|
|
34 |
Then I should see "Project created by student"
|
|
|
35 |
And "Summary 1" "text" should exist
|
|
|
36 |
And "Actions" "icon" should exist in the "#proposals-list" "css_element"
|
|
|
37 |
And I should see "Project created by teacher"
|
|
|
38 |
And "Summary 2" "text" should exist
|
|
|
39 |
And I click on "Project created by student" "link"
|
|
|
40 |
And I click on "Project created by teacher" "link"
|
|
|
41 |
And I should see "Summary 1"
|
|
|
42 |
And I should not see "Content for entry 1"
|
|
|
43 |
And I should see "Summary 2"
|
|
|
44 |
And I should not see "And content for entry 2"
|
|
|
45 |
# Single view.
|
|
|
46 |
And I select "Single view" from the "jump" singleselect
|
|
|
47 |
And I should see "Project created by student"
|
|
|
48 |
And I should see "Summary 1"
|
|
|
49 |
And I should see "Content for entry 1"
|
|
|
50 |
And I should see "Pending"
|
|
|
51 |
And "Actions" "icon" should exist in the ".proposals-single" "css_element"
|
|
|
52 |
And I should not see "Project created by teacher"
|
|
|
53 |
And I should not see "Summary 2"
|
|
|
54 |
And I should not see "And content for entry 2"
|
|
|
55 |
And I should not see "Rejected"
|
|
|
56 |
And I follow "Next"
|
|
|
57 |
And I should see "Project created by teacher"
|
|
|
58 |
And I should see "Summary 2"
|
|
|
59 |
And I should see "And content for entry 2"
|
|
|
60 |
And I should see "Rejected"
|
|
|
61 |
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
|
|
|
62 |
And "Actions" "icon" should not exist in the ".proposals-single" "css_element"
|
|
|
63 |
And I should not see "Project created by student"
|
|
|
64 |
And I should not see "Summary 1"
|
|
|
65 |
And I should not see "Content for entry 1"
|
|
|
66 |
And I should not see "Pending"
|
|
|
67 |
|
|
|
68 |
@javascript
|
|
|
69 |
Scenario: Proposals. Users can search entries
|
|
|
70 |
Given I am on the "Student projects" "data activity" page logged in as student1
|
|
|
71 |
And "Project created by student" "text" should appear before "Project created by teacher" "text"
|
|
|
72 |
When I click on "Advanced search" "checkbox"
|
|
|
73 |
And I should see "First name"
|
|
|
74 |
And I should see "Last name"
|
|
|
75 |
And I set the field "Title" to "student"
|
|
|
76 |
And I click on "Save settings" "button" in the "data_adv_form" "region"
|
|
|
77 |
Then I should see "Project created by student"
|
|
|
78 |
And I should not see "Project created by teacher"
|
|
|
79 |
But I set the field "Title" to "Project"
|
|
|
80 |
And I set the field "Order" to "Descending"
|
|
|
81 |
And I click on "Save settings" "button" in the "data_adv_form" "region"
|
|
|
82 |
And "Project created by teacher" "text" should appear before "Project created by student" "text"
|
|
|
83 |
|
|
|
84 |
@javascript
|
|
|
85 |
Scenario: Proposals. Users can add entries
|
|
|
86 |
Given I am on the "Student projects" "data activity" page logged in as student1
|
|
|
87 |
When I press "Add entry"
|
|
|
88 |
And I set the field "Title" to "This is the title"
|
|
|
89 |
And I set the field "Summary" to "This is the summary for the new entry."
|
|
|
90 |
And I set the field "Content" to "This is the content for the new entry."
|
|
|
91 |
And I set the field "Status" to "Approved"
|
|
|
92 |
And I press "Save"
|
|
|
93 |
Then I should see "This is the title"
|
|
|
94 |
And I should see "Approved"
|
|
|
95 |
And I should see "This is the summary for the new entry."
|
|
|
96 |
And I should see "This is the content for the new entry."
|
|
|
97 |
|
|
|
98 |
@javascript
|
|
|
99 |
Scenario: Proposals. Renaming a field should affect the template
|
|
|
100 |
Given I am on the "Student projects" "data activity" page logged in as teacher1
|
|
|
101 |
And I navigate to "Fields" in current page administration
|
|
|
102 |
And I open the action menu in "Summary" "table_row"
|
|
|
103 |
And I choose "Edit" in the open action menu
|
|
|
104 |
And I set the field "Field name" to "Edited field name"
|
|
|
105 |
And I press "Save"
|
|
|
106 |
And I should see "Field updated"
|
|
|
107 |
When I navigate to "Database" in current page administration
|
|
|
108 |
Then I click on "Advanced search" "checkbox"
|
|
|
109 |
And I should see "Edited field name"
|
|
|
110 |
And I select "Single view" from the "jump" singleselect
|
|
|
111 |
And I should see "Edited field name"
|
|
|
112 |
And I click on "Add entry" "button"
|
|
|
113 |
And I should see "Edited field name"
|
|
|
114 |
|
|
|
115 |
@javascript
|
|
|
116 |
Scenario: Proposals. Has otherfields tag
|
|
|
117 |
Given the following "mod_data > fields" exist:
|
|
|
118 |
| database | type | name | description |
|
|
|
119 |
| data1 | text | Extra field | Test field description |
|
|
|
120 |
And I am on the "Student projects" "data activity" page logged in as teacher1
|
|
|
121 |
When I select "Single view" from the "jump" singleselect
|
|
|
122 |
Then I should see "Extra field"
|
|
|
123 |
And I click on "Add entry" "button"
|
|
|
124 |
And I should see "Extra field"
|