1 |
1 |
2 // try to login |
2 // " Vim settings |
3 |
3 // set tabstop=4 " number of spaces in a tab |
4 // create texts and co-ments |
4 // set softtabstop=4 " as above |
5 // collect newly created URLs |
5 // set shiftwidth=4 " as above |
6 |
6 |
7 // Get workspace name, public texts… |
|
8 |
|
9 // unlog |
|
10 |
7 |
11 // check that public texts still work while unlogged |
8 // check that public texts still work while unlogged |
12 // check that non public texts are unavailable |
9 // check that non public texts are unavailable |
13 |
|
14 // Is the workspace name correctly displayed ? |
|
15 // Are the public texts displayed in the login page ? |
10 // Are the public texts displayed in the login page ? |
16 |
11 |
17 var w = __karma__.config.w, |
12 var w = __karma__.config.w, |
18 z = {}; |
13 z = {}; |
19 const non_visible = false; |
14 const non_visible = false, no_tagline = false; |
20 const t = { |
15 const t = { |
21 '#id_workspace_name': 'Test workspace name', |
16 '#id_workspace_name': 'Test workspace name', |
22 '#id_workspace_tagline': 'Test workspace tagline', |
17 '#id_workspace_tagline': 'Test workspace tagline', |
23 '#id_workspace_registration': 'on', // registration |
18 '#id_workspace_registration': 'on', // registration |
24 '#id_workspace_registration_moderation': 'on', // registration moderation |
19 '#id_workspace_registration_moderation': 'on', // registration moderation |
25 '#id_workspace_role_model': 'generic', |
20 '#id_workspace_role_model': 'generic', |
26 '#id_workspace_category_1': 'ws_cat_1', |
21 '#id_workspace_category_1': 'ws_cat_1', |
27 '#id_workspace_category_2': 'ws_cat_2', |
22 '#id_workspace_category_2': 'ws_cat_2', |
28 '#id_workspace_category_3': 'ws_cat_3', |
23 '#id_workspace_category_3': 'ws_cat_3', |
29 '#id_workspace_category_4': 'ws_cat_4', |
24 '#id_workspace_category_4': 'ws_cat_4', |
30 '#id_workspace_category_5': 'ws_cat_5' |
25 '#id_workspace_category_5': 'ws_cat_5', |
|
26 '#id_custom_css': ".voted {\n color: #008000;\n}\n\n.rejected, .fallen, .withdrawn {\n color: #ff0000;\n}\n\ndiv.frame {\n border: 1px solid #000;\n padding: 5px;\n}\n\ndiv.frame .title {\n font-weight: bold;\n text-align: center; font-color:purple; \n}", |
|
27 '#id_custom_font': 'Ubuntu', |
|
28 '#id_custom_titles_font': 'Ubuntu Monospaced', |
31 }; |
29 }; |
32 |
30 |
33 |
31 |
34 suite ('comt', function () { |
32 suite ('comt', function () { |
35 |
33 |
36 this.timeout(150000); |
34 this.timeout(150000); |
37 |
35 |
38 suite ('contact page', function () { |
36 suite ('contact page conformity', function () { |
39 test_page_loading ('/contact/', 'Contact'); |
37 test_page_loading ('/contact/', 'Contact'); |
40 test_unlogged_header (); |
38 test_unlogged_header (); |
41 test_val ('form#profile[action="."]'); // the form exists |
39 test_val ('form#profile[action="."]'); // the form exists |
42 test_count ('form#profile :input', 7); // it has no more than 5 labels (may be no more fields) |
40 test_count ('form#profile :input', 7); // it has no more than 5 labels (may be no more fields) |
43 test_form_field ('profile', 'id_name', 'text', 0, 'Your name', true); // the field id_name is… |
41 test_form_field ('profile', 'id_name', 'text', 0, 'Your name', true); // the field id_name is… |
54 test ('get back to / to avoid bugging next page load', dsl(function () { |
52 test ('get back to / to avoid bugging next page load', dsl(function () { |
55 browser.navigateTo ('/'); |
53 browser.navigateTo ('/'); |
56 })); |
54 })); |
57 }); |
55 }); |
58 |
56 |
59 suite ('help page', function () { |
57 suite ('help page conformity', function () { |
60 test_page_loading ('/help/', 'Help'); |
58 test_page_loading ('/help/', 'Help'); |
61 test_unlogged_header (); |
59 test_unlogged_header (); |
62 test_unlogged_footer (); |
60 test_unlogged_footer (); |
63 }); |
61 }); |
64 |
62 |
65 suite ('reset password page', function () { |
63 suite ('reset password page conformity', function () { |
66 test_page_loading ('/password_reset/', 'Reset my password'); |
64 test_page_loading ('/password_reset/', 'Reset my password'); |
67 test_unlogged_header (); |
65 test_unlogged_header (); |
68 test_val ('form#profile[action="."]'); |
66 test_val ('form#profile[action="."]'); |
69 test_count ('form#profile :input', 3); |
67 test_count ('form#profile :input', 3); |
70 test_form_field ('profile', 'id_email', 'text', 1, 'E-mail', true); |
68 test_form_field ('profile', 'id_email', 'text', 1, 'E-mail', true); |
71 test_val ('#profile input[type=submit]', 'Reset my password'); |
69 test_val ('#profile input[type=submit]', 'Reset my password'); |
72 test_unlogged_footer (); |
70 test_unlogged_footer (); |
73 }); |
71 }); |
74 |
72 |
75 suite ('login page', function () { |
73 suite ('login page conformity', function () { |
76 test_page_loading ('/', 'Home'); |
74 test_page_loading ('/', 'Home'); |
77 test_unlogged_header (); |
75 test_unlogged_header (); |
78 test_val ('form#login[action="/login/"]'); |
76 test_val ('form#login[action="/login/"]'); |
79 test_count ('form#login[action="/login/"] :input', 3); |
77 test_count ('form#login[action="/login/"] :input', 3); |
80 test_form_field ('login', 'id_username', 'text', 0, 'Username', true); |
78 test_form_field ('login', 'id_username', 'text', 0, 'Username', true); |
92 browser.navigateTo ('/'); |
90 browser.navigateTo ('/'); |
93 expect (element ('title').text ()).toMatch (/Dashboard/m); |
91 expect (element ('title').text ()).toMatch (/Dashboard/m); |
94 })); |
92 })); |
95 }); |
93 }); |
96 |
94 |
97 suite ('admin dashboard', function () { |
95 suite ('reading settings', function () { |
98 // Should starts with : |
96 test_page_loading ('/settings/', 'Settings'); |
99 // test_page_loading ('/', 'Dashboard'); |
97 test_readz_field ('#id_workspace_name'); |
100 // But its the last thing we did in the previous test |
98 test_readz_field ('#id_workspace_tagline'); |
|
99 test_readz_field ('#id_workspace_registration'); |
|
100 test_readz_field ('#id_workspace_registration_moderation'); |
|
101 test_readz_field ('#id_workspace_role_model'); |
|
102 test_readz_field ('#id_workspace_category_1'); |
|
103 test_readz_field ('#id_workspace_category_2'); |
|
104 test_readz_field ('#id_workspace_category_3'); |
|
105 test_readz_field ('#id_workspace_category_4'); |
|
106 test_readz_field ('#id_workspace_category_5'); |
|
107 test_page_loading ('/settings/design/', 'Settings'); |
|
108 test_readz_field ('#id_custom_css'); |
|
109 test_readz_field ('#id_custom_font'); |
|
110 test_readz_field ('#id_custom_titles_font'); |
|
111 /*test ('display z', dsl(function () { |
|
112 elt ('#main-tabs').text (function (t) { |
|
113 console.log ('z '+JSON.stringify(z)); |
|
114 }); |
|
115 }));*/ |
|
116 }); |
|
117 |
|
118 suite ('setting settings to test values', function () { |
|
119 test_page_loading ('/settings/', 'Settings'); |
|
120 test_fill_settings (t); |
|
121 test_val ('#id_workspace_name', t['#id_workspace_name']); |
|
122 test ('Save test settings ', dsl (function () { |
|
123 elt ('#settings input[type="submit"]').click (); |
|
124 browser.waitForPageLoad (); |
|
125 })); |
|
126 test_page_loading ('/settings/', 'Settings'); |
|
127 test_text ('#content h1.main_title a[href="/"]', t['#id_workspace_name']); |
|
128 test_page_loading ('/settings/design/', 'Settings'); |
|
129 test_fill_design (t); |
|
130 test ('Save test design settings ', dsl (function () { |
|
131 elt ('#settings input[type="submit"]').click (); |
|
132 browser.waitForPageLoad (); |
|
133 })); |
|
134 }); |
|
135 |
|
136 suite ('admin dashboard page conformity', function () { |
|
137 test_page_loading ('/', 'Dashboard\n - '+t['#id_workspace_name']); |
101 test_logged_header (w.USER_ADMIN); |
138 test_logged_header (w.USER_ADMIN); |
102 test ('get text and user nb', dsl(function () { |
139 test ('get text and user nb', dsl(function () { |
103 element ('span.metadata:eq(0)').text (function (metadata) { |
140 element ('span.metadata:eq(0)').text (function (metadata) { |
104 var r = metadata.match (/(\d+) texts, (\d+) users/); |
141 var r = metadata.match (/(\d+) texts, (\d+) users/); |
105 if (r.length != 3) throw 'expected 3 matches got '+r.length; |
142 if (r.length != 3) throw 'expected 3 matches got '+r.length; |
167 test_text ('table.large_table:eq(1) th:eq(4)', '# comments'); |
204 test_text ('table.large_table:eq(1) th:eq(4)', '# comments'); |
168 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
205 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
169 test_unlogged_footer (); |
206 test_unlogged_footer (); |
170 }); |
207 }); |
171 |
208 |
172 suite ('people list', function () { |
209 suite ('create a text page conformity', function () { |
173 test_page_loading ('/user/', 'People'); |
210 test_page_loading ('/create/content/', 'Create a text - '+t['#id_workspace_name']); |
|
211 test_logged_header (w.USER_ADMIN); |
|
212 test_default_tabs (); |
|
213 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
214 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
215 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(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
217 test_count ('#text form[action="."]:eq(0) :input', 6); |
|
218 test_form_field ('text', 'id_title', 'text', 0, 'Title', true); |
|
219 test_form_field ('text', 'id_format', 'select', 1, 'Format', true); |
|
220 test_form_field ('text', 'id_content', 'textarea', 2, 'Content', true); |
|
221 test_form_field ('text', 'id_tags', 'text', 3, 'Tags'); |
|
222 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
|
223 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
224 test_count ('select#id_format option', 3); |
|
225 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
|
226 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
|
227 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
|
228 test_count ('#markItUpId_content li', 20); |
|
229 test_unlogged_footer (); |
|
230 }); |
|
231 |
|
232 suite ('upload text page conformity', function () { |
|
233 test_page_loading ('/create/upload/', 'Upload a text - '+t['#id_workspace_name']); |
|
234 test_logged_header (w.USER_ADMIN); |
|
235 test_default_tabs (); |
|
236 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
237 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
238 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
|
239 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text'); |
|
240 test_count ('#text form[action="."]:eq(0) :input', 6); |
|
241 test_form_field ('text', 'id_title', 'text', 0, 'Title'); |
|
242 test_form_field ('text', 'id_format', 'select', 1, 'Format', true); |
|
243 test_form_field ('text', 'id_tags', 'text', 2, 'Tags'); |
|
244 test_form_field ('text', 'id_file', 'file', 3, 'Upload file (optional)'); |
|
245 test_val ('#text :input:eq(4)[type=submit]', 'Save'); |
|
246 test_val ('#text :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
247 test_count ('select#id_format option', 3); |
|
248 test_text ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible); |
|
249 test_text ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible); |
|
250 test_text ('select#id_format option:eq(2)[value="html"]', 'html', non_visible); |
|
251 test_unlogged_footer (); |
|
252 }); |
|
253 |
|
254 suite ('import a co-mented text page conformity', function () { |
|
255 test_page_loading ('/create/import/', 'Import a co-mented text - '+t['#id_workspace_name']); |
|
256 test_logged_header (w.USER_ADMIN); |
|
257 test_default_tabs (); |
|
258 test_count ('#text ul.sub_list:eq(0) a', 3); |
|
259 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/text/"]', 'Text list'); |
|
260 test_text ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/content/"]', 'Create a text'); |
|
261 test_text ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/upload/"]', 'Upload a text'); |
|
262 test_count ('#text form[action="."]:eq(0) :input', 3); |
|
263 test_form_field ('text', 'id_file', 'file', 0, 'Upload XML file', true); |
|
264 test_val ('#text :input:eq(1)[type=submit]', 'Save'); |
|
265 test_val ('#text :input:eq(2)#cancel_button[type=button]', 'Cancel'); |
|
266 test_unlogged_footer (); |
|
267 }); |
|
268 |
|
269 suite ('edit profile page conformity', function () { |
|
270 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+t['#id_workspace_name']); |
|
271 test_logged_header (w.USER_ADMIN, no_tagline); |
|
272 test_count ('#content ul.sub_list:eq(0) a', 1); |
|
273 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password'); |
|
274 test_count ('form#profile[action="."]:eq(0) :input', 5); |
|
275 test_form_field ('profile', 'id_email', 'text', 0, 'E-mail address', true); |
|
276 test_form_field ('profile', 'id_first_name','text', 1, 'First name'); |
|
277 test_form_field ('profile', 'id_last_name', 'text', 2, 'Last name'); |
|
278 test_form_field ('profile', 'id_tags', 'text', 3, 'Tags'); |
|
279 test_val ('#profile :input:eq(4)[type=submit]', 'Save'); |
|
280 test_unlogged_footer (); |
|
281 }); |
|
282 |
|
283 suite ('edit password page conformity', function () { |
|
284 test_page_loading ('/profile-pw/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+t['#id_workspace_name']); |
|
285 test_logged_header (w.USER_ADMIN, no_tagline); |
|
286 test_count ('#content ul.sub_list:eq(0) a', 1); |
|
287 test_text ('#content ul.sub_list:eq(0) a:eq(0)[href="/profile/"]', 'Profile'); |
|
288 test_count ('form#profile[action="."]:eq(0) :input', 4); |
|
289 test_form_field ('profile', 'id_old_password', 'password', 0, 'Old password', true); |
|
290 test_form_field ('profile', 'id_new_password1', 'password', 1, 'New password', true); |
|
291 test_form_field ('profile', 'id_new_password2', 'password', 2, 'New password confirmation', true); |
|
292 test_val ('#profile :input:eq(3)[type=submit]', 'Save'); |
|
293 test_unlogged_footer (); |
|
294 }); |
|
295 |
|
296 suite ('people list page conformity', function () { |
|
297 test_page_loading ('/user/', 'People\' list\n - '+t['#id_workspace_name']); |
174 test_logged_header (w.USER_ADMIN); |
298 test_logged_header (w.USER_ADMIN); |
175 test_default_tabs (); |
299 test_default_tabs (); |
176 test_count ('#user ul.sub_list:eq(0) a', 2); |
300 test_count ('#user ul.sub_list:eq(0) a', 2); |
177 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user'); |
301 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user'); |
178 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
302 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
179 // TOTEST : filter by tag |
303 // TOTEST : filter by tag |
180 test_count ('form#filter_form[action="."] :input', 1); |
304 test_count ('form#filter_form[action="."] :input', 1); |
181 test_text ('#filter_form a[href="?display=1"]', 'Display suspended users'); |
305 test_text ('#filter_form a[href="?display=1"]', 'Display suspended users'); |
182 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
306 test_text ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible); |
183 test ('#user_form input count', dsl (function () { |
|
184 elt ('form#user_form[action="."] :input').count (function (c) { |
|
185 var n = 6 + (z.user_nb % 10) * 2; |
|
186 if (c != n) throw 'expected computed '+n+' to equal got '+c; |
|
187 }); |
|
188 })); |
|
189 test ('#paginator "of #" value', dsl (function () { |
|
190 elt ('span#paginator').text (function (t) { |
|
191 var r = t.match (/\s\d+-\d+ of (\d+)\s/m); |
|
192 if (r.length != 2) throw 'expected 2 matches got '+r.length; |
|
193 if (r[1] != z.user_nb) throw 'expected paginator total ('+r[1]+') to be '+z.user_nb; |
|
194 }); |
|
195 })); |
|
196 // TOTEST : pagination |
307 // TOTEST : pagination |
197 // TOTEST : Bulk Actions -> Apply does enable |
308 // TOTEST : Bulk Actions -> Apply does enable |
198 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', '- Bulk Actions -', non_visible); |
309 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', '- Bulk Actions -', non_visible); |
199 test_text ('select#bulk_actions option:eq(1)[value="disable"]', 'Suspend access', non_visible); |
310 test_text ('select#bulk_actions option:eq(1)[value="disable"]', 'Suspend access', non_visible); |
200 test_text ('select#bulk_actions option:eq(2)[value="enable"]', 'Enable access', non_visible); |
311 test_text ('select#bulk_actions option:eq(2)[value="enable"]', 'Enable access', non_visible); |
215 test_text ('table.large_table:eq(1) a.main_object_title[href="/profile/"]', w.USER_ADMIN); |
326 test_text ('table.large_table:eq(1) a.main_object_title[href="/profile/"]', w.USER_ADMIN); |
216 test_text ('table.large_table:eq(1) div.hidden-user-actions a[href="/profile/"]', 'Your profile'); |
327 test_text ('table.large_table:eq(1) div.hidden-user-actions a[href="/profile/"]', 'Your profile'); |
217 test_unlogged_footer (); |
328 test_unlogged_footer (); |
218 }); |
329 }); |
219 |
330 |
220 suite ('settings conformity', function () { |
331 suite ('check user number', function () { |
221 test_page_loading ('/settings/', 'Settings'); |
332 test_page_loading ('/user/?display=1', 'People\' list\n - '+t['#id_workspace_name']); |
|
333 test ('#user_form input count', dsl (function () { |
|
334 elt ('form#user_form[action="."] :input').count (function (c) { |
|
335 var n = 6 + (z.user_nb % 10) * 2; |
|
336 if (c != n) throw 'expected computed '+n+' to equal got '+c; |
|
337 }); |
|
338 })); |
|
339 test ('#paginator "of #" value', dsl (function () { |
|
340 elt ('span#paginator').text (function (t) { |
|
341 var r = t.match (/\s\d+-\d+ of (\d+)\s/m); |
|
342 if (r.length != 2) throw 'expected 2 matches got '+r.length; |
|
343 if (r[1] != z.user_nb) throw 'expected paginator total ('+r[1]+') to be '+z.user_nb; |
|
344 }); |
|
345 })); |
|
346 }); |
|
347 |
|
348 suite ('add a user page conformity', function () { |
|
349 test_page_loading ('/user/add/', 'Add a new user\n - '+t['#id_workspace_name']); |
|
350 test_logged_header (w.USER_ADMIN); |
|
351 test_default_tabs (); |
|
352 test_count ('#user ul.sub_list:eq(0) a', 2); |
|
353 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
|
354 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk'); |
|
355 test_count ('#user form[action="."]:eq(0) :input', 8); |
|
356 test_form_field ('user', 'id_email', 'text', 0, 'E-mail address', true); |
|
357 test_form_field ('user', 'id_first_name', 'text', 1, 'First name'); |
|
358 test_form_field ('user', 'id_last_name', 'text', 2, 'Last name'); |
|
359 test_form_field ('user', 'id_tags', 'text', 3, 'Tags'); |
|
360 test_form_field ('user', 'id_role', 'select', 4, 'Workspace level role'); |
|
361 test_form_field ('user', 'id_note', 'textarea', 5, 'Note'); |
|
362 test_count ('select#id_role option', 6); |
|
363 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
|
364 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
|
365 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
|
366 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
|
367 test_text ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible); |
|
368 test_text ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible); |
|
369 test_val ('#user :input:eq(6)[type=submit]', 'Add user'); |
|
370 test_val ('#user :input:eq(7)#cancel_button[type=button]', 'Cancel'); |
|
371 test_unlogged_footer (); |
|
372 // TOTEST add user (pending) |
|
373 }); |
|
374 |
|
375 suite ('add users in bulk page conformity', function () { |
|
376 test_page_loading ('/user/mass-add/', 'Add users in bulk\n - '+t['#id_workspace_name']); |
|
377 test_logged_header (w.USER_ADMIN); |
|
378 test_default_tabs (); |
|
379 test_count ('#user ul.sub_list:eq(0) a', 2); |
|
380 test_text ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/"]', 'Users\' list'); |
|
381 test_text ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/add/"]', 'Add a new user'); |
|
382 test_count ('#user form[action="."]:eq(0) :input', 6); |
|
383 test_form_field ('user', 'id_email', 'textarea', 0, 'Emails', true); |
|
384 test_form_field ('user', 'id_tags', 'text', 1, 'Tags'); |
|
385 test_form_field ('user', 'id_role', 'select', 2, 'Workspace level role'); |
|
386 test_form_field ('user', 'id_note', 'textarea', 3, 'Note'); |
|
387 test_count ('select#id_role option', 6); |
|
388 test_text ('select#id_role option:eq(0)[value][selected]', '---------', non_visible); |
|
389 test_text ('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible); |
|
390 test_text ('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible); |
|
391 test_text ('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible); |
|
392 test_text ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible); |
|
393 test_text ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible); |
|
394 test_val ('#user :input:eq(4)[type=submit]', 'Add users'); |
|
395 test_val ('#user :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
|
396 // X TOTEST add users (pending) -> can't be deleted |
|
397 test_unlogged_footer (); |
|
398 }); |
|
399 |
|
400 suite ('settings page conformity', function () { |
|
401 test_page_loading ('/settings/', 'Settings - '+t['#id_workspace_name']); |
222 test_logged_header (w.USER_ADMIN); |
402 test_logged_header (w.USER_ADMIN); |
223 test_default_tabs (); |
403 test_default_tabs (); |
224 test_count ('#settings ul.sub_list:eq(0) a', 1); |
404 test_count ('#settings ul.sub_list:eq(0) a', 1); |
225 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/design/"]', 'Appearance'); |
405 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/design/"]', 'Appearance'); |
226 test_count ('#settings form[action="."]:eq(0) :input', 12); |
406 test_count ('#settings form[action="."]:eq(0) :input', 12); |
236 test_form_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments'); |
416 test_form_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments'); |
237 test_form_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments'); |
417 test_form_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments'); |
238 test_form_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments'); |
418 test_form_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments'); |
239 test_val ('#settings :input:eq(10)[type=submit]', 'Save'); |
419 test_val ('#settings :input:eq(10)[type=submit]', 'Save'); |
240 test_val ('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel'); |
420 test_val ('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel'); |
241 test_unlogged_footer (); |
421 // TOTEST Workspace registration |
242 }); |
422 test_unlogged_footer (); |
243 |
423 }); |
244 suite ('settings reading', function () { |
424 |
245 test_readz_field ('#id_workspace_name'); |
425 suite ('settings design page conformity', function () { |
246 test_readz_field ('#id_workspace_tagline'); |
426 test_page_loading ('/settings/design/', 'Settings - '+t['#id_workspace_name']); |
247 test_readz_field ('#id_workspace_registration'); |
427 test_logged_header (w.USER_ADMIN); |
248 test_readz_field ('#id_workspace_registration_moderation'); |
428 test_default_tabs (); |
249 test_readz_field ('#id_workspace_role_model'); |
429 test_count ('#settings ul.sub_list:eq(0) a', 1); |
250 test_readz_field ('#id_workspace_category_1'); |
430 test_text ('#settings ul.sub_list:eq(0) a:eq(0)[href="/settings/"]', 'General'); |
251 test_readz_field ('#id_workspace_category_2'); |
431 test_count ('#settings form[action="."]:eq(0) :input', 7); |
252 test_readz_field ('#id_workspace_category_3'); |
432 test_form_field ('settings', 'id_workspace_logo_file', 'file', 0, 'Workspace logo'); |
253 test_readz_field ('#id_workspace_category_4'); |
433 test_form_field ('settings', 'id_custom_css', 'textarea', 1, 'Custom CSS rules'); |
254 test_readz_field ('#id_workspace_category_5'); |
434 test_form_field ('settings', 'id_custom_font', 'text', 2, 'Custom font'); |
255 /* test ('display z', dsl(function () { |
435 test_form_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles'); |
256 elt ('#main-tabs').text (function (t) { |
436 test_val ('#settings :input:eq(4)[type=submit]', 'Save'); |
257 console.log ('z '+JSON.stringify(z)); |
437 test_val ('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel'); |
258 }); |
438 test_val ('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo'); |
259 }));*/ |
439 // TOTEST custom CSS, font, font for titles like the rest of the settings |
260 }); |
440 test_unlogged_footer (); |
261 |
441 }); |
262 suite ('settings restoration', function () { |
442 |
263 test_fill_settings (t); |
443 suite ('followup page conformity', function () { |
264 test_val ('#id_workspace_name', t['#id_workspace_name']); |
444 test_page_loading ('/followup/', 'Followup\n - '+t['#id_workspace_name']); |
265 test ('Save test settings ', dsl (function () { |
|
266 elt ('#settings input[type="submit"]').click (); |
|
267 browser.waitForPageLoad (); |
|
268 })); |
|
269 test_page_loading ('/settings/', 'Settings'); |
|
270 test_text ('#content h1.main_title a[href="/"]', t['#id_workspace_name']); |
|
271 }); |
|
272 |
|
273 suite ('followup', function () { |
|
274 test_page_loading ('/followup/', 'Followup'); |
|
275 test_logged_header (w.USER_ADMIN); |
445 test_logged_header (w.USER_ADMIN); |
276 test_default_tabs (); |
446 test_default_tabs (); |
277 test_text ('#followup a:eq(0)[href="/help/#public_private_feed"]', '?'); |
447 test_text ('#followup a:eq(0)[href="/help/#public_private_feed"]', '?'); |
278 test_match ('#followup a:eq(1)[href$="/feed/"]', new RegExp (w.WORKSPACE_URL+'feed/', 'm')); |
448 test_match ('#followup a:eq(1)[href$="/feed/"]', new RegExp (w.WORKSPACE_URL+'feed/', 'm')); |
279 test_text ('#followup a:eq(2)[href="/help/#public_private_feed"]', '?'); |
449 test_text ('#followup a:eq(2)[href="/help/#public_private_feed"]', '?'); |
319 if (z.user_nb != r[1]) throw 'expected tab people nb ('+r[1]+') to be '+z.user_nb; |
496 if (z.user_nb != r[1]) throw 'expected tab people nb ('+r[1]+') to be '+z.user_nb; |
320 }); |
497 }); |
321 })); |
498 })); |
322 } |
499 } |
323 |
500 |
324 function test_logged_header (username) { |
501 function test_logged_header (username, is_tagline) { |
|
502 is_tagline = typeof is_tagline == 'undefined' ? true : is_tagline; |
|
503 |
325 test_text ('#header_controls b', username) |
504 test_text ('#header_controls b', username) |
326 test_count ('#header_controls a', 6); |
505 test_count ('#header_controls a', 6); |
327 test_text ('#header_controls a:nth-of-type(1)[href="/"]', 'Home'); |
506 test_text ('#header_controls a:nth-of-type(1)[href="/"]', 'Home'); |
328 test_text ('#header_controls a:nth-of-type(2)[href="/create/content/"]', 'Create a text'); |
507 test_text ('#header_controls a:nth-of-type(2)[href="/create/content/"]', 'Create a text'); |
329 test_text ('#header_controls a:nth-of-type(3)[href="/create/upload/"]', 'Upload a text'); |
508 test_text ('#header_controls a:nth-of-type(3)[href="/create/upload/"]', 'Upload a text'); |
330 test_text ('#header_controls a:nth-of-type(4)[href="/create/import/"]', 'Import a co-mented text'); |
509 test_text ('#header_controls a:nth-of-type(4)[href="/create/import/"]', 'Import a co-mented text'); |
331 test_text ('#header_controls a:nth-of-type(5)[href="/profile/"]', 'Profile'); |
510 test_text ('#header_controls a:nth-of-type(5)[href="/profile/"]', 'Profile'); |
332 test_text ('#header_controls a:nth-of-type(6)[href="/logout/"]', 'Logout'); |
511 test_text ('#header_controls a:nth-of-type(6)[href="/logout/"]', 'Logout'); |
|
512 test_text ('#content h1.main_title a[href="/"]', t['#id_workspace_name']); |
|
513 |
|
514 if (is_tagline) { |
|
515 test_match ('#content h1.main_title + div', new RegExp (t['#id_workspace_tagline'], 'm')); |
|
516 } |
333 } |
517 } |
334 |
518 |
335 function test_unlogged_header () { |
519 function test_unlogged_header () { |
336 test_count ('#header_controls a', 2); |
520 test_count ('#header_controls a', 2); |
337 test_text ('#header_controls a[href="/"]', 'Home'); |
521 test_text ('#header_controls a[href="/"]', 'Home'); |