122 test_count ('#text ul.sub_list:eq(0) a', 3); |
122 test_count ('#text ul.sub_list:eq(0) a', 3); |
123 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
123 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
124 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
124 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
125 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
125 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
126 test_count ('#text form[action="."]:eq(0) :input', 6); |
126 test_count ('#text form[action="."]:eq(0) :input', 6); |
127 test_field ('text', 'id_title', 'text', 0, 'Title', true); |
127 test_field ('text', 'id_title', 'text', 0, 'Title', true); |
128 test_field ('text', 'id_format', 'select', 1, 'Format', true); |
128 test_field ('text', 'id_format', 'select', 1, 'Format', true); |
129 test_field ('text', 'id_content', 'textarea', 2, 'Content', true); |
129 test_field ('text', 'id_content', 'textarea', 2, 'Content', true); |
130 test_field ('text', 'id_tags', 'text', 3, 'Tags'); |
130 test_field ('text', 'id_tags', 'text', 3, 'Tags'); |
131 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
131 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
132 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
132 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
133 test_count ('select#id_format option', 3); |
133 test_count ('select#id_format option', 3); |
134 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
134 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
135 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
135 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
136 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
136 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
137 test_count ('.markdown #markItUpId_content li', 20); // How many buttons in the WYSIWYG editor toolbar ? |
137 test_count ('.markdown #markItUpId_content li', 20); // How many buttons in the WYSIWYG editor toolbar ? |
138 test_unlogged_footer (); |
138 test_unlogged_footer (); |
139 test_submit('#text input[type="submit"]'); |
139 test_submit('#text input[type="submit"]'); |
140 test_count ('div.help_text span.error-text', 2); |
140 test_count ('div.help_text span.error-text', 2); |
141 test_field ('text div.error', 'id_title', 'text', 0, 'Title', true); |
141 test_field ('text div.error', 'id_title', 'text', 0, 'Title', true); |
142 test_field ('text div.error', 'id_content', 'textarea', 1, 'Content', true); |
142 test_field ('text div.error', 'id_content', 'textarea', 1, 'Content', true); |
143 }); |
143 }); |
144 |
144 |
145 suite ('upload text page conformity', function () { |
145 suite ('upload text page conformity', function () { |
146 test_page_loading ('/create/upload/', 'Upload a text - '+c['#id_workspace_name']); |
146 test_page_loading ('/create/upload/', 'Upload a text - '+c['#id_workspace_name']); |
147 test_logged_header (w.USER_ADMIN); |
147 test_logged_header (w.USER_ADMIN); |
149 test_count ('#text ul.sub_list:eq(0) a', 3); |
149 test_count ('#text ul.sub_list:eq(0) a', 3); |
150 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
150 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
151 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
151 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
152 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
152 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
153 test_count ('#text form[action="."]:eq(0) :input', 6); |
153 test_count ('#text form[action="."]:eq(0) :input', 6); |
154 test_field ('text', 'id_title', 'text', 0, 'Title'); |
154 test_field ('text', 'id_title', 'text', 0, 'Title'); |
155 test_field ('text', 'id_format', 'select', 1, 'Format', true); |
155 test_field ('text', 'id_format', 'select', 1, 'Format', true); |
156 test_field ('text', 'id_tags', 'text', 2, 'Tags'); |
156 test_field ('text', 'id_tags', 'text', 2, 'Tags'); |
157 test_field ('text', 'id_file', 'file', 3, 'Upload file'); |
157 test_field ('text', 'id_file', 'file', 3, 'Upload file'); |
158 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
158 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
159 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
159 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
160 test_count ('select#id_format option', 3); |
160 test_count ('select#id_format option', 3); |
161 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
161 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
162 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
162 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
163 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
163 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
164 test_unlogged_footer (); |
164 test_unlogged_footer (); |
165 test_submit('#text input[type="submit"]'); |
165 test_submit('#text input[type="submit"]'); |
166 test_count ('div.help_text span.error-text', 1); |
166 test_count ('div.help_text span.error-text', 1); |
167 test_field ('text div.error', 'id_file', 'file', 0, 'Upload file'); |
167 test_field ('text div.error', 'id_file', 'file', 0, 'Upload file'); |
168 test_match ('#text div.help_text:eq(3) span.error-text:eq(0)', /You should specify a file to upload/m); |
168 test_match ('#text div.help_text:eq(3) span.error-text:eq(0)', /You should specify a file to upload/m); |
169 }); |
169 }); |
170 |
170 |
171 suite ('import a co-mented text page conformity', function () { |
171 suite ('import a co-mented text page conformity', function () { |
172 test_page_loading ('/create/import/', 'Import a co-mented text - '+c['#id_workspace_name']); |
172 test_page_loading ('/create/import/', 'Import a co-mented text - '+c['#id_workspace_name']); |
175 test_count ('#text ul.sub_list:eq(0) a', 3); |
175 test_count ('#text ul.sub_list:eq(0) a', 3); |
176 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
176 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
177 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
177 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
178 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/upload/"]', 'Upload a text'); |
178 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/upload/"]', 'Upload a text'); |
179 test_count ('#text form[action="."]:eq(0) :input', 3); |
179 test_count ('#text form[action="."]:eq(0) :input', 3); |
180 test_field ('text', 'id_file', 'file', 0, 'Upload XML file', true); |
180 test_field ('text', 'id_file', 'file', 0, 'Upload XML file', true); |
181 test_val ('#text :input:eq(1)[type=submit]', 'Save'); |
181 test_val ('#text :input:eq(1)[type=submit]', 'Save'); |
182 test_val ('#text :input:eq(2)#cancel_button[type=button]', 'Cancel'); |
182 test_val ('#text :input:eq(2)#cancel_button[type=button]', 'Cancel'); |
183 test_unlogged_footer (); |
183 test_unlogged_footer (); |
184 test_submit('#text input[type="submit"]'); |
184 test_submit('#text input[type="submit"]'); |
185 test_count ('div.help_text span.error-text', 1); |
185 test_count ('div.help_text span.error-text', 1); |
186 test_field ('text div.error', 'id_file', 'file', 0, 'Upload XML file', true); |
186 test_field ('text div.error', 'id_file', 'file', 0, 'Upload XML file', true); |
187 test_match ('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m); |
187 test_match ('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m); |
188 }); |
188 }); |
189 |
189 |
190 suite.skip ('create texts', function () { |
190 suite.skip ('create texts', function () { |
191 /* for (var j=4; j--;) |
191 /* for (var j=4; j--;) |
215 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
215 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
216 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
216 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text'); |
217 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
217 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
218 test_count ('form#filter_form[action="."] :input', 1); |
218 test_count ('form#filter_form[action="."] :input', 1); |
219 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
219 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
|
220 test_page_loading ('/text/?tag_selected=Text+Troisième', 'Texts\n - '+c['#id_workspace_name']); |
|
221 test_count ('#texts_form :input', 4 + 3); |
|
222 test_match ('#paginator', /\s1-4 of 4\s/m); |
|
223 |
|
224 for (var i=4; i--;) { |
|
225 test_text ('a.main_object_title:eq('+i+')', c.texts[2]['#id_title']); |
|
226 test_match ('.tag_list:eq('+i+')', /tags: test_text Text Troisième /); |
|
227 test_text ('.tag_list:eq('+i+') a:eq(0)[href="?tag_selected=test_text"]', 'test_text'); |
|
228 test_text ('.tag_list:eq('+i+') a:eq(1)[href="?tag_selected=Text+Troisi%C3%A8me"]','Text Troisième'); |
|
229 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(0)[href^="/text/"][href$="/view/"]', 'View'); |
|
230 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(1)[href^="/text/"][href$="/edit/"]', 'Edit'); |
|
231 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(2)[href$="#"][id*=delete]', 'Delete'); |
|
232 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(3)[href^="/text/"][href$="/share/"]', 'Users'); |
|
233 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(4)[href^="/text/"][href$="/settings/"]', 'Settings'); |
|
234 test_text ('#text a[title="Edit user"][href^="/user/"][href$="/edit/"]:eq('+i+')', 'admin'); |
|
235 test_text ('#text table[summary="text list"] tr:eq('+(i+1)+') td:eq(4)', '0'); |
|
236 } |
|
237 |
|
238 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
220 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
239 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
221 test_match ('#paginator', new RegExp ('\\s\\d+-\\d+ of '+t.text_nb+'\\s','m')); |
240 test_match ('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m')); |
222 test_text ('#paginator a:eq(0)[href="?page=2"]', '»'); |
241 test_text ('#paginator a:eq(0)[href="?page=2"]', '»'); |
223 test_text ('#paginator a:eq(1)[href="?paginate=0"]', 'all'); |
242 test_text ('#paginator a:eq(1)[href="?paginate=0"]', 'all'); |
224 test_click ('#paginator a:eq(0)[href="?page=2"]'); |
243 test_click ('#paginator a:eq(0)[href="?page=2"]'); |
|
244 test_match ('#paginator', new RegExp ('\\s11-12 of '+t.text_nb+'\\s','m')); |
225 test_count ('#texts_form :input', t.text_nb % 10 + 3); |
245 test_count ('#texts_form :input', t.text_nb % 10 + 3); |
226 test_click ('#paginator a:eq(0)[href="?page=1"]'); |
246 test_click ('#paginator a:eq(0)[href="?page=1"]'); |
|
247 test_match ('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m')); |
227 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
248 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
228 test_click ('#paginator a:eq(1)[href="?paginate=0&page=1"]'); |
249 test_click ('#paginator a:eq(1)[href="?paginate=0&page=1"]'); |
|
250 test_match ('#paginator', /\s\(paginate\)\s/m); |
229 test_count ('#texts_form :input', t.text_nb + 3); |
251 test_count ('#texts_form :input', t.text_nb + 3); |
230 test_click ('#paginator a:eq(0)[href="?paginate=&page=1"]'); |
252 test_click ('#paginator a:eq(0)[href="?paginate=&page=1"]'); |
231 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
253 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
232 |
254 test_match ('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m')); |
233 |
255 |
234 // TOTEST : pagination |
|
235 // TOTEST : filter by tag |
|
236 // TOTEST : Bulk Actions -> Apply does enable |
256 // TOTEST : Bulk Actions -> Apply does enable |
|
257 // TOTEST : unitary delete |
237 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
258 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
238 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible); |
259 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible); |
239 test_text ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible); |
260 test_text ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible); |
240 test_val ('form#texts_form input#apply[type=button][disabled]', 'Apply'); |
261 test_val ('form#texts_form input#apply[type=button][disabled]', 'Apply'); |
241 test_count ('table.large_table:eq(1) th', 6); |
262 test_count ('table.large_table:eq(1) th', 6); |
252 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']); |
273 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']); |
253 test_logged_header (w.USER_ADMIN, no_tagline); |
274 test_logged_header (w.USER_ADMIN, no_tagline); |
254 test_count ('#content ul.sub_list:eq(0) a', 1); |
275 test_count ('#content ul.sub_list:eq(0) a', 1); |
255 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password'); |
276 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password'); |
256 test_count ('form#profile[action="."]:eq(0) :input', 5); |
277 test_count ('form#profile[action="."]:eq(0) :input', 5); |
257 test_field ('profile', 'id_email', 'text', 0, 'E-mail address', true); |
278 test_field ('profile', 'id_email', 'text', 0, 'E-mail address', true); |
258 test_field ('profile', 'id_first_name','text', 1, 'First name'); |
279 test_field ('profile', 'id_first_name','text', 1, 'First name'); |
259 test_field ('profile', 'id_last_name', 'text', 2, 'Last name'); |
280 test_field ('profile', 'id_last_name', 'text', 2, 'Last name'); |
260 test_field ('profile', 'id_tags', 'text', 3, 'Tags'); |
281 test_field ('profile', 'id_tags', 'text', 3, 'Tags'); |
261 test_val ('#profile :input:eq(4)[type=submit]', 'Save'); |
282 test_val ('#profile :input:eq(4)[type=submit]', 'Save'); |
262 test_unlogged_footer (); |
283 test_unlogged_footer (); |
263 }); |
284 }); |
264 |
285 |
265 suite ('edit password page conformity', function () { |
286 suite ('edit password page conformity', function () { |
266 test_page_loading ('/profile-pw/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']); |
287 test_page_loading ('/profile-pw/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']); |
267 test_logged_header (w.USER_ADMIN, no_tagline); |
288 test_logged_header (w.USER_ADMIN, no_tagline); |
268 test_count ('#content ul.sub_list:eq(0) a', 1); |
289 test_count ('#content ul.sub_list:eq(0) a', 1); |
269 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile/"]', 'Profile'); |
290 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile/"]', 'Profile'); |
270 test_count ('form#profile[action="."]:eq(0) :input', 4); |
291 test_count ('form#profile[action="."]:eq(0) :input', 4); |
271 test_field ('profile', 'id_old_password', 'password', 0, 'Old password', true); |
292 test_field ('profile', 'id_old_password', 'password', 0, 'Old password', true); |
272 test_field ('profile', 'id_new_password1', 'password', 1, 'New password', true); |
293 test_field ('profile', 'id_new_password1', 'password', 1, 'New password', true); |
273 test_field ('profile', 'id_new_password2', 'password', 2, 'New password confirmation', true); |
294 test_field ('profile', 'id_new_password2', 'password', 2, 'New password confirmation', true); |
274 test_val ('#profile :input:eq(3)[type=submit]', 'Save'); |
295 test_val ('#profile :input:eq(3)[type=submit]', 'Save'); |
275 test_unlogged_footer (); |
296 test_unlogged_footer (); |
276 }); |
297 }); |
277 |
298 |
278 suite ('people list page conformity', function () { |
299 suite ('people list page conformity', function () { |
324 test_default_tabs (t.text_nb, t.user_nb); |
345 test_default_tabs (t.text_nb, t.user_nb); |
325 test_count ('#user ul.sub_list:eq(0) a', 2); |
346 test_count ('#user ul.sub_list:eq(0) a', 2); |
326 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
347 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
327 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
348 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
328 test_count ('#user form[action="."]:eq(0) :input', 8); |
349 test_count ('#user form[action="."]:eq(0) :input', 8); |
329 test_field ('user', 'id_email', 'text', 0, 'E-mail address', true); |
350 test_field ('user', 'id_email', 'text', 0, 'E-mail address', true); |
330 test_field ('user', 'id_first_name', 'text', 1, 'First name'); |
351 test_field ('user', 'id_first_name', 'text', 1, 'First name'); |
331 test_field ('user', 'id_last_name', 'text', 2, 'Last name'); |
352 test_field ('user', 'id_last_name', 'text', 2, 'Last name'); |
332 test_field ('user', 'id_tags', 'text', 3, 'Tags'); |
353 test_field ('user', 'id_tags', 'text', 3, 'Tags'); |
333 test_field ('user', 'id_role', 'select', 4, 'Workspace level role'); |
354 test_field ('user', 'id_role', 'select', 4, 'Workspace level role'); |
334 test_field ('user', 'id_note', 'textarea', 5, 'Note'); |
355 test_field ('user', 'id_note', 'textarea', 5, 'Note'); |
335 test_count ('select#id_role option', 6); |
356 test_count ('select#id_role option', 6); |
336 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
357 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
337 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
358 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
338 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
359 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
339 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
360 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
342 test_val ('#user :input:eq(6)[type=submit]', 'Add user'); |
363 test_val ('#user :input:eq(6)[type=submit]', 'Add user'); |
343 test_val ('#user :input:eq(7)#cancel_button[type=button]', 'Cancel'); |
364 test_val ('#user :input:eq(7)#cancel_button[type=button]', 'Cancel'); |
344 test_unlogged_footer (); |
365 test_unlogged_footer (); |
345 test_submit('#user input[type="submit"]'); |
366 test_submit('#user input[type="submit"]'); |
346 test_count ('div.help_text span.error-text', 1); |
367 test_count ('div.help_text span.error-text', 1); |
347 test_field ('user div.error', 'id_email', 'text', 0, 'E-mail address', true); |
368 test_field ('user div.error', 'id_email', 'text', 0, 'E-mail address', true); |
348 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
369 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
349 // X TOTEST add user (pending) |
370 // X TOTEST add user (pending) |
350 }); |
371 }); |
351 |
372 |
352 suite ('add-users-in-bulk page conformity', function () { |
373 suite ('add-users-in-bulk page conformity', function () { |
355 test_default_tabs (t.text_nb, t.user_nb); |
376 test_default_tabs (t.text_nb, t.user_nb); |
356 test_count ('#user ul.sub_list:eq(0) a', 2); |
377 test_count ('#user ul.sub_list:eq(0) a', 2); |
357 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
378 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
358 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/add/"]', 'Add a new user'); |
379 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/add/"]', 'Add a new user'); |
359 test_count ('#user form[action="."]:eq(0) :input', 6); |
380 test_count ('#user form[action="."]:eq(0) :input', 6); |
360 test_field ('user', 'id_email', 'textarea', 0, 'Emails', true); |
381 test_field ('user', 'id_email', 'textarea', 0, 'Emails', true); |
361 test_field ('user', 'id_tags', 'text', 1, 'Tags'); |
382 test_field ('user', 'id_tags', 'text', 1, 'Tags'); |
362 test_field ('user', 'id_role', 'select', 2, 'Workspace level role'); |
383 test_field ('user', 'id_role', 'select', 2, 'Workspace level role'); |
363 test_field ('user', 'id_note', 'textarea', 3, 'Note'); |
384 test_field ('user', 'id_note', 'textarea', 3, 'Note'); |
364 test_count ('select#id_role option', 6); |
385 test_count ('select#id_role option', 6); |
365 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
386 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
366 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
387 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
367 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
388 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
368 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
389 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
372 test_val ('#user :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
393 test_val ('#user :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
373 // X TOTEST add users (pending) -> can't be deleted |
394 // X TOTEST add users (pending) -> can't be deleted |
374 test_unlogged_footer (); |
395 test_unlogged_footer (); |
375 test_submit('#user input[type="submit"]'); |
396 test_submit('#user input[type="submit"]'); |
376 test_count ('div.help_text span.error-text', 1); |
397 test_count ('div.help_text span.error-text', 1); |
377 test_field ('user div.error', 'id_email', 'textarea', 0, 'Emails', true); |
398 test_field ('user div.error', 'id_email', 'textarea', 0, 'Emails', true); |
378 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
399 test_match ('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m); |
379 }); |
400 }); |
380 |
401 |
381 suite ('settings page conformity', function () { |
402 suite ('settings page conformity', function () { |
382 test_page_loading ('/settings/', 'Settings - '+c['#id_workspace_name']); |
403 test_page_loading ('/settings/', 'Settings - '+c['#id_workspace_name']); |
383 test_logged_header (w.USER_ADMIN); |
404 test_logged_header (w.USER_ADMIN); |
384 test_default_tabs (t.text_nb, t.user_nb); |
405 test_default_tabs (t.text_nb, t.user_nb); |
385 test_count ('#settings ul.sub_list:eq(0) a', 1); |
406 test_count ('#settings ul.sub_list:eq(0) a', 1); |
386 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/design/"]', 'Appearance'); |
407 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/design/"]', 'Appearance'); |
387 test_count ('#settings form[action="."]:eq(0) :input', 12); |
408 test_count ('#settings form[action="."]:eq(0) :input', 12); |
388 test_field ('settings', 'id_workspace_name', 'text', 0, 'Workspace name'); |
409 test_field ('settings', 'id_workspace_name', 'text', 0, 'Workspace name'); |
389 test_field ('settings', 'id_workspace_tagline', 'text', 1, 'Workspace tagline'); |
410 test_field ('settings', 'id_workspace_tagline', 'text', 1, 'Workspace tagline'); |
390 test_field ('settings', 'id_workspace_registration', 'checkbox', 2, 'Workspace registration'); |
411 test_field ('settings', 'id_workspace_registration', 'checkbox', 2, 'Workspace registration'); |
391 test_field ('settings', 'id_workspace_registration_moderation', 'checkbox', 3, 'Workspace registration moderation'); |
412 test_field ('settings', 'id_workspace_registration_moderation', 'checkbox', 3, 'Workspace registration moderation'); |
392 test_field ('settings', 'id_workspace_role_model', 'select', 4, 'Role model'); |
413 test_field ('settings', 'id_workspace_role_model', 'select', 4, 'Role model'); |
393 test_text ('select#id_workspace_role_model option:eq(0)[selected][value="generic"]', 'Generic', non_visible); |
414 test_text ('select#id_workspace_role_model option:eq(0)[selected][value="generic"]', 'Generic', non_visible); |
394 test_text ('select#id_workspace_role_model option:eq(1)[value="teacher"]', 'Class (education)', non_visible); |
415 test_text ('select#id_workspace_role_model option:eq(1)[value="teacher"]', 'Class (education)', non_visible); |
395 test_field ('settings', 'id_workspace_category_1', 'text', 5, 'Label for the first category of comments'); |
416 test_field ('settings', 'id_workspace_category_1', 'text', 5, 'Label for the first category of comments'); |
396 test_field ('settings', 'id_workspace_category_2', 'text', 6, 'Label for the second category of comments'); |
417 test_field ('settings', 'id_workspace_category_2', 'text', 6, 'Label for the second category of comments'); |
397 test_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments'); |
418 test_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments'); |
398 test_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments'); |
419 test_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments'); |
399 test_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments'); |
420 test_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments'); |
400 test_val ('#settings :input:eq(10)[type=submit]', 'Save'); |
421 test_val ('#settings :input:eq(10)[type=submit]', 'Save'); |
401 test_val ('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel'); |
422 test_val ('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel'); |
402 // TOTEST Workspace registration feature (with newly accessible page) |
423 // TOTEST Workspace registration feature (with newly accessible page) |
403 test_unlogged_footer (); |
424 test_unlogged_footer (); |
404 }); |
425 }); |
408 test_logged_header (w.USER_ADMIN); |
429 test_logged_header (w.USER_ADMIN); |
409 test_default_tabs (t.text_nb, t.user_nb); |
430 test_default_tabs (t.text_nb, t.user_nb); |
410 test_count ('#settings ul.sub_list:eq(0) a', 1); |
431 test_count ('#settings ul.sub_list:eq(0) a', 1); |
411 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/"]', 'General'); |
432 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/"]', 'General'); |
412 test_count ('#settings form[action="."]:eq(0) :input', 7); |
433 test_count ('#settings form[action="."]:eq(0) :input', 7); |
413 test_field ('settings', 'id_workspace_logo_file', 'file', 0, 'Workspace logo'); |
434 test_field ('settings', 'id_workspace_logo_file', 'file', 0, 'Workspace logo'); |
414 test_field ('settings', 'id_custom_css', 'textarea', 1, 'Custom CSS rules'); |
435 test_field ('settings', 'id_custom_css', 'textarea', 1, 'Custom CSS rules'); |
415 test_field ('settings', 'id_custom_font', 'text', 2, 'Custom font'); |
436 test_field ('settings', 'id_custom_font', 'text', 2, 'Custom font'); |
416 test_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles'); |
437 test_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles'); |
417 test_val ('#settings :input:eq(4)[type=submit]', 'Save'); |
438 test_val ('#settings :input:eq(4)[type=submit]', 'Save'); |
418 test_val ('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
439 test_val ('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
419 test_val ('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo'); |
440 test_val ('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo'); |
420 test_unlogged_footer (); |
441 test_unlogged_footer (); |
421 }); |
442 }); |