Proyectos de Subversion Moodle

Rev

| 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:
20
      | contextlevel | reference | name           |
21
      | Course       | C1        | Test questions |
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"
30
    And I should see "0" on the comments column
31
    When I click "0" on the row on the comments column
32
    And I add "Super test comment 01" comment to question
33
    And I click on "Add comment" "button" in the ".modal-dialog" "css_element"
34
    And I should see "Super test comment 01"
35
    And I click on "Close" "button" in the ".modal-dialog" "css_element"
36
    Then I should see "1" on the comments column
37
 
38
  @javascript
39
  Scenario: Delete a comment from question
40
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
41
    And I apply question bank filter "Category" with value "Test questions"
42
    And I should see "0" on the comments column
43
    When I click "0" on the row on the comments column
44
    And I add "Super test comment 01 to be deleted" comment to question
45
    And I click on "Add comment" "button" in the ".modal-dialog" "css_element"
46
    And I should see "Super test comment 01 to be deleted"
47
    And I click on "Close" "button" in the ".modal-dialog" "css_element"
48
    Then I should see "1" on the comments column
49
    And I click "1" on the row on the comments column
50
    And I delete "Super test comment 01 to be deleted" comment from question
51
    And I should not see "Super test comment 01 to be deleted"
52
    And I click on "Close" "button" in the ".modal-dialog" "css_element"
53
    But I should see "0" on the comments column
54
 
55
  @javascript
56
  Scenario: Preview question with comments
57
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
58
    And I apply question bank filter "Category" with value "Test questions"
59
    And I choose "Preview" action for "First question" in the question bank
60
    And I click on "Comments" "link"
61
    Then I should see "Save comment"
62
    And I add "Super test comment 01" comment to question preview
63
    And I click on "Save comment" "link"
64
    And I wait "1" seconds
65
    Then I should see "Super test comment 01"
66
    And I click on "Close preview" "button"
67
    Then I should see "1" on the comments column
68
    And I choose "Preview" action for "First question" in the question bank
69
    And I click on "Comments" "link"
70
    And I delete "Super test comment 01" comment from question preview
71
    And I should not see "Super test comment 01"
72
    And I click on "Close preview" "button"
73
    Then I should see "0" on the comments column
74
 
75
  @javascript
76
  Scenario: Teacher with comment permissions for their own questions but not others questions
77
    Given the following "role capability" exists:
78
      | role                        | editingteacher |
79
      | moodle/question:commentmine | allow          |
80
      | moodle/question:commentall  | prevent        |
81
    And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
82
    And I apply question bank filter "Category" with value "Test questions"
83
    And I choose "Preview" action for "First question" in the question bank
84
    Then I should not see "Save comment"
85
    And I click on "Close preview" "button"
86
    Then I click on "Create a new question ..." "button"
87
    And I set the field "item_qtype_essay" to "1"
88
    And I press "submitbutton"
89
    Then I should see "Adding an Essay question"
90
    And I set the field "Question name" to "Essay 01 new"
91
    And I set the field "Question text" to "Please write 200 words about Essay 01"
92
    And I press "id_submitbutton"
93
    Then I should see "Essay 01 new"
94
    And I choose "Preview" action for "Essay 01 new" in the question bank
95
    And I click on "Comments" "link"
96
    Then I should see "Save comment"
97
    And I log out
98
    And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher2"
99
    And I apply question bank filter "Category" with value "Test questions"
100
    And I choose "Preview" action for "First question" in the question bank
101
    Then I should not see "Save comment"
102
    And I click on "Close preview" "button"
103
    And I choose "Preview" action for "Essay 01 new" in the question bank
104
    Then I should not see "Save comment"
105
    And I click on "Close preview" "button"
106
 
107
  @javascript
108
  Scenario: Comments added from the quiz page are visible
109
    Given I am on the "Test quiz" "mod_quiz > edit" page logged in as "teacher1"
110
    And I press "Add"
111
    And I follow "from question bank"
112
    And I click on "Select" "checkbox" in the "First question" "table_row"
113
    And I click on "Add selected questions to the quiz" "button"
114
    And I click on "Preview question" "link"
115
    And I switch to "questionpreview" window
116
    And I press "Comments"
117
    And I set the field "content" to "Some new comment"
118
    And I click on "Save comment" "link"
119
    And I should see "Some new comment"
120
    And I switch to the main window
121
    And I am on the "Test quiz" "mod_quiz > question bank" page
122
    And I choose "Preview" action for "First question" in the question bank
123
    And I click on "Comments" "link"
124
    And I should see "Some new comment"
125
    And I should see "T1 Teacher1"
126
    And I delete "Some new comment" comment from question preview
127
    And I should not see "Some new comment"
128
    And I am on the "Test quiz" "mod_quiz > edit" page
129
    And I click on "Preview question" "link"
130
    And I switch to "questionpreview" window
131
    And I press "Comments"
132
    Then I should not see "Some new comment"
133
 
134
  @javascript
135
  Scenario: Comments modal can change the version using dropdown
136
    Given I log in as "teacher1"
137
    And I am on the "Test quiz" "quiz activity" page
138
    When I navigate to "Question bank" in current page administration
139
    And I should see "First question"
140
    And I choose "Edit question" action for "First question" in the question bank
141
    And I set the field "id_name" to "Renamed question v2"
142
    And I set the field "id_questiontext" to "edited question"
143
    And I press "id_submitbutton"
144
    And I should not see "First question"
145
    And I should see "Renamed question v2"
146
    And I click "0" on the row on the comments column
147
    And I should see "Version 2"
148
    Then I should see "edited question"
149
    And I should see "Version 1"
150
    And I set the field "question_version_dropdown" to "Version 1"
151
    And I should see "Answer the first question"