Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_feedback
2
Feature: Saving, using and deleting feedback templates
3
  In order to quickly create feedbacks
4
  As a manager
5
  I need to be able to create feedback templates
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname |
10
      | teacher  | Teacher   | 1        |
11
      | manager  | Manager   | 1        |
12
    And the following "courses" exist:
13
      | fullname | shortname |
14
      | Course 1 | C1        |
15
      | Course 2 | C2        |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | teacher  | C1     | editingteacher |
19
      | teacher  | C2     | editingteacher |
20
    And the following "system role assigns" exist:
21
      | user    | course               | role    |
22
      | manager | Acceptance test site | manager |
23
    And the following "activities" exist:
24
      | activity   | name                         | course | idnumber    |
25
      | feedback   | Learning experience course 1 | C1     | feedback1   |
26
      | feedback   | Another feedback in course 1 | C1     | feedback2   |
27
      | feedback   | Learning experience course 2 | C2     | feedback3   |
28
    And I am on the "Learning experience course 1" "feedback activity" page logged in as teacher
29
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
30
    And I add a "Multiple choice" question to the feedback with:
31
      | Question         | this is a multiple choice 1 |
32
      | Label            | multichoice1                |
33
      | Multiple choice type | Multiple choice - single answer |
34
      | Multiple choice values | option a\noption b\noption c  |
35
    And I log out
36
 
37
  @javascript
38
  Scenario: Teacher can save template and re-use it in the same course only
39
    # Go to feedback templates and make sure none exist yet
40
    When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher
41
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
42
    And I select "Use a template" from the "jump" singleselect
43
    Then I should see "No templates available yet"
44
    And "Use a template" "field" should not exist
45
    And "Public" "field" should not exist
46
    And I select "Add question" from the "jump" singleselect
47
    # Save as a course template
48
    And I press "Save as new template"
49
    And I should see "Save as new template" in the ".modal-title" "css_element"
50
    And I should see "Name" in the ".modal-body" "css_element"
51
    And I set the field "Name" to "My first template"
52
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
53
    And I should see "Template saved"
54
    And I select "Use a template" from the "jump" singleselect
55
    And I should see "My first template"
56
    # Create a feedback from this template in the same course
57
    And I am on the "Another feedback in course 1" "feedback activity" page
58
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
59
    And I select "Use a template" from the "jump" singleselect
60
    And I follow "My first template"
61
    And I should see "this is a multiple choice 1"
62
    And I press "Use this template"
63
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
64
    And I should see "this is a multiple choice 1"
65
    # Make sure this template is not available in another course
66
    And I am on the "Learning experience course 2" "feedback activity" page
67
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
68
    And I select "Use a template" from the "jump" singleselect
69
    And I should see "No templates available yet"
70
    And I log out
71
 
72
  @javascript
73
  Scenario: Teacher can append template to existing questions or remove them
74
    # Save feedback as a course template
75
    When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher
76
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
77
    And I press "Save as new template"
78
    And I should see "Save as new template" in the ".modal-title" "css_element"
79
    And I should see "Name" in the ".modal-body" "css_element"
80
    And I set the field "Name" to "My first template"
81
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
82
    And I press "Save as new template"
83
    # Add questions to another feedback
84
    And I am on the "Another feedback in course 1" "feedback activity" page
85
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
86
    And I add a "Multiple choice" question to the feedback with:
87
      | Question         | What is your favourite subject |
88
      | Label            | subjectchoice                  |
89
      | Multiple choice type | Multiple choice - single answer   |
90
      | Multiple choice values | Maths\bScience\nEnglish\nOther  |
91
    # Import template appending items
92
    And I select "Use a template" from the "jump" singleselect
93
    And I follow "My first template"
94
    And I press "Use this template"
95
    And I set the field "Append new items" to "1"
96
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
97
    Then "What is your favourite subject" "text" should appear before "this is a multiple choice 1" "text"
98
    # Import template replacing items
99
    And I select "Use a template" from the "jump" singleselect
100
    And I follow "My first template"
101
    And I press "Use this template"
102
    And I set the field "Delete old items" to "1"
103
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
104
    And I should see "this is a multiple choice 1"
105
    And I should not see "What is your favourite subject"
106
    And I should see "this is a multiple choice 1"
107
 
108
  @javascript
109
  Scenario: Manager can save template as public and it will be available in any course
110
    When I am on the "Learning experience course 1" "feedback activity" page logged in as manager
111
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
112
    And I press "Save as new template"
113
    And I set the field "Name" to "My first template"
114
    And I set the field "Public" to "1"
115
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
116
    And I log out
117
    And I am on the "Learning experience course 2" "feedback activity" page logged in as teacher
118
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
119
    And I select "Use a template" from the "jump" singleselect
120
    And I follow "My first template"
121
    And I should see "this is a multiple choice 1"
122
    And I press "Use this template"
123
    And I set the field "Delete old items" to "1"
124
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
125
    Then I should see "this is a multiple choice 1"
126
    And I log out
127
 
128
  @javascript
129
  Scenario: Teacher can delete course templates but can not delete public templates
130
    # Save feedback as both public and course template
131
    When I am on the "Learning experience course 1" "feedback activity" page logged in as manager
132
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
133
    And I press "Save as new template"
134
    And I set the field "Name" to "My public template"
135
    And I set the field "Public" to "1"
136
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
137
    And I press "Save as new template"
138
    And I set the field "Name" to "My course template"
139
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
140
    And I log out
141
    # Login as teacher and try to delete templates
142
    And I am on the "Another feedback in course 1" "feedback activity" page logged in as teacher
143
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
144
    And I select "Use a template" from the "jump" singleselect
145
    And I follow "My public template"
146
    Then I should not see "Delete"
147
    And I click on "Back" "link" in the ".tertiary-navigation" "css_element"
148
    And "My course template" "text" should exist in the ".coursetemplates" "css_element"
149
    And I follow "My course template"
150
    And I click on "Delete" "link"
151
    And I click on "Yes" "button"
152
    And I should see "Template deleted"
153
    And "My course template" "text" should not exist in the ".coursetemplates" "css_element"
154
    And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
155
    And I log out
156
 
157
  @javascript
158
  Scenario: Manager can delete both course and public templates
159
    # Save feedback as both public and course template
160
    When I am on the "Learning experience course 1" "feedback activity" page logged in as manager
161
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
162
    And I press "Save as new template"
163
    And I set the field "Name" to "My public template"
164
    And I set the field "Public" to "1"
165
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
166
    And I press "Save as new template"
167
    And I set the field "Name" to "My course template"
168
    And I click on "Save" "button" in the ".modal-dialog" "css_element"
169
    # Delete course template
170
    And I select "Use a template" from the "jump" singleselect
171
    Then "My public template" "text" should exist in the ".publictemplates" "css_element"
172
    And "My course template" "text" should exist in the ".coursetemplates" "css_element"
173
    And I follow "My course template"
174
    And I click on "Delete" "link"
175
    And I should see "Are you sure you want to delete this template?"
176
    And I press "Yes"
177
    And I should see "Template deleted"
178
    And "My course template" "text" should not exist in the ".coursetemplates" "css_element"
179
    And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
180
    And "My public template" "text" should exist in the ".publictemplates" "css_element"
181
    And I follow "My public template"
182
    And I click on "Delete" "link"
183
    And I should see "Are you sure you want to delete this template?"
184
    And I press "Yes"
185
    And I should see "Template deleted"
186
    And "My public template" "text" should not exist in the ".publictemplates" "css_element"
187
    And "No templates available yet" "text" should exist in the ".publictemplates" "css_element"
188
    And I should see "No templates available yet"
189
    And I log out