Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@qbank @qbank_comment @javascript
2
Feature: A Teacher can comment in a question
3
 
4
  Background:
5
    Given the following "users" exist:
6
      | username | firstname | lastname | email                |
7
      | teacher1 | T1        | Teacher1 | teacher1@example.com |
8
      | teacher2 | T2        | Teacher2 | teacher2@example.com |
9
    And the following "courses" exist:
10
      | fullname | shortname | category |
11
      | Course 1 | C1        | 0        |
12
    And the following "course enrolments" exist:
13
      | user     | course | role           |
14
      | teacher1 | C1     | editingteacher |
15
      | teacher2 | C1     | editingteacher |
16
    And the following "activities" exist:
17
      | activity | name      | course | idnumber |
18
      | quiz     | Test quiz | C1     | quiz1    |
19
    And the following "question categories" exist:
1441 ariadna 20
      | contextlevel    | reference | name           |
21
      | Activity module | quiz1     | Test questions |
1 efrain 22
    And the following "questions" exist:
23
      | questioncategory | qtype     | name           | questiontext              |
24
      | Test questions   | truefalse | First question | Answer the first question |
25
 
26
  @javascript
27
  Scenario: Add a comment in question
28
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
29
    And I apply question bank filter "Category" with value "Test questions"
1441 ariadna 30
    And "0" "qbank_comment > Comment count link" should exist
31
    And "1" "qbank_comment > Comment count link" should not exist
32
    And I click on "0" "qbank_comment > Comment count link"
1 efrain 33
    And I add "Super test comment 01" comment to question
34
    And I click on "Add comment" "button" in the ".modal-dialog" "css_element"
35
    And I should see "Super test comment 01"
36
    And I click on "Close" "button" in the ".modal-dialog" "css_element"
1441 ariadna 37
    And "1" "qbank_comment > Comment count link" should exist
38
    And "0" "qbank_comment > Comment count link" should not exist
1 efrain 39
 
40
  @javascript
41
  Scenario: Delete a comment from question
42
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
43
    And I apply question bank filter "Category" with value "Test questions"
1441 ariadna 44
    And "0" "qbank_comment > Comment count link" should exist
45
    And "1" "qbank_comment > Comment count link" should not exist
46
    And I click on "0" "qbank_comment > Comment count link"
1 efrain 47
    And I add "Super test comment 01 to be deleted" comment to question
48
    And I click on "Add comment" "button" in the ".modal-dialog" "css_element"
49
    And I should see "Super test comment 01 to be deleted"
50
    And I click on "Close" "button" in the ".modal-dialog" "css_element"
1441 ariadna 51
    And "1" "qbank_comment > Comment count link" should exist
52
    And "0" "qbank_comment > Comment count link" should not exist
53
    And I click on "1" "qbank_comment > Comment count link"
1 efrain 54
    And I delete "Super test comment 01 to be deleted" comment from question
55
    And I should not see "Super test comment 01 to be deleted"
56
    And I click on "Close" "button" in the ".modal-dialog" "css_element"
1441 ariadna 57
    And "0" "qbank_comment > Comment count link" should exist
58
    And "1" "qbank_comment > Comment count link" should not exist
1 efrain 59
 
60
  @javascript
61
  Scenario: Preview question with comments
62
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
63
    And I apply question bank filter "Category" with value "Test questions"
64
    And I choose "Preview" action for "First question" in the question bank
65
    And I click on "Comments" "link"
66
    Then I should see "Save comment"
67
    And I add "Super test comment 01" comment to question preview
68
    And I click on "Save comment" "link"
69
    And I wait "1" seconds
70
    Then I should see "Super test comment 01"
71
    And I click on "Close preview" "button"
1441 ariadna 72
    And "1" "qbank_comment > Comment count link" should exist
73
    And "0" "qbank_comment > Comment count link" should not exist
1 efrain 74
    And I choose "Preview" action for "First question" in the question bank
75
    And I click on "Comments" "link"
76
    And I delete "Super test comment 01" comment from question preview
77
    And I should not see "Super test comment 01"
78
    And I click on "Close preview" "button"
1441 ariadna 79
    And "0" "qbank_comment > Comment count link" should exist
80
    And "1" "qbank_comment > Comment count link" should not exist
1 efrain 81
 
82
  @javascript
83
  Scenario: Teacher with comment permissions for their own questions but not others questions
84
    Given the following "role capability" exists:
85
      | role                        | editingteacher |
86
      | moodle/question:commentmine | allow          |
87
      | moodle/question:commentall  | prevent        |
88
    And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
89
    And I apply question bank filter "Category" with value "Test questions"
90
    And I choose "Preview" action for "First question" in the question bank
91
    Then I should not see "Save comment"
92
    And I click on "Close preview" "button"
93
    Then I click on "Create a new question ..." "button"
94
    And I set the field "item_qtype_essay" to "1"
95
    And I press "submitbutton"
96
    Then I should see "Adding an Essay question"
97
    And I set the field "Question name" to "Essay 01 new"
98
    And I set the field "Question text" to "Please write 200 words about Essay 01"
99
    And I press "id_submitbutton"
100
    Then I should see "Essay 01 new"
101
    And I choose "Preview" action for "Essay 01 new" in the question bank
102
    And I click on "Comments" "link"
103
    Then I should see "Save comment"
104
    And I log out
105
    And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher2"
106
    And I apply question bank filter "Category" with value "Test questions"
107
    And I choose "Preview" action for "First question" in the question bank
108
    Then I should not see "Save comment"
109
    And I click on "Close preview" "button"
110
    And I choose "Preview" action for "Essay 01 new" in the question bank
111
    Then I should not see "Save comment"
112
    And I click on "Close preview" "button"
113
 
114
  @javascript
115
  Scenario: Comments added from the quiz page are visible
116
    Given I am on the "Test quiz" "mod_quiz > edit" page logged in as "teacher1"
117
    And I press "Add"
118
    And I follow "from question bank"
1441 ariadna 119
    And I apply question bank filter "Category" with value "Test questions"
1 efrain 120
    And I click on "Select" "checkbox" in the "First question" "table_row"
121
    And I click on "Add selected questions to the quiz" "button"
122
    And I click on "Preview question" "link"
123
    And I switch to "questionpreview" window
124
    And I press "Comments"
125
    And I set the field "content" to "Some new comment"
126
    And I click on "Save comment" "link"
127
    And I should see "Some new comment"
128
    And I switch to the main window
129
    And I am on the "Test quiz" "mod_quiz > question bank" page
1441 ariadna 130
    And I apply question bank filter "Category" with value "Test questions"
1 efrain 131
    And I choose "Preview" action for "First question" in the question bank
132
    And I click on "Comments" "link"
133
    And I should see "Some new comment"
134
    And I should see "T1 Teacher1"
135
    And I delete "Some new comment" comment from question preview
136
    And I should not see "Some new comment"
137
    And I am on the "Test quiz" "mod_quiz > edit" page
138
    And I click on "Preview question" "link"
139
    And I switch to "questionpreview" window
140
    And I press "Comments"
141
    Then I should not see "Some new comment"
142
 
143
  @javascript
144
  Scenario: Comments modal can change the version using dropdown
1441 ariadna 145
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
146
    And I apply question bank filter "Category" with value "Test questions"
1 efrain 147
    And I should see "First question"
148
    And I choose "Edit question" action for "First question" in the question bank
149
    And I set the field "id_name" to "Renamed question v2"
150
    And I set the field "id_questiontext" to "edited question"
151
    And I press "id_submitbutton"
152
    And I should not see "First question"
153
    And I should see "Renamed question v2"
1441 ariadna 154
    And I click on "0" "qbank_comment > Comment count link"
1 efrain 155
    And I should see "Version 2"
156
    Then I should see "edited question"
157
    And I should see "Version 1"
158
    And I set the field "question_version_dropdown" to "Version 1"
159
    And I should see "Answer the first question"
1441 ariadna 160
 
161
  @javascript
162
  Scenario: User without system moodle/comment:post capability cannot post comments on question
163
    Given the following "role capability" exists:
164
      | role                            | user     |
165
      | moodle/comment:post             | prohibit |
166
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
167
    And I apply question bank filter "Category" with value "Test questions"
168
    And "0" "qbank_comment > Comment count text" should exist
169
    And "0" "qbank_comment > Comment count link" should not exist