test-suite/tests/002_comt-logged-admin.js
changeset 636 a8ab808d33c3
parent 635 57d3834c5c01
child 637 71d87ca43d6a
equal deleted inserted replaced
635:57d3834c5c01 636:a8ab808d33c3
     9 	long_text = '';
     9 	long_text = '';
    10 
    10 
    11 for (var i = 20; i--;)
    11 for (var i = 20; i--;)
    12 	long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>';
    12 	long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>';
    13 
    13 
    14 const non_visible = false,
    14 const hidden = false,
    15 	no_tagline = false,
    15 	no_tagline = false,
       
    16 	wait_page_load = true,
    16 	c = {
    17 	c = {
    17 	'#id_workspace_name':	'Test workspace name',
    18 	'#id_workspace_name':	'Test workspace name',
    18 	'#id_workspace_tagline':	'Test workspace tagline',
    19 	'#id_workspace_tagline':	'Test workspace tagline',
    19 	'#id_workspace_registration':			'on',	// registration
    20 	'#id_workspace_registration':			'on',	// registration
    20 	'#id_workspace_registration_moderation':'on',	// registration moderation
    21 	'#id_workspace_registration_moderation':'on',	// registration moderation
    49 	]
    50 	]
    50 };
    51 };
    51 
    52 
    52 suite ('comt logged admin', function () {
    53 suite ('comt logged admin', function () {
    53 
    54 
    54 	this.timeout(20000);
    55 	this.timeout(200000);
    55 
    56 
    56 	suite ('logs as an admin', function () {
    57 	suite ('logs as an admin', function () {
    57 		test ('logs an admin in', dsl(function () {
    58 		test ('logs an admin in', dsl(function () {
    58 			browser.navigateTo ('/');
    59 			browser.navigateTo ('/');
    59 			input ('#id_username').enter (w.USER_ADMIN);
    60 			input ('#id_username').enter (w.USER_ADMIN);
    66 	});
    67 	});
    67 
    68 
    68 	suite ('setting settings to test-values', function () {
    69 	suite ('setting settings to test-values', function () {
    69 		test_page_loading ('/settings/', 'Settings');
    70 		test_page_loading ('/settings/', 'Settings');
    70 		test_fill_settings (c);
    71 		test_fill_settings (c);
    71 		test_val ('#id_workspace_name', c['#id_workspace_name']);
    72 		test_val	('#id_workspace_name', c['#id_workspace_name']);
    72 		test_submit ('#settings input[type="submit"]');
    73 		test_click	('#settings input[type="submit"]', wait_page_load);
    73 		test_page_loading	('/settings/', 'Settings');
    74 		test_page_loading	('/settings/', 'Settings');
    74 		test_text ('#content h1.main_title a[href="/"]', c['#id_workspace_name']);
    75 		test_text	('#content h1.main_title a[href="/"]', c['#id_workspace_name']);
    75 		test_page_loading	('/settings/design/', 'Settings');
    76 		test_page_loading	('/settings/design/', 'Settings');
    76 		test_fill_design (c);
    77 		test_fill_design (c);
    77 		test_submit ('#settings input[type="submit"]');
    78 		test_click	('#settings input[type="submit"]', wait_page_load);
    78 	});
    79 	});
    79 
    80 
    80 	suite ('admin dashboard page conformity', function () {
    81 	suite ('admin dashboard page conformity', function () {
    81 		test_page_loading ('/', 'Dashboard\n - '+c['#id_workspace_name']);
    82 		test_page_loading ('/', 'Dashboard\n - '+c['#id_workspace_name']);
    82 		test_logged_header (w.USER_ADMIN);
    83 		test_logged_header (w.USER_ADMIN);
   129 		test_field	('text', 'id_content',	'textarea', 2, 'Content', true);
   130 		test_field	('text', 'id_content',	'textarea', 2, 'Content', true);
   130 		test_field	('text', 'id_tags',		'text', 3, 'Tags');
   131 		test_field	('text', 'id_tags',		'text', 3, 'Tags');
   131 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   132 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   132 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   133 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   133 		test_count	('select#id_format option', 3);
   134 		test_count	('select#id_format option', 3);
   134 		test_text	('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible);
   135 		test_text	('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', hidden);
   135 		test_text	('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible);
   136 		test_text	('select#id_format option:eq(1)[value="rst"]', 'rst', hidden);
   136 		test_text	('select#id_format option:eq(2)[value="html"]', 'html', non_visible);
   137 		test_text	('select#id_format option:eq(2)[value="html"]', 'html', hidden);
   137 		test_count	('.markdown #markItUpId_content li', 20); // How many buttons in the WYSIWYG editor toolbar ?
   138 		test_count	('.markdown #markItUpId_content li', 20); // How many buttons in the WYSIWYG editor toolbar ?
   138 		test_unlogged_footer ();
   139 		test_unlogged_footer ();
   139 		test_submit('#text input[type="submit"]');
   140 		test_click	('#text input[type="submit"]', wait_page_load);
   140 		test_count ('div.help_text span.error-text', 2);
   141 		test_count	('div.help_text span.error-text', 2);
   141 		test_field	('text div.error', 'id_title',		'text', 0, 'Title', true);
   142 		test_field	('text div.error', 'id_title',		'text', 0, 'Title', true);
   142 		test_field	('text div.error', 'id_content',	'textarea', 1, 'Content', true);
   143 		test_field	('text div.error', 'id_content',	'textarea', 1, 'Content', true);
   143 	});
   144 	});
   144 
   145 
   145 	suite ('upload text page conformity', function () {
   146 	suite ('upload text page conformity', function () {
   156 		test_field	('text', 'id_tags',		'text', 2, 'Tags');
   157 		test_field	('text', 'id_tags',		'text', 2, 'Tags');
   157 		test_field	('text', 'id_file',		'file', 3, 'Upload file');
   158 		test_field	('text', 'id_file',		'file', 3, 'Upload file');
   158 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   159 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   159 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   160 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   160 		test_count	('select#id_format option', 3);
   161 		test_count	('select#id_format option', 3);
   161 		test_text	('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible);
   162 		test_text	('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', hidden);
   162 		test_text	('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible);
   163 		test_text	('select#id_format option:eq(1)[value="rst"]', 'rst', hidden);
   163 		test_text	('select#id_format option:eq(2)[value="html"]', 'html', non_visible);
   164 		test_text	('select#id_format option:eq(2)[value="html"]', 'html', hidden);
   164 		test_unlogged_footer ();
   165 		test_unlogged_footer ();
   165 		test_submit('#text input[type="submit"]');
   166 		test_click	('#text input[type="submit"]', wait_page_load);
   166 		test_count ('div.help_text span.error-text', 1);
   167 		test_count	('div.help_text span.error-text', 1);
   167 		test_field	('text div.error', 'id_file',		'file', 0, 'Upload file');
   168 		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);
   169 		test_match	('#text div.help_text:eq(3) span.error-text:eq(0)', /You should specify a file to upload/m);
   169 	});
   170 	});
   170 
   171 
   171 	suite ('import a co-mented text page conformity', function () {
   172 	suite ('import a co-mented text page conformity', function () {
   179 		test_count	('#text form[action="."]:eq(0) :input', 3);
   180 		test_count	('#text form[action="."]:eq(0) :input', 3);
   180 		test_field	('text', 'id_file',	'file', 0, 'Upload XML file', true);
   181 		test_field	('text', 'id_file',	'file', 0, 'Upload XML file', true);
   181 		test_val	('#text :input:eq(1)[type=submit]', 'Save');
   182 		test_val	('#text :input:eq(1)[type=submit]', 'Save');
   182 		test_val	('#text :input:eq(2)#cancel_button[type=button]', 'Cancel');
   183 		test_val	('#text :input:eq(2)#cancel_button[type=button]', 'Cancel');
   183 		test_unlogged_footer ();
   184 		test_unlogged_footer ();
   184 		test_submit('#text input[type="submit"]');
   185 		test_click	('#text input[type="submit"]', wait_page_load);
   185 		test_count	('div.help_text span.error-text', 1);
   186 		test_count	('div.help_text span.error-text', 1);
   186 		test_field	('text div.error', 'id_file',		'file', 0, 'Upload XML file', true);
   187 		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);
   188 		test_match	('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m);
   188 	});
   189 	});
   189 
   190 
   205 	// tester l'affichage d'un texte
   206 	// tester l'affichage d'un texte
   206 	// tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font
   207 	// tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font
   207 	// tester que si Text preferences -> custom -> #textcontainer.custom font: Test_Sopinspace_custom_font
   208 	// tester que si Text preferences -> custom -> #textcontainer.custom font: Test_Sopinspace_custom_font
   208 	// #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace
   209 	// #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace
   209 
   210 
   210 	suite.skip ('texts list page conformity', function () {
   211 	suite ('texts list page conformity', function () {
   211 		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
   212 		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
   212 		test_logged_header	(w.USER_ADMIN);
   213 		test_logged_header	(w.USER_ADMIN);
   213 		test_default_tabs	(t.text_nb, t.user_nb);
   214 		test_default_tabs	(t.text_nb, t.user_nb);
   214 		test_count	('#text ul.sub_list:eq(0) a', 3);
   215 		test_count	('#text ul.sub_list:eq(0) a', 3);
   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(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');
   217 		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');
   218 		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);
   219 		test_count	('form#filter_form[action="."] :input', 1);
   219 		test_text	('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible);
   220 		test_text	('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', hidden);
   220 		test_page_loading ('/text/?tag_selected=Text+Troisième', 'Texts\n - '+c['#id_workspace_name']);
   221 		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_count	('#texts_form :input', 4 + 3);
   222 		test_match	('#paginator', /\s1-4 of 4\s/m);
   223 		test_match	('#paginator', /\s1-4 of 4\s/m);
   223 
   224 
   224 		for (var i=4; i--;) {
   225 		for (var i=4; i--;) {
   251 		test_count	('#texts_form :input', t.text_nb + 3);
   252 		test_count	('#texts_form :input', t.text_nb + 3);
   252 		test_click	('#paginator a:eq(0)[href="?paginate=&page=1"]');
   253 		test_click	('#paginator a:eq(0)[href="?paginate=&page=1"]');
   253 		test_count	('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3);
   254 		test_count	('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3);
   254 		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
   255 		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
   255 		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
   256 		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
   256 		test_text	('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible);
   257 		test_text	('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', hidden);
   257 		test_text	('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible);
   258 		test_text	('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', hidden);
   258 		test_val	('form#texts_form input#apply[type=button][disabled]', 'Apply');
   259 		test_val	('form#texts_form input#apply[type=button][disabled]', 'Apply');
   259 		test_count	('table.large_table:eq(1) th', 6);
   260 		test_count	('table.large_table:eq(1) th', 6);
   260 		test_val	('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on');
   261 		test_val	('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on');
   261 		test_text	('table.large_table:eq(1) th:eq(1) a[href="?order=title"]', 'Text');
   262 		test_text	('table.large_table:eq(1) th:eq(1) a[href="?order=title"]', 'Text');
   262 		test_text	('table.large_table:eq(1) th:eq(2)', 'Author');
   263 		test_text	('table.large_table:eq(1) th:eq(2)', 'Author');
   266 		test_page_loading ('/text/?page=2', 'Texts\n - '+c['#id_workspace_name']);
   267 		test_page_loading ('/text/?page=2', 'Texts\n - '+c['#id_workspace_name']);
   267 		test		('choose bulk action Delete', dsl(function () { input ('#bulk_actions').option ('delete'); }));
   268 		test		('choose bulk action Delete', dsl(function () { input ('#bulk_actions').option ('delete'); }));
   268 		test_click	('#all_check');
   269 		test_click	('#all_check');
   269 		test_count	('form#texts_form input:checked', t.text_nb % 10 + 1);
   270 		test_count	('form#texts_form input:checked', t.text_nb % 10 + 1);
   270 		test_val	('form#texts_form input#apply[type=button]:not([disabled])', 'Apply');
   271 		test_val	('form#texts_form input#apply[type=button]:not([disabled])', 'Apply');
   271 //		test_click	('#texts_form #apply');
   272 		// test_click	('#texts_form #apply'); // can't click on the confirm dialog
   272 		test		('submit #texts_form without confirm dialog', dsl(function(){form("#texts_form").submit();}));
   273 		test_submit	('#texts_form');
   273 		test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']);
   274 		test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']);
   274 //		t.text_nb -= 2;
   275 		t.text_nb -= 2;
   275 		test_count	('form#texts_form :input', t.text_nb + 3);
   276 		test_count	('form#texts_form :input', t.text_nb + 3);
   276 		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
   277 		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
   277 		// TOTEST : unitary delete 
   278 		// TOTEST : unitary delete 
   278 
   279 
   279 		test_unlogged_footer ();
   280 		test_unlogged_footer ();
   280 	});
   281 	});
   281 
   282 
   282 	suite ('edit profile page conformity', function () {
   283 	suite ('edit profile page conformity', function () {
   283 		test_page_loading	('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']);
   284 		test_page_loading	('/profile/', 'Your profile \\('+w.USER_ADMIN+'\\)\n - '+c['#id_workspace_name']);
   284 		test_logged_header	(w.USER_ADMIN, no_tagline);
   285 		test_logged_header	(w.USER_ADMIN, no_tagline);
   285 		test_count	('#content ul.sub_list:eq(0) a', 1);
   286 		test_count	('#content ul.sub_list:eq(0) a', 1);
   286 		test_text	('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password');
   287 		test_text	('#content ul.sub_list:eq(0) a:eq(0)[href="/profile-pw/"]', 'Password');
   287 		test_count	('form#profile[action="."]:eq(0) :input', 5);
   288 		test_count	('form#profile[action="."]:eq(0) :input', 5);
   288 		test_field	('profile', 'id_email',		'text', 0, 'E-mail address', true);
   289 		test_field	('profile', 'id_email',		'text', 0, 'E-mail address', true);
   314 		test_text	('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user');
   315 		test_text	('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user');
   315 		test_text	('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk');
   316 		test_text	('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk');
   316 		// TOTEST : filter by tag -> commentator user should be tagged commentator (to change in fixture)
   317 		// TOTEST : filter by tag -> commentator user should be tagged commentator (to change in fixture)
   317 		test_count	('form#filter_form[action="."] :input', 1);
   318 		test_count	('form#filter_form[action="."] :input', 1);
   318 		test_text	('#filter_form a[href="?display=1"]', 'Display suspended users');
   319 		test_text	('#filter_form a[href="?display=1"]', 'Display suspended users');
   319 		test_text	('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible);
   320 		test_text	('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', hidden);
   320 		// TOTEST : pagination
   321 		// TOTEST : pagination
   321 		// TOTEST : Bulk Actions -> Apply does enable
   322 		// TOTEST : Bulk Actions -> Apply does enable
   322 		// TOTEST display suspended users
   323 		// TOTEST display suspended users
   323 		test_text	('select#bulk_actions option:eq(0)[selected][value="-1"]', '- Bulk Actions -', non_visible);
   324 		test_text	('select#bulk_actions option:eq(0)[selected][value="-1"]', '- Bulk Actions -', hidden);
   324 		test_text	('select#bulk_actions option:eq(1)[value="disable"]', 'Suspend access', non_visible);
   325 		test_text	('select#bulk_actions option:eq(1)[value="disable"]', 'Suspend access', hidden);
   325 		test_text	('select#bulk_actions option:eq(2)[value="enable"]', 'Enable access', non_visible);
   326 		test_text	('select#bulk_actions option:eq(2)[value="enable"]', 'Enable access', hidden);
   326 		test_text	('select#bulk_actions option:eq(3)[value="role_1"]', 'Change role to Manager', non_visible);
   327 		test_text	('select#bulk_actions option:eq(3)[value="role_1"]', 'Change role to Manager', hidden);
   327 		test_text	('select#bulk_actions option:eq(4)[value="role_2"]', 'Change role to Editor', non_visible);
   328 		test_text	('select#bulk_actions option:eq(4)[value="role_2"]', 'Change role to Editor', hidden);
   328 		test_text	('select#bulk_actions option:eq(5)[value="role_3"]', 'Change role to Moderator', non_visible);
   329 		test_text	('select#bulk_actions option:eq(5)[value="role_3"]', 'Change role to Moderator', hidden);
   329 		test_text	('select#bulk_actions option:eq(6)[value="role_4"]', 'Change role to Commentator', non_visible);
   330 		test_text	('select#bulk_actions option:eq(6)[value="role_4"]', 'Change role to Commentator', hidden);
   330 		test_text	('select#bulk_actions option:eq(7)[value="role_5"]', 'Change role to Observer', non_visible);
   331 		test_text	('select#bulk_actions option:eq(7)[value="role_5"]', 'Change role to Observer', hidden);
   331 		test_val	('form#user_form input#apply[type=button][disabled]', 'Apply');
   332 		test_val	('form#user_form input#apply[type=button][disabled]', 'Apply');
   332 		test_count	('table.large_table:eq(1) th', 6);
   333 		test_count	('table.large_table:eq(1) th', 6);
   333 		test_val	('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on');
   334 		test_val	('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on');
   334 		test_text	('table.large_table:eq(1) th:eq(1) a[href="?order=user__username"]', 'User');
   335 		test_text	('table.large_table:eq(1) th:eq(1) a[href="?order=user__username"]', 'User');
   335 		test_text	('table.large_table:eq(1) th:eq(2) a[href="?order=user__email"]', 'Email');
   336 		test_text	('table.large_table:eq(1) th:eq(2) a[href="?order=user__email"]', 'Email');
   362 		test_field	('user', 'id_last_name',	'text', 2, 'Last name');
   363 		test_field	('user', 'id_last_name',	'text', 2, 'Last name');
   363 		test_field	('user', 'id_tags',			'text', 3, 'Tags');
   364 		test_field	('user', 'id_tags',			'text', 3, 'Tags');
   364 		test_field	('user', 'id_role',			'select', 4, 'Workspace level role');
   365 		test_field	('user', 'id_role',			'select', 4, 'Workspace level role');
   365 		test_field	('user', 'id_note',			'textarea', 5, 'Note');
   366 		test_field	('user', 'id_note',			'textarea', 5, 'Note');
   366 		test_count	('select#id_role option', 6);
   367 		test_count	('select#id_role option', 6);
   367 		test_text	('select#id_role option:eq(0)[value][selected]', '---------', non_visible);
   368 		test_text	('select#id_role option:eq(0)[value][selected]', '---------', hidden);
   368 		test_text	('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible);
   369 		test_text	('select#id_role option:eq(1)[value="1"]', 'Manager', hidden);
   369 		test_text	('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible);
   370 		test_text	('select#id_role option:eq(2)[value="2"]', 'Editor', hidden);
   370 		test_text	('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible);
   371 		test_text	('select#id_role option:eq(3)[value="3"]', 'Moderator', hidden);
   371 		test_text	('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible);
   372 		test_text	('select#id_role option:eq(4)[value="4"]', 'Commentator', hidden);
   372 		test_text	('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible);
   373 		test_text	('select#id_role option:eq(5)[value="5"]', 'Observer', hidden);
   373 		test_val	('#user :input:eq(6)[type=submit]', 'Add user');
   374 		test_val	('#user :input:eq(6)[type=submit]', 'Add user');
   374 		test_val	('#user :input:eq(7)#cancel_button[type=button]', 'Cancel');
   375 		test_val	('#user :input:eq(7)#cancel_button[type=button]', 'Cancel');
   375 		test_unlogged_footer ();
   376 		test_unlogged_footer ();
   376 		test_submit('#user input[type="submit"]');
   377 		test_click	('#user input[type="submit"]', wait_page_load);
   377 		test_count	('div.help_text span.error-text', 1);
   378 		test_count	('div.help_text span.error-text', 1);
   378 		test_field	('user div.error', 'id_email', 'text', 0, 'E-mail address', true);
   379 		test_field	('user div.error', 'id_email', 'text', 0, 'E-mail address', true);
   379 		test_match	('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m);
   380 		test_match	('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m);
   380 		// X TOTEST add user (pending)
   381 		// X TOTEST add user (pending)
   381 	});
   382 	});
   391 		test_field	('user', 'id_email',		'textarea', 0, 'Emails', true);
   392 		test_field	('user', 'id_email',		'textarea', 0, 'Emails', true);
   392 		test_field	('user', 'id_tags',			'text',		1, 'Tags');
   393 		test_field	('user', 'id_tags',			'text',		1, 'Tags');
   393 		test_field	('user', 'id_role',			'select',	2, 'Workspace level role');
   394 		test_field	('user', 'id_role',			'select',	2, 'Workspace level role');
   394 		test_field	('user', 'id_note',			'textarea', 3, 'Note');
   395 		test_field	('user', 'id_note',			'textarea', 3, 'Note');
   395 		test_count	('select#id_role option', 6);
   396 		test_count	('select#id_role option', 6);
   396 		test_text	('select#id_role option:eq(0)[value][selected]', '---------', non_visible);
   397 		test_text	('select#id_role option:eq(0)[value][selected]', '---------', hidden);
   397 		test_text	('select#id_role option:eq(1)[value="1"]', 'Manager', non_visible);
   398 		test_text	('select#id_role option:eq(1)[value="1"]', 'Manager', hidden);
   398 		test_text	('select#id_role option:eq(2)[value="2"]', 'Editor', non_visible);
   399 		test_text	('select#id_role option:eq(2)[value="2"]', 'Editor', hidden);
   399 		test_text	('select#id_role option:eq(3)[value="3"]', 'Moderator', non_visible);
   400 		test_text	('select#id_role option:eq(3)[value="3"]', 'Moderator', hidden);
   400 		test_text	('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible);
   401 		test_text	('select#id_role option:eq(4)[value="4"]', 'Commentator', hidden);
   401 		test_text	('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible);
   402 		test_text	('select#id_role option:eq(5)[value="5"]', 'Observer', hidden);
   402 		test_val	('#user :input:eq(4)[type=submit]', 'Add users');
   403 		test_val	('#user :input:eq(4)[type=submit]', 'Add users');
   403 		test_val	('#user :input:eq(5)#cancel_button[type=button]', 'Cancel');
   404 		test_val	('#user :input:eq(5)#cancel_button[type=button]', 'Cancel');
   404 		// X TOTEST add users (pending) -> can't be deleted
   405 		// X TOTEST add users (pending) -> can't be deleted
   405 		test_unlogged_footer ();
   406 		test_unlogged_footer ();
   406 		test_submit('#user input[type="submit"]');
   407 		test_click	('#user input[type="submit"]', wait_page_load);
   407 		test_count	('div.help_text span.error-text', 1);
   408 		test_count	('div.help_text span.error-text', 1);
   408 		test_field	('user div.error', 'id_email', 'textarea', 0, 'Emails', true);
   409 		test_field	('user div.error', 'id_email', 'textarea', 0, 'Emails', true);
   409 		test_match	('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m);
   410 		test_match	('#user div.help_text:eq(0) span.error-text:eq(0)', /This field is required/m);
   410 	});
   411 	});
   411 
   412 
   419 		test_field	('settings', 'id_workspace_name', 'text', 0, 'Workspace name');
   420 		test_field	('settings', 'id_workspace_name', 'text', 0, 'Workspace name');
   420 		test_field	('settings', 'id_workspace_tagline', 'text', 1, 'Workspace tagline');
   421 		test_field	('settings', 'id_workspace_tagline', 'text', 1, 'Workspace tagline');
   421 		test_field	('settings', 'id_workspace_registration', 'checkbox', 2, 'Workspace registration');
   422 		test_field	('settings', 'id_workspace_registration', 'checkbox', 2, 'Workspace registration');
   422 		test_field	('settings', 'id_workspace_registration_moderation', 'checkbox', 3, 'Workspace registration moderation');
   423 		test_field	('settings', 'id_workspace_registration_moderation', 'checkbox', 3, 'Workspace registration moderation');
   423 		test_field	('settings', 'id_workspace_role_model', 'select', 4, 'Role model');
   424 		test_field	('settings', 'id_workspace_role_model', 'select', 4, 'Role model');
   424 		test_text	('select#id_workspace_role_model option:eq(0)[selected][value="generic"]', 'Generic', non_visible);
   425 		test_text	('select#id_workspace_role_model option:eq(0)[selected][value="generic"]', 'Generic', hidden);
   425 		test_text	('select#id_workspace_role_model option:eq(1)[value="teacher"]', 'Class (education)', non_visible);
   426 		test_text	('select#id_workspace_role_model option:eq(1)[value="teacher"]', 'Class (education)', hidden);
   426 		test_field	('settings', 'id_workspace_category_1', 'text', 5, 'Label for the first category of comments');
   427 		test_field	('settings', 'id_workspace_category_1', 'text', 5, 'Label for the first category of comments');
   427 		test_field	('settings', 'id_workspace_category_2', 'text', 6, 'Label for the second category of comments');
   428 		test_field	('settings', 'id_workspace_category_2', 'text', 6, 'Label for the second category of comments');
   428 		test_field	('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments');
   429 		test_field	('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments');
   429 		test_field	('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments');
   430 		test_field	('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments');
   430 		test_field	('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments');
   431 		test_field	('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments');
   529 	test ('fill content', dsl(function (){
   530 	test ('fill content', dsl(function (){
   530 		elt ('#id_content').val (c['texts'][i]['#id_content']);
   531 		elt ('#id_content').val (c['texts'][i]['#id_content']);
   531 	}));
   532 	}));
   532 
   533 
   533 	test_fill_field ('#id_tags', c['texts'][i]);
   534 	test_fill_field ('#id_tags', c['texts'][i]);
   534 	test_submit ('#save_button');
   535 	test_click	 ('#save_button', wait_page_load);
   535 	t.text_nb++;
   536 	t.text_nb++;
   536 }
   537 }