1 |
efrain |
1 |
@mod @mod_forum @javascript
|
|
|
2 |
Feature: Export forum
|
|
|
3 |
In order to parse forum data for linguistic analysis
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to export the forum data for select users
|
|
|
6 |
|
|
|
7 |
Background: Add a forum and a discussion
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
| student2 | Student | 2 | student1@example.com |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category |
|
|
|
15 |
| Course 1 | C1 | 0 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | C1 | editingteacher |
|
|
|
19 |
| student1 | C1 | student |
|
|
|
20 |
And the following "activities" exist:
|
|
|
21 |
| activity | name | type | course | idnumber |
|
|
|
22 |
| forum | Test forum 1 | general | C1 | 123 |
|
|
|
23 |
|
|
|
24 |
Scenario: Teacher can export forum
|
|
|
25 |
Given I am on the "Test forum 1" "forum activity" page logged in as teacher1
|
|
|
26 |
And I navigate to "Export" in current page administration
|
|
|
27 |
And I open the autocomplete suggestions list
|
|
|
28 |
And I should see "Student 1" in the ".form-autocomplete-suggestions" "css_element"
|
|
|
29 |
And I should see "Teacher 1" in the ".form-autocomplete-suggestions" "css_element"
|
|
|
30 |
And I should not see "Student 2" in the ".form-autocomplete-suggestions" "css_element"
|
|
|
31 |
# This will fail if an exception is thrown. This is the best we can do without the ability to use the download. Hence, there is no "Then" step.
|
|
|
32 |
And I click on "Export" "button"
|
|
|
33 |
|
|
|
34 |
Scenario: Students cannot export forum by default
|
|
|
35 |
Given I am on the "Test forum 1" "forum activity" page logged in as student1
|
|
|
36 |
Then "Export" "link" should not exist in current page administration
|
|
|
37 |
|
|
|
38 |
Scenario: User with the capability can export
|
|
|
39 |
Given the following "permission overrides" exist:
|
|
|
40 |
| capability | permission | role | contextlevel | reference |
|
|
|
41 |
| mod/forum:exportforum | Allow | student | Course | C1 |
|
|
|
42 |
When I am on the "Test forum 1" "forum activity" page logged in as student1
|
|
|
43 |
And I navigate to "Export" in current page administration
|
|
|
44 |
And I open the autocomplete suggestions list
|
|
|
45 |
And I should see "Student 1" in the ".form-autocomplete-suggestions" "css_element"
|
|
|
46 |
And I should see "Teacher 1" in the ".form-autocomplete-suggestions" "css_element"
|
|
|
47 |
And I should not see "Student 2" in the ".form-autocomplete-suggestions" "css_element"
|
|
|
48 |
# This will fail if an exception is thrown. This is the best we can do without the ability to use the download. Hence, there is no "Then" step.
|
|
|
49 |
And I click on "Export" "button"
|
|
|
50 |
And I log out
|
|
|
51 |
|
|
|
52 |
Scenario: Group mode is respected when exporting discussions
|
|
|
53 |
Given the following "groups" exist:
|
|
|
54 |
| name | course | idnumber |
|
|
|
55 |
| G1 | C1 | G1 |
|
|
|
56 |
| G2 | C1 | G2 |
|
|
|
57 |
And the following "users" exist:
|
|
|
58 |
| username | firstname | lastname | email |
|
|
|
59 |
| teachera | Teacher | A | teacherA@example.com |
|
|
|
60 |
| teacherb | Teacher | B | teacherB@example.com |
|
|
|
61 |
| teacherc | Teacher | C | teacherC@example.com |
|
|
|
62 |
| teacherd | Teacher | D | teacherD@example.com |
|
|
|
63 |
And the following "course enrolments" exist:
|
|
|
64 |
| user | course | role |
|
|
|
65 |
| teachera | C1 | teacher |
|
|
|
66 |
| teacherb | C1 | teacher |
|
|
|
67 |
| teacherc | C1 | teacher |
|
|
|
68 |
| teacherd | C1 | teacher |
|
|
|
69 |
And the following "group members" exist:
|
|
|
70 |
| user | group |
|
|
|
71 |
| teachera | G1 |
|
|
|
72 |
| teachera | G2 |
|
|
|
73 |
| teacherb | G1 |
|
|
|
74 |
| teacherc | G2 |
|
|
|
75 |
And the following "activities" exist:
|
|
|
76 |
| activity | course | idnumber | name | intro | type | section | groupmode |
|
|
|
77 |
| forum | C1 | 00001 | Separate groups forum | Standard forum description | general | 1 | 1 |
|
|
|
78 |
And the following "mod_forum > discussions" exist:
|
|
|
79 |
| user | forum | name | message | group |
|
|
|
80 |
| teachera | Separate groups forum | Discussion 1 Group 1 | Test post message | G1 |
|
|
|
81 |
| teacherb | Separate groups forum | Discussion 2 Group 1 | Test post message | G1 |
|
|
|
82 |
| teachera | Separate groups forum | Discussion 1 Group 2 | Test post message | G2 |
|
|
|
83 |
| teacherc | Separate groups forum | Discussion 2 Group 2 | Test post message | G2 |
|
|
|
84 |
And I am on the "Separate groups forum" "forum activity" page logged in as teacher1
|
|
|
85 |
And I navigate to "Export" in current page administration
|
|
|
86 |
When I expand the "Users" autocomplete
|
|
|
87 |
# Editing teacher can see all users and discussions.
|
|
|
88 |
Then I should see "Teacher A" in the "Users" "autocomplete"
|
|
|
89 |
And I should see "Teacher B" in the "Users" "autocomplete"
|
|
|
90 |
And I should see "Teacher C" in the "Users" "autocomplete"
|
|
|
91 |
And I should see "Teacher D" in the "Users" "autocomplete"
|
|
|
92 |
And I should see "Teacher 1" in the "Users" "autocomplete"
|
|
|
93 |
And I should see "Student 1" in the "Users" "autocomplete"
|
|
|
94 |
And I press the escape key
|
|
|
95 |
And I expand the "Discussions" autocomplete
|
|
|
96 |
And I should see "Discussion 1 Group 1" in the "Discussions" "autocomplete"
|
|
|
97 |
And I should see "Discussion 2 Group 1" in the "Discussions" "autocomplete"
|
|
|
98 |
And I should see "Discussion 1 Group 2" in the "Discussions" "autocomplete"
|
|
|
99 |
And I should see "Discussion 2 Group 2" in the "Discussions" "autocomplete"
|
|
|
100 |
And I click on "Export" "button"
|
|
|
101 |
|
|
|
102 |
And I am on the "Separate groups forum" "forum activity" page logged in as teachera
|
|
|
103 |
And I navigate to "Export" in current page administration
|
|
|
104 |
When I expand the "Users" autocomplete
|
|
|
105 |
# Teacher A is is in both groups.
|
|
|
106 |
Then I should see "Teacher A" in the "Users" "autocomplete"
|
|
|
107 |
And I should see "Teacher B" in the "Users" "autocomplete"
|
|
|
108 |
And I should see "Teacher C" in the "Users" "autocomplete"
|
|
|
109 |
And I should not see "Teacher D" in the "Users" "autocomplete"
|
|
|
110 |
And I should not see "Teacher 1" in the "Users" "autocomplete"
|
|
|
111 |
And I should not see "Student 1" in the "Users" "autocomplete"
|
|
|
112 |
And I press the escape key
|
|
|
113 |
And I expand the "Discussions" autocomplete
|
|
|
114 |
And I should see "Discussion 1 Group 1" in the "Discussions" "autocomplete"
|
|
|
115 |
And I should see "Discussion 2 Group 1" in the "Discussions" "autocomplete"
|
|
|
116 |
And I should see "Discussion 1 Group 2" in the "Discussions" "autocomplete"
|
|
|
117 |
And I should see "Discussion 2 Group 2" in the "Discussions" "autocomplete"
|
|
|
118 |
And I click on "Export" "button"
|
|
|
119 |
|
|
|
120 |
And I am on the "Separate groups forum" "forum activity" page logged in as teacherb
|
|
|
121 |
And I navigate to "Export" in current page administration
|
|
|
122 |
When I expand the "Users" autocomplete
|
|
|
123 |
# Teacher B is in group 1.
|
|
|
124 |
Then I should see "Teacher A" in the "Users" "autocomplete"
|
|
|
125 |
And I should see "Teacher B" in the "Users" "autocomplete"
|
|
|
126 |
And I should not see "Teacher C" in the "Users" "autocomplete"
|
|
|
127 |
And I should not see "Teacher D" in the "Users" "autocomplete"
|
|
|
128 |
And I should not see "Teacher 1" in the "Users" "autocomplete"
|
|
|
129 |
And I should not see "Student 1" in the "Users" "autocomplete"
|
|
|
130 |
And I press the escape key
|
|
|
131 |
And I expand the "Discussions" autocomplete
|
|
|
132 |
And I should see "Discussion 1 Group 1" in the "Discussions" "autocomplete"
|
|
|
133 |
And I should see "Discussion 2 Group 1" in the "Discussions" "autocomplete"
|
|
|
134 |
And I should not see "Discussion 1 Group 2" in the "Discussions" "autocomplete"
|
|
|
135 |
And I should not see "Discussion 2 Group 2" in the "Discussions" "autocomplete"
|
|
|
136 |
And I click on "Export" "button"
|
|
|
137 |
|
|
|
138 |
And I am on the "Separate groups forum" "forum activity" page logged in as teacherc
|
|
|
139 |
And I navigate to "Export" in current page administration
|
|
|
140 |
When I expand the "Users" autocomplete
|
|
|
141 |
# Teacher C is in group 2.
|
|
|
142 |
Then I should see "Teacher A" in the "Users" "autocomplete"
|
|
|
143 |
And I should not see "Teacher B" in the "Users" "autocomplete"
|
|
|
144 |
And I should see "Teacher C" in the "Users" "autocomplete"
|
|
|
145 |
And I should not see "Teacher D" in the "Users" "autocomplete"
|
|
|
146 |
And I should not see "Teacher 1" in the "Users" "autocomplete"
|
|
|
147 |
And I should not see "Student 1" in the "Users" "autocomplete"
|
|
|
148 |
And I press the escape key
|
|
|
149 |
And I expand the "Discussions" autocomplete
|
|
|
150 |
And I should not see "Discussion 1 Group 1" in the "Discussions" "autocomplete"
|
|
|
151 |
And I should not see "Discussion 2 Group 1" in the "Discussions" "autocomplete"
|
|
|
152 |
And I should see "Discussion 1 Group 2" in the "Discussions" "autocomplete"
|
|
|
153 |
And I should see "Discussion 2 Group 2" in the "Discussions" "autocomplete"
|
|
|
154 |
And I click on "Export" "button"
|
|
|
155 |
|
|
|
156 |
And I am on the "Separate groups forum" "forum activity" page logged in as teacherd
|
|
|
157 |
And I navigate to "Export" in current page administration
|
|
|
158 |
When I expand the "Users" autocomplete
|
|
|
159 |
# Teacher D is in no group.
|
|
|
160 |
Then I should not see "Teacher A" in the "Users" "autocomplete"
|
|
|
161 |
And I should not see "Teacher B" in the "Users" "autocomplete"
|
|
|
162 |
And I should not see "Teacher C" in the "Users" "autocomplete"
|
|
|
163 |
And I should not see "Teacher D" in the "Users" "autocomplete"
|
|
|
164 |
And I should not see "Teacher 1" in the "Users" "autocomplete"
|
|
|
165 |
And I should not see "Student 1" in the "Users" "autocomplete"
|
|
|
166 |
And I press the escape key
|
|
|
167 |
And I expand the "Discussions" autocomplete
|
|
|
168 |
And I should not see "Discussion 1 Group 1" in the "Discussions" "autocomplete"
|
|
|
169 |
And I should not see "Discussion 2 Group 1" in the "Discussions" "autocomplete"
|
|
|
170 |
And I should not see "Discussion 1 Group 2" in the "Discussions" "autocomplete"
|
|
|
171 |
And I should not see "Discussion 2 Group 2" in the "Discussions" "autocomplete"
|
|
|
172 |
And I click on "Export" "button"
|