199 test_text ('table.dash_table:eq(3) a:eq(1)[href="?span=day"]', '24 hours'); |
169 test_text ('table.dash_table:eq(3) a:eq(1)[href="?span=day"]', '24 hours'); |
200 test_text ('table.dash_table th:eq(4) span.em', 'Activities'); |
170 test_text ('table.dash_table th:eq(4) span.em', 'Activities'); |
201 test_unlogged_footer (); |
171 test_unlogged_footer (); |
202 }); |
172 }); |
203 |
173 |
204 suite ('texts list page conformity', function () { |
174 suite ('empty texts list page conformity', function () { |
205 test_page_loading ('/text/', 'Texts\n - '+t['#id_workspace_name']); |
175 test_page_loading ('/text/', 'Texts\n - '+t['#id_workspace_name']); |
206 test_logged_header (w.USER_ADMIN); |
176 test_logged_header (w.USER_ADMIN); |
207 test_default_tabs (); |
177 test_default_tabs (t.text_nb, t.user_nb); |
|
178 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
179 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
|
180 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
|
181 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
182 test_match ('#text', /No texts yet/m); |
|
183 test_count ('#texts_form :input', 0); |
|
184 }); |
|
185 |
|
186 suite ('create a text page conformity', function () { |
|
187 test_page_loading ('/create/content/', 'Create a text - '+t['#id_workspace_name']); |
|
188 test_logged_header (w.USER_ADMIN); |
|
189 test_default_tabs (t.text_nb, t.user_nb); |
|
190 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
191 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
192 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
|
193 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
194 test_count ('#text form[action="."]:eq(0) :input', 6); |
|
195 test_form_field ('text', 'id_title', 'text', 0, 'Title', true); |
|
196 test_form_field ('text', 'id_format', 'select', 1, 'Format', true); |
|
197 test_form_field ('text', 'id_content', 'textarea', 2, 'Content', true); |
|
198 test_form_field ('text', 'id_tags', 'text', 3, 'Tags'); |
|
199 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
|
200 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
201 test_count ('select#id_format option', 3); |
|
202 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
|
203 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
|
204 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
|
205 test_count ('#markItUpId_content li', 20); // How many buttons are in the WYSIWYG editor toolbar ? |
|
206 test_unlogged_footer (); |
|
207 |
|
208 test ('submit empty fields', dsl(function () { |
|
209 elt ('#text input[type="submit"]').click (); |
|
210 browser.waitForPageLoad (); |
|
211 })); |
|
212 test_count ('div.help_text span.error-text', 2); |
|
213 test_form_field ('text div.error', 'id_title', 'text', 0, 'Title', true); |
|
214 test_form_field ('text div.error', 'id_content', 'textarea', 1, 'Content', true); |
|
215 }); |
|
216 |
|
217 suite ('upload text page conformity', function () { |
|
218 test_page_loading ('/create/upload/', 'Upload a text - '+t['#id_workspace_name']); |
|
219 test_logged_header (w.USER_ADMIN); |
|
220 test_default_tabs (t.text_nb, t.user_nb); |
|
221 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
222 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
223 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
|
224 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
225 test_count ('#text form[action="."]:eq(0) :input', 6); |
|
226 test_form_field ('text', 'id_title', 'text', 0, 'Title'); |
|
227 test_form_field ('text', 'id_format', 'select', 1, 'Format', true); |
|
228 test_form_field ('text', 'id_tags', 'text', 2, 'Tags'); |
|
229 test_form_field ('text', 'id_file', 'file', 3, 'Upload file'); |
|
230 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
|
231 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
232 test_count ('select#id_format option', 3); |
|
233 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
|
234 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
|
235 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
|
236 test_unlogged_footer (); |
|
237 |
|
238 test ('submit empty fields', dsl(function () { |
|
239 elt ('#text input[type="submit"]').click (); |
|
240 browser.waitForPageLoad (); |
|
241 })); |
|
242 test_count ('div.help_text span.error-text', 1); |
|
243 test_form_field ('text div.error', 'id_file', 'file', 0, 'Upload file'); |
|
244 test_match ('#text div.help_text:eq(3) span.error-text:eq(0)', /You should specify a file to upload/m); |
|
245 }); |
|
246 |
|
247 suite ('import a co-mented text page conformity', function () { |
|
248 test_page_loading ('/create/import/', 'Import a co-mented text - '+t['#id_workspace_name']); |
|
249 test_logged_header (w.USER_ADMIN); |
|
250 test_default_tabs (t.text_nb, t.user_nb); |
|
251 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
252 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
253 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
|
254 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/upload/"]', 'Upload a text'); |
|
255 test_count ('#text form[action="."]:eq(0) :input', 3); |
|
256 test_form_field ('text', 'id_file', 'file', 0, 'Upload XML file', true); |
|
257 test_val ('#text :input:eq(1)[type=submit]', 'Save'); |
|
258 test_val ('#text :input:eq(2)#cancel_button[type=button]', 'Cancel'); |
|
259 test_unlogged_footer (); |
|
260 |
|
261 test ('submit empty fields', dsl(function () { |
|
262 elt ('#text input[type="submit"]').click (); |
|
263 browser.waitForPageLoad (); |
|
264 })); |
|
265 test_count ('div.help_text span.error-text', 1); |
|
266 test_form_field ('text div.error', 'id_file', 'file', 0, 'Upload XML file', true); |
|
267 test_match ('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m); |
|
268 }); |
|
269 |
|
270 suite.skip ('texts list page conformity', function () { |
|
271 test_page_loading ('/text/', 'Texts\n - '+t['#id_workspace_name']); |
|
272 test_logged_header (w.USER_ADMIN); |
|
273 test_default_tabs (t.text_nb, t.user_nb); |
208 test_count ('#text ul.sub_list:eq(0) a', 3); |
274 test_count ('#text ul.sub_list:eq(0) a', 3); |
209 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
275 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
210 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
276 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
211 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
277 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
212 // TOTEST : filter by tag |
278 // TOTEST : filter by tag |
213 test_count ('form#filter_form[action="."] :input', 1); |
279 test_count ('form#filter_form[action="."] :input', 1); |
214 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
280 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
215 test ('#texts_form input count', dsl (function () { |
281 test_count ('#texts_form :input', 3 + t.text_nb % 10); |
216 elt ('form#texts_form[action="."] :input').count (function (c) { |
282 test_match ('#paginator', new RegExp ('\\s\\d+-\\d+ of '+t.text_nb+'\\s','m')); |
217 var n = 3 + z.text_nb % 10; |
|
218 if (c != n) throw 'expected computed '+n+' to equal got '+c; |
|
219 }); |
|
220 })); |
|
221 test ('#paginator "of #" value', dsl (function () { |
|
222 elt ('span#paginator').text (function (t) { |
|
223 var r = t.match (/\s\d+-\d+ of (\d+)\s/m); |
|
224 if (r.length != 2) throw 'expected 2 matches got '+r.length; |
|
225 if (r[1] != z.text_nb) throw 'expected paginator total ('+r[1]+') to be '+z.text_nb; |
|
226 }); |
|
227 })); |
|
228 // TOTEST : pagination |
283 // TOTEST : pagination |
229 // TOTEST : Bulk Actions -> Apply does enable |
284 // TOTEST : Bulk Actions -> Apply does enable |
230 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible); |
285 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible); |
231 test_text ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible); |
286 test_text ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible); |
232 test_val ('form#texts_form input#apply[type=button][disabled]', 'Apply'); |
287 test_val ('form#texts_form input#apply[type=button][disabled]', 'Apply'); |
238 test_text ('table.large_table:eq(1) th:eq(4)', '# comments'); |
293 test_text ('table.large_table:eq(1) th:eq(4)', '# comments'); |
239 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
294 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
240 test_unlogged_footer (); |
295 test_unlogged_footer (); |
241 }); |
296 }); |
242 |
297 |
243 suite ('create a text page conformity', function () { |
|
244 test_page_loading ('/create/content/', 'Create a text - '+t['#id_workspace_name']); |
|
245 test_logged_header (w.USER_ADMIN); |
|
246 test_default_tabs (); |
|
247 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
248 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
249 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
|
250 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
251 test_count ('#text form[action="."]:eq(0) :input', 6); |
|
252 test_form_field ('text', 'id_title', 'text', 0, 'Title', true); |
|
253 test_form_field ('text', 'id_format', 'select', 1, 'Format', true); |
|
254 test_form_field ('text', 'id_content', 'textarea', 2, 'Content', true); |
|
255 test_form_field ('text', 'id_tags', 'text', 3, 'Tags'); |
|
256 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
|
257 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
258 test_count ('select#id_format option', 3); |
|
259 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
|
260 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
|
261 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
|
262 test_count ('#markItUpId_content li', 20); // How many buttons are in the WYSIWYG editor toolbar ? |
|
263 test_unlogged_footer (); |
|
264 |
|
265 test ('submit empty fields', dsl(function () { |
|
266 elt ('#text input[type="submit"]').click (); |
|
267 browser.waitForPageLoad (); |
|
268 })); |
|
269 test_count ('div.help_text span.error-text', 2); |
|
270 test_form_field ('text div.error', 'id_title', 'text', 0, 'Title', true); |
|
271 test_form_field ('text div.error', 'id_content', 'textarea', 1, 'Content', true); |
|
272 }); |
|
273 |
|
274 suite ('upload text page conformity', function () { |
|
275 test_page_loading ('/create/upload/', 'Upload a text - '+t['#id_workspace_name']); |
|
276 test_logged_header (w.USER_ADMIN); |
|
277 test_default_tabs (); |
|
278 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
279 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
280 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
|
281 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
282 test_count ('#text form[action="."]:eq(0) :input', 6); |
|
283 test_form_field ('text', 'id_title', 'text', 0, 'Title'); |
|
284 test_form_field ('text', 'id_format', 'select', 1, 'Format', true); |
|
285 test_form_field ('text', 'id_tags', 'text', 2, 'Tags'); |
|
286 test_form_field ('text', 'id_file', 'file', 3, 'Upload file'); |
|
287 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
|
288 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
289 test_count ('select#id_format option', 3); |
|
290 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
|
291 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
|
292 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
|
293 test_unlogged_footer (); |
|
294 |
|
295 test ('submit empty fields', dsl(function () { |
|
296 elt ('#text input[type="submit"]').click (); |
|
297 browser.waitForPageLoad (); |
|
298 })); |
|
299 test_count ('div.help_text span.error-text', 1); |
|
300 test_form_field ('text div.error', 'id_file', 'file', 0, 'Upload file'); |
|
301 test_match ('#text div.help_text:eq(3) span.error-text:eq(0)', /You should specify a file to upload/m); |
|
302 }); |
|
303 |
|
304 suite ('import a co-mented text page conformity', function () { |
|
305 test_page_loading ('/create/import/', 'Import a co-mented text - '+t['#id_workspace_name']); |
|
306 test_logged_header (w.USER_ADMIN); |
|
307 test_default_tabs (); |
|
308 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
309 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
310 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
|
311 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/upload/"]', 'Upload a text'); |
|
312 test_count ('#text form[action="."]:eq(0) :input', 3); |
|
313 test_form_field ('text', 'id_file', 'file', 0, 'Upload XML file', true); |
|
314 test_val ('#text :input:eq(1)[type=submit]', 'Save'); |
|
315 test_val ('#text :input:eq(2)#cancel_button[type=button]', 'Cancel'); |
|
316 test_unlogged_footer (); |
|
317 |
|
318 test ('submit empty fields', dsl(function () { |
|
319 elt ('#text input[type="submit"]').click (); |
|
320 browser.waitForPageLoad (); |
|
321 })); |
|
322 test_count ('div.help_text span.error-text', 1); |
|
323 test_form_field ('text div.error', 'id_file', 'file', 0, 'Upload XML file', true); |
|
324 test_match ('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m); |
|
325 }); |
|
326 |
|
327 suite ('edit profile page conformity', function () { |
298 suite ('edit profile page conformity', function () { |
328 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+t['#id_workspace_name']); |
299 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+t['#id_workspace_name']); |
329 test_logged_header (w.USER_ADMIN, no_tagline); |
300 test_logged_header (w.USER_ADMIN, no_tagline); |
330 test_count ('#content ul.sub_list:eq(0) a', 1); |
301 test_count ('#content ul.sub_list:eq(0) a', 1); |
331 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password'); |
302 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password'); |
332 test_count ('form#profile[action="."]:eq(0) :input', 5); |
303 test_count ('form#profile[action="."]:eq(0) :input', 5); |
333 test_form_field ('profile', 'id_email', 'text', 0, 'E-mail address', true); |
304 test_form_field ('profile', 'id_email', 'text', 0, 'E-mail address', true); |
334 test_form_field ('profile', 'id_first_name','text', 1, 'First name'); |
305 test_form_field ('profile', 'id_first_name','text', 1, 'First name'); |
335 test_form_field ('profile', 'id_last_name', 'text', 2, 'Last name'); |
306 test_form_field ('profile', 'id_last_name', 'text', 2, 'Last name'); |
336 test_form_field ('profile', 'id_tags', 'text', 3, 'Tags'); |
307 test_form_field ('profile', 'id_tags', 'text', 3, 'Tags'); |
337 test_val ('#profile :input:eq(4)[type=submit]', 'Save'); |
308 test_val ('#profile :input:eq(4)[type=submit]', 'Save'); |
338 test_unlogged_footer (); |
309 test_unlogged_footer (); |
339 }); |
310 }); |
340 |
311 |
341 suite ('edit password page conformity', function () { |
312 suite ('edit password page conformity', function () { |
342 test_page_loading ('/profile-pw/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+t['#id_workspace_name']); |
313 test_page_loading ('/profile-pw/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+t['#id_workspace_name']); |
343 test_logged_header (w.USER_ADMIN, no_tagline); |
314 test_logged_header (w.USER_ADMIN, no_tagline); |
344 test_count ('#content ul.sub_list:eq(0) a', 1); |
315 test_count ('#content ul.sub_list:eq(0) a', 1); |
345 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile/"]', 'Profile'); |
316 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile/"]', 'Profile'); |
346 test_count ('form#profile[action="."]:eq(0) :input', 4); |
317 test_count ('form#profile[action="."]:eq(0) :input', 4); |
347 test_form_field ('profile', 'id_old_password', 'password', 0, 'Old password', true); |
318 test_form_field ('profile', 'id_old_password', 'password', 0, 'Old password', true); |
348 test_form_field ('profile', 'id_new_password1', 'password', 1, 'New password', true); |
319 test_form_field ('profile', 'id_new_password1', 'password', 1, 'New password', true); |
349 test_form_field ('profile', 'id_new_password2', 'password', 2, 'New password confirmation', true); |
320 test_form_field ('profile', 'id_new_password2', 'password', 2, 'New password confirmation', true); |
350 test_val ('#profile :input:eq(3)[type=submit]', 'Save'); |
321 test_val ('#profile :input:eq(3)[type=submit]', 'Save'); |
351 test_unlogged_footer (); |
322 test_unlogged_footer (); |
352 }); |
323 }); |
353 |
324 |
354 suite ('people list page conformity', function () { |
325 suite ('people list page conformity', function () { |
355 test_page_loading ('/user/', 'People\' list\n - '+t['#id_workspace_name']); |
326 test_page_loading ('/user/', 'People\' list\n - '+t['#id_workspace_name']); |
356 test_logged_header (w.USER_ADMIN); |
327 test_logged_header (w.USER_ADMIN); |
357 test_default_tabs (); |
328 test_default_tabs (t.text_nb, t.user_nb); |
358 test_count ('#user ul.sub_list:eq(0) a', 2); |
329 test_count ('#user ul.sub_list:eq(0) a', 2); |
359 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user'); |
330 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user'); |
360 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
331 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
361 // TOTEST : filter by tag -> commentator user should be tagged commentator |
332 // TOTEST : filter by tag -> commentator user should be tagged commentator |
362 test_count ('form#filter_form[action="."] :input', 1); |
333 test_count ('form#filter_form[action="."] :input', 1); |
363 test_text ('#filter_form a[href="?display=1"]', 'Display suspended users'); |
334 test_text ('#filter_form a[href="?display=1"]', 'Display suspended users'); |
364 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
335 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
365 // TOTEST : pagination |
336 // TOTEST : pagination |
366 // TOTEST : Bulk Actions -> Apply does enable |
337 // TOTEST : Bulk Actions -> Apply does enable |
367 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', '- Bulk Actions -', non_visible); |
338 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', '- Bulk Actions -', non_visible); |
368 test_text ('select#bulk_actions option:eq(1)[value="disable"]', 'Suspend access', non_visible); |
339 test_text ('select#bulk_actions option:eq(1)[value="disable"]', 'Suspend access', non_visible); |
369 test_text ('select#bulk_actions option:eq(2)[value="enable"]', 'Enable access', non_visible); |
340 test_text ('select#bulk_actions option:eq(2)[value="enable"]', 'Enable access', non_visible); |
370 test_text ('select#bulk_actions option:eq(3)[value="role_1"]', 'Change role to Manager', non_visible); |
341 test_text ('select#bulk_actions option:eq(3)[value="role_1"]', 'Change role to Manager', non_visible); |
371 test_text ('select#bulk_actions option:eq(4)[value="role_2"]', 'Change role to Editor', non_visible); |
342 test_text ('select#bulk_actions option:eq(4)[value="role_2"]', 'Change role to Editor', non_visible); |
372 test_text ('select#bulk_actions option:eq(5)[value="role_3"]', 'Change role to Moderator', non_visible); |
343 test_text ('select#bulk_actions option:eq(5)[value="role_3"]', 'Change role to Moderator', non_visible); |
373 test_text ('select#bulk_actions option:eq(6)[value="role_4"]', 'Change role to Commentator', non_visible); |
344 test_text ('select#bulk_actions option:eq(6)[value="role_4"]', 'Change role to Commentator', non_visible); |
374 test_text ('select#bulk_actions option:eq(7)[value="role_5"]', 'Change role to Observer', non_visible); |
345 test_text ('select#bulk_actions option:eq(7)[value="role_5"]', 'Change role to Observer', non_visible); |
375 test_val ('form#user_form input#apply[type=button][disabled]', 'Apply'); |
346 test_val ('form#user_form input#apply[type=button][disabled]', 'Apply'); |
376 test_count ('table.large_table:eq(1) th', 6); |
347 test_count ('table.large_table:eq(1) th', 6); |
377 test_val ('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on'); |
348 test_val ('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on'); |
378 test_text ('table.large_table:eq(1) th:eq(1) a[href="?order=user__username"]', 'User'); |
349 test_text ('table.large_table:eq(1) th:eq(1) a[href="?order=user__username"]', 'User'); |
379 test_text ('table.large_table:eq(1) th:eq(2) a[href="?order=user__email"]', 'Email'); |
350 test_text ('table.large_table:eq(1) th:eq(2) a[href="?order=user__email"]', 'Email'); |
380 test_text ('table.large_table:eq(1) th:eq(3) a[href="?order=-user__date_joined"]', 'Date joined'); |
351 test_text ('table.large_table:eq(1) th:eq(3) a[href="?order=-user__date_joined"]', 'Date joined'); |
381 test_text ('table.large_table:eq(1) th:eq(4) a[href="?order=role__name"]', 'Role'); |
352 test_text ('table.large_table:eq(1) th:eq(4) a[href="?order=role__name"]', 'Role'); |
382 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
353 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
383 test_text ('table.large_table:eq(1) tr:last a[href="/user/-/edit/"]', 'Anonymous users'); |
354 test_text ('table.large_table:eq(1) tr:last a[href="/user/-/edit/"]', 'Anonymous users'); |
384 test_text ('table.large_table:eq(1) a.main_object_title[href="/profile/"]', w.USER_ADMIN); |
355 test_text ('table.large_table:eq(1) a.main_object_title[href="/profile/"]', w.USER_ADMIN); |
385 test_text ('table.large_table:eq(1) div.hidden-user-actions a[href="/profile/"]', 'Your profile'); |
356 test_text ('table.large_table:eq(1) div.hidden-user-actions a[href="/profile/"]', 'Your profile'); |
386 // TOTEST presence of commentator and editor user |
357 // TOTEST presence of commentator and editor user |
387 test_unlogged_footer (); |
358 test_unlogged_footer (); |
388 }); |
359 }); |
389 |
360 |
390 suite ('check user number', function () { |
361 suite ('check user number', function () { |
391 test_page_loading ('/user/?display=1', 'People\' list\n - '+t['#id_workspace_name']); |
362 test_page_loading ('/user/?display=1', 'People\' list\n - '+t['#id_workspace_name']); |
392 test ('#user_form input count', dsl (function () { |
363 test_count ('#user_form :input', 6 + (t.user_nb % 10) * 2); |
393 elt ('form#user_form[action="."] :input').count (function (c) { |
364 test_match ('#paginator', new RegExp ('\\s\\d+-\\d+ of '+t.user_nb+'\\s','m')); |
394 var n = 6 + (z.user_nb % 10) * 2; |
365 }); |
395 if (c != n) throw 'expected computed '+n+' to equal got '+c; |
|
396 }); |
|
397 })); |
|
398 test ('#paginator "of #" value', dsl (function () { |
|
399 elt ('span#paginator').text (function (t) { |
|
400 var r = t.match (/\s\d+-\d+ of (\d+)\s/m); |
|
401 if (r.length != 2) throw 'expected 2 matches got '+r.length; |
|
402 if (r[1] != z.user_nb) throw 'expected paginator total ('+r[1]+') to be '+z.user_nb; |
|
403 }); |
|
404 })); |
|
405 }); |
|
406 |
366 |
407 suite ('add a user page conformity', function () { |
367 suite ('add a user page conformity', function () { |
408 test_page_loading ('/user/add/', 'Add a new user\n - '+t['#id_workspace_name']); |
368 test_page_loading ('/user/add/', 'Add a new user\n - '+t['#id_workspace_name']); |
409 test_logged_header (w.USER_ADMIN); |
369 test_logged_header (w.USER_ADMIN); |
410 test_default_tabs (); |
370 test_default_tabs (t.text_nb, t.user_nb); |
411 test_count ('#user ul.sub_list:eq(0) a', 2); |
371 test_count ('#user ul.sub_list:eq(0) a', 2); |
412 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
372 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
413 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
373 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
414 test_count ('#user form[action="."]:eq(0) :input', 8); |
374 test_count ('#user form[action="."]:eq(0) :input', 8); |
415 test_form_field ('user', 'id_email', 'text', 0, 'E-mail address', true); |
375 test_form_field ('user', 'id_email', 'text', 0, 'E-mail address', true); |
416 test_form_field ('user', 'id_first_name', 'text', 1, 'First name'); |
376 test_form_field ('user', 'id_first_name', 'text', 1, 'First name'); |
417 test_form_field ('user', 'id_last_name', 'text', 2, 'Last name'); |
377 test_form_field ('user', 'id_last_name', 'text', 2, 'Last name'); |
418 test_form_field ('user', 'id_tags', 'text', 3, 'Tags'); |
378 test_form_field ('user', 'id_tags', 'text', 3, 'Tags'); |
419 test_form_field ('user', 'id_role', 'select', 4, 'Workspace level role'); |
379 test_form_field ('user', 'id_role', 'select', 4, 'Workspace level role'); |
420 test_form_field ('user', 'id_note', 'textarea', 5, 'Note'); |
380 test_form_field ('user', 'id_note', 'textarea', 5, 'Note'); |
421 test_count ('select#id_role option', 6); |
381 test_count ('select#id_role option', 6); |
422 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
382 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
423 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
383 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
424 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
384 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
425 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
385 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
426 test_text ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible); |
386 test_text ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible); |
427 test_text ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible); |
387 test_text ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible); |
428 test_val ('#user :input:eq(6)[type=submit]', 'Add user'); |
388 test_val ('#user :input:eq(6)[type=submit]', 'Add user'); |
429 test_val ('#user :input:eq(7)#cancel_button[type=button]', 'Cancel'); |
389 test_val ('#user :input:eq(7)#cancel_button[type=button]', 'Cancel'); |
430 test_unlogged_footer (); |
390 test_unlogged_footer (); |
431 |
391 |
432 test ('submit empty fields', dsl(function () { |
392 test ('submit empty fields', dsl(function () { |
433 elt ('#user input[type="submit"]').click (); |
393 elt ('#user input[type="submit"]').click (); |
434 browser.waitForPageLoad (); |
394 browser.waitForPageLoad (); |
435 })); |
395 })); |
436 test_count ('div.help_text span.error-text', 1); |
396 test_count ('div.help_text span.error-text', 1); |
437 test_form_field ('user div.error', 'id_email', 'text', 0, 'E-mail address', true); |
397 test_form_field ('user div.error', 'id_email', 'text', 0, 'E-mail address', true); |
438 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
398 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
439 // X TOTEST add user (pending) |
399 // X TOTEST add user (pending) |
440 }); |
400 }); |
441 |
401 |
442 suite ('add users in bulk page conformity', function () { |
402 suite ('add users in bulk page conformity', function () { |
443 test_page_loading ('/user/mass-add/', 'Add users in bulk\n - '+t['#id_workspace_name']); |
403 test_page_loading ('/user/mass-add/', 'Add users in bulk\n - '+t['#id_workspace_name']); |
444 test_logged_header (w.USER_ADMIN); |
404 test_logged_header (w.USER_ADMIN); |
445 test_default_tabs (); |
405 test_default_tabs (t.text_nb, t.user_nb); |
446 test_count ('#user ul.sub_list:eq(0) a', 2); |
406 test_count ('#user ul.sub_list:eq(0) a', 2); |
447 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
407 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
448 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/add/"]', 'Add a new user'); |
408 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/add/"]', 'Add a new user'); |
449 test_count ('#user form[action="."]:eq(0) :input', 6); |
409 test_count ('#user form[action="."]:eq(0) :input', 6); |
450 test_form_field ('user', 'id_email', 'textarea', 0, 'Emails', true); |
410 test_form_field ('user', 'id_email', 'textarea', 0, 'Emails', true); |
451 test_form_field ('user', 'id_tags', 'text', 1, 'Tags'); |
411 test_form_field ('user', 'id_tags', 'text', 1, 'Tags'); |
452 test_form_field ('user', 'id_role', 'select', 2, 'Workspace level role'); |
412 test_form_field ('user', 'id_role', 'select', 2, 'Workspace level role'); |
453 test_form_field ('user', 'id_note', 'textarea', 3, 'Note'); |
413 test_form_field ('user', 'id_note', 'textarea', 3, 'Note'); |
454 test_count ('select#id_role option', 6); |
414 test_count ('select#id_role option', 6); |
455 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
415 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
456 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
416 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
457 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
417 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
458 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
418 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
459 test_text ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible); |
419 test_text ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible); |
460 test_text ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible); |
420 test_text ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible); |
461 test_val ('#user :input:eq(4)[type=submit]', 'Add users'); |
421 test_val ('#user :input:eq(4)[type=submit]', 'Add users'); |
462 test_val ('#user :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
422 test_val ('#user :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
463 // X TOTEST add users (pending) -> can't be deleted |
423 // X TOTEST add users (pending) -> can't be deleted |
464 test_unlogged_footer (); |
424 test_unlogged_footer (); |
465 |
425 |
466 test ('submit empty fields', dsl(function () { |
426 test ('submit empty fields', dsl(function () { |
467 elt ('#user input[type="submit"]').click (); |
427 elt ('#user input[type="submit"]').click (); |
468 browser.waitForPageLoad (); |
428 browser.waitForPageLoad (); |
469 })); |
429 })); |
470 test_count ('div.help_text span.error-text', 1); |
430 test_count ('div.help_text span.error-text', 1); |
471 test_form_field ('user div.error', 'id_email', 'textarea', 0, 'Emails', true); |
431 test_form_field ('user div.error', 'id_email', 'textarea', 0, 'Emails', true); |
472 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
432 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
473 }); |
433 }); |
474 |
434 |
475 suite ('settings page conformity', function () { |
435 suite ('settings page conformity', function () { |
476 test_page_loading ('/settings/', 'Settings - '+t['#id_workspace_name']); |
436 test_page_loading ('/settings/', 'Settings - '+t['#id_workspace_name']); |
477 test_logged_header (w.USER_ADMIN); |
437 test_logged_header (w.USER_ADMIN); |
478 test_default_tabs (); |
438 test_default_tabs (t.text_nb, t.user_nb); |
479 test_count ('#settings ul.sub_list:eq(0) a', 1); |
439 test_count ('#settings ul.sub_list:eq(0) a', 1); |
480 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/design/"]', 'Appearance'); |
440 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/design/"]', 'Appearance'); |
481 test_count ('#settings form[action="."]:eq(0) :input', 12); |
441 test_count ('#settings form[action="."]:eq(0) :input', 12); |
482 test_form_field ('settings', 'id_workspace_name', 'text', 0, 'Workspace name'); |
442 test_form_field ('settings', 'id_workspace_name', 'text', 0, 'Workspace name'); |
483 test_form_field ('settings', 'id_workspace_tagline', 'text', 1, 'Workspace tagline'); |
443 test_form_field ('settings', 'id_workspace_tagline', 'text', 1, 'Workspace tagline'); |
484 test_form_field ('settings', 'id_workspace_registration', 'checkbox', 2, 'Workspace registration'); |
444 test_form_field ('settings', 'id_workspace_registration', 'checkbox', 2, 'Workspace registration'); |
485 test_form_field ('settings', 'id_workspace_registration_moderation', 'checkbox', 3, 'Workspace registration moderation'); |
445 test_form_field ('settings', 'id_workspace_registration_moderation', 'checkbox', 3, 'Workspace registration moderation'); |
486 test_form_field ('settings', 'id_workspace_role_model', 'select', 4, 'Role model'); |
446 test_form_field ('settings', 'id_workspace_role_model', 'select', 4, 'Role model'); |
487 test_text ('select#id_workspace_role_model option:eq(0)[selected][value="generic"]', 'Generic', non_visible); |
447 test_text ('select#id_workspace_role_model option:eq(0)[selected][value="generic"]', 'Generic', non_visible); |
488 test_text ('select#id_workspace_role_model option:eq(1)[value="teacher"]', 'Class (education)', non_visible); |
448 test_text ('select#id_workspace_role_model option:eq(1)[value="teacher"]', 'Class (education)', non_visible); |
489 test_form_field ('settings', 'id_workspace_category_1', 'text', 5, 'Label for the first category of comments'); |
449 test_form_field ('settings', 'id_workspace_category_1', 'text', 5, 'Label for the first category of comments'); |
490 test_form_field ('settings', 'id_workspace_category_2', 'text', 6, 'Label for the second category of comments'); |
450 test_form_field ('settings', 'id_workspace_category_2', 'text', 6, 'Label for the second category of comments'); |
491 test_form_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments'); |
451 test_form_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments'); |
492 test_form_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments'); |
452 test_form_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments'); |
493 test_form_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments'); |
453 test_form_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments'); |
494 test_val ('#settings :input:eq(10)[type=submit]', 'Save'); |
454 test_val ('#settings :input:eq(10)[type=submit]', 'Save'); |
495 test_val ('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel'); |
455 test_val ('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel'); |
496 // TOTEST Workspace registration feature (with newly accessible page) |
456 // TOTEST Workspace registration feature (with newly accessible page) |
497 test_unlogged_footer (); |
457 test_unlogged_footer (); |
498 }); |
458 }); |
499 |
459 |
500 suite ('settings design page conformity', function () { |
460 suite ('settings design page conformity', function () { |
501 test_page_loading ('/settings/design/', 'Settings - '+t['#id_workspace_name']); |
461 test_page_loading ('/settings/design/', 'Settings - '+t['#id_workspace_name']); |
502 test_logged_header (w.USER_ADMIN); |
462 test_logged_header (w.USER_ADMIN); |
503 test_default_tabs (); |
463 test_default_tabs (t.text_nb, t.user_nb); |
504 test_count ('#settings ul.sub_list:eq(0) a', 1); |
464 test_count ('#settings ul.sub_list:eq(0) a', 1); |
505 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/"]', 'General'); |
465 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/"]', 'General'); |
506 test_count ('#settings form[action="."]:eq(0) :input', 7); |
466 test_count ('#settings form[action="."]:eq(0) :input', 7); |
507 test_form_field ('settings', 'id_workspace_logo_file', 'file', 0, 'Workspace logo'); |
467 test_form_field ('settings', 'id_workspace_logo_file', 'file', 0, 'Workspace logo'); |
508 test_form_field ('settings', 'id_custom_css', 'textarea', 1, 'Custom CSS rules'); |
468 test_form_field ('settings', 'id_custom_css', 'textarea', 1, 'Custom CSS rules'); |
509 test_form_field ('settings', 'id_custom_font', 'text', 2, 'Custom font'); |
469 test_form_field ('settings', 'id_custom_font', 'text', 2, 'Custom font'); |
510 test_form_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles'); |
470 test_form_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles'); |
511 test_val ('#settings :input:eq(4)[type=submit]', 'Save'); |
471 test_val ('#settings :input:eq(4)[type=submit]', 'Save'); |
512 test_val ('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
472 test_val ('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
513 test_val ('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo'); |
473 test_val ('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo'); |
514 test_unlogged_footer (); |
474 test_unlogged_footer (); |
515 }); |
475 }); |
516 |
476 |
517 suite ('followup page conformity', function () { |
477 suite ('followup page conformity', function () { |
518 test_page_loading ('/followup/', 'Followup\n - '+t['#id_workspace_name']); |
478 test_page_loading ('/followup/', 'Followup\n - '+t['#id_workspace_name']); |
519 test_logged_header (w.USER_ADMIN); |
479 test_logged_header (w.USER_ADMIN); |
520 test_default_tabs (); |
480 test_default_tabs (t.text_nb, t.user_nb); |
521 test_text ('#followup a:eq(0)[href="/help/#public_private_feed"]', '?'); |
481 test_text ('#followup a:eq(0)[href="/help/#public_private_feed"]', '?'); |
522 test_match ('#followup a:eq(1)[href$="/feed/"]', new RegExp (w.WORKSPACE_URL+'feed/', 'm')); |
482 test_match ('#followup a:eq(1)[href$="/feed/"]', new RegExp (w.WORKSPACE_URL+'feed/', 'm')); |
523 test_text ('#followup a:eq(2)[href="/help/#public_private_feed"]', '?'); |
483 test_text ('#followup a:eq(2)[href="/help/#public_private_feed"]', '?'); |
524 test_count ('form#followup_form[action="."] :input', 3); |
484 test_count ('form#followup_form[action="."] :input', 3); |
525 test_val ('form#followup_form input[type=submit]', '(Activate private feed|Reset private feed url)'); |
485 test_val ('form#followup_form input[type=submit]', '(Activate private feed|Reset private feed url)'); |