src/cm/scripts/test-suite/tests/tests.js
changeset 612 2bed79bde721
parent 598 fd0507590413
child 613 a0b695aace0a
equal deleted inserted replaced
607:0cead418e4cb 612:2bed79bde721
    21 	'#id_workspace_category_1':	'ws_cat_1',
    21 	'#id_workspace_category_1':	'ws_cat_1',
    22 	'#id_workspace_category_2':	'ws_cat_2',
    22 	'#id_workspace_category_2':	'ws_cat_2',
    23 	'#id_workspace_category_3':	'ws_cat_3',
    23 	'#id_workspace_category_3':	'ws_cat_3',
    24 	'#id_workspace_category_4':	'ws_cat_4',
    24 	'#id_workspace_category_4':	'ws_cat_4',
    25 	'#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}",
    26 	'#id_custom_css': "h2 {  font-family: Test_Sopinspace !important; }",
    27 	'#id_custom_font': 'Ubuntu',
    27 	'#id_custom_font': 'Test_Sopinspace_custom_font',
    28 	'#id_custom_titles_font': 'Ubuntu Monospaced',
    28 	'#id_custom_titles_font': 'Test_Sopinspace_custom_titles_font',
    29 };
    29 };
    30 
    30 
    31 
    31 
    32 suite ('comt', function () {
    32 suite ('comt', function () {
    33 
    33 
    58 		test_page_loading ('/help/', 'Help');
    58 		test_page_loading ('/help/', 'Help');
    59 		test_unlogged_header ();
    59 		test_unlogged_header ();
    60 		test_unlogged_footer ();
    60 		test_unlogged_footer ();
    61 	});
    61 	});
    62 
    62 
       
    63 	suite ('contact page mandatory field test', function () {
       
    64 		test_page_loading ('/contact/', 'Contact');
       
    65 
       
    66 		test ('submit empty fields', dsl(function () {
       
    67 			elt ('#profile input[type="submit"]').click ();
       
    68 			browser.waitForPageLoad ();
       
    69 		}));
       
    70 		test_count ('div.help_text span.error-text', 4);
       
    71 		test_form_field ('profile div.error', 'id_name', 'text', 0, 'Your name', true); // the field id_name is…
       
    72 		test_form_field ('profile div.error', 'id_email', 'text', 1, 'Your email address', true);
       
    73 		test_form_field ('profile div.error', 'id_title', 'text', 2, 'Subject of the message', true);
       
    74 		test_form_field ('profile div.error', 'id_body', 'textarea', 3, 'Body of the message', true);
       
    75 		test_form_field ('profile', 'id_copy', 'checkbox', 4, 'Send me a copy of the email', false);
       
    76 	});
       
    77 
    63 	suite ('reset password page conformity', function () {
    78 	suite ('reset password page conformity', function () {
    64 		test_page_loading ('/password_reset/', 'Reset my password');
    79 		test_page_loading ('/password_reset/', 'Reset my password');
    65 		test_unlogged_header ();
    80 		test_unlogged_header ();
    66 		test_val	('form#profile[action="."]');
    81 		test_val	('form#profile[action="."]');
    67 		test_count	('form#profile :input', 3);
    82 		test_count	('form#profile :input', 3);
    68 		test_form_field ('profile', 'id_email', 'text', 1, 'E-mail', true);
    83 		test_form_field ('profile', 'id_email', 'text', 1, 'E-mail', true);
    69 		test_val	('#profile input[type=submit]', 'Reset my password');
    84 		test_val	('#profile input[type=submit]', 'Reset my password');
    70 		test_unlogged_footer ();
    85 		test_unlogged_footer ();
       
    86 
       
    87 		test ('submit empty fields', dsl(function () {
       
    88 			elt ('#profile input[type="submit"]').click ();
       
    89 			browser.waitForPageLoad ();
       
    90 		}));
       
    91 
       
    92 		test_count ('div.help_text span.error-text', 1);
       
    93 		test_form_field ('profile div.error', 'id_email', 'text', 0, 'E-mail', true);
    71 	});
    94 	});
    72 
    95 
    73 	suite ('login page conformity', function () {
    96 	suite ('login page conformity', function () {
    74 		test_page_loading ('/', 'Home');
    97 		test_page_loading ('/', 'Home');
    75 		test_unlogged_header ();
    98 		test_unlogged_header ();
    76 		test_val	('form#login[action="/login/"]');
    99 		test_val	('form#login[action="/login/"]');
    77 		test_count	('form#login[action="/login/"] :input', 3);
   100 		test_count	('form#login[action="/login/"] :input', 3);
    78 		test_form_field ('login', 'id_username', 'text', 0, 'Username', true);
   101 		test_form_field ('login', 'id_username', 'text', 0, 'Username', true);
    79 		test_form_field ('login', 'id_password', 'password', 1, 'Password', true);
   102 		test_form_field ('login', 'id_password', 'password', 1, 'Password', true);
    80 		test_val ('form#login input[type=submit]', 'Login');
   103 		test_val	('form#login input[type=submit]', 'Login');
    81 		test_text	('form#login a[href="/password_reset/"]', 'Forgot password?');
   104 		test_text	('form#login a[href="/password_reset/"]', 'Forgot password?');
    82 		test_unlogged_footer ();
   105 		test_unlogged_footer ();
    83 		// test_i18n ();
   106 		// test_i18n ();
    84 		test		('logs an admin in', dsl(function () {
   107 
       
   108 		test ('get back to / to avoid bugging next page load', dsl(function () {
       
   109 			browser.navigateTo ('/');
       
   110 		}));
       
   111 		test_page_loading ('/login/', 'Login');
       
   112 		test ('submit empty fields', dsl(function () {
       
   113 			elt ('#login input[type="submit"]').click ();
       
   114 			browser.waitForPageLoad ();
       
   115 		}));
       
   116 		test_form_field ('login div.error', 'id_username', 'text', 0, 'Username', true);
       
   117 		test_form_field ('login div.error', 'id_password', 'password', 1, 'Password', true);
       
   118 		test ('logs an admin in', dsl(function () {
    85 			input ('#id_username').enter (w.USER_ADMIN);
   119 			input ('#id_username').enter (w.USER_ADMIN);
    86 			input ('#id_password').enter (w.PASS_ADMIN);
   120 			input ('#id_password').enter (w.PASS_ADMIN);
    87 			elt ('#login input[type=submit]').click ();
   121 			elt ('#login input[type=submit]').click ();
    88 			// Must be done here in this test() block
   122 			// Must be done here in this test() block
    89 			browser.waitForPageLoad ();
   123 			browser.waitForPageLoad ();
   213         test_count  ('#text ul.sub_list:eq(0) a', 3);
   247         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');
   248         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');
   249         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');
   250         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);
   251         test_count  ('#text form[action="."]:eq(0) :input', 6);
   218 		test_form_field ('text', 'id_title',		'text', 0, 'Title', true);
   252 		test_form_field ('text', 'id_title',	'text', 0, 'Title', true);
   219 		test_form_field ('text', 'id_format',		'select', 1, 'Format', true);
   253 		test_form_field ('text', 'id_format',	'select', 1, 'Format', true);
   220 		test_form_field ('text', 'id_content',		'textarea', 2, 'Content', true);
   254 		test_form_field ('text', 'id_content',	'textarea', 2, 'Content', true);
   221 		test_form_field ('text', 'id_tags',			'text', 3, 'Tags');
   255 		test_form_field ('text', 'id_tags',		'text', 3, 'Tags');
   222 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   256 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   223 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   257 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   224 		test_count	('select#id_format option', 3);
   258 		test_count	('select#id_format option', 3);
   225         test_text   ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible);
   259         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);
   260         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);
   261         test_text   ('select#id_format option:eq(2)[value="html"]', 'html', non_visible);
   228 		test_count	('#markItUpId_content li', 20);
   262 		test_count	('#markItUpId_content li', 20); // How many buttons are in the WYSIWYG editor toolbar ?
       
   263 		test ('submit empty fields', dsl(function () {
       
   264 			elt ('#text input[type="submit"]').click ();
       
   265 			browser.waitForPageLoad ();
       
   266 		}));
       
   267 		test_count ('div.help_text span.error-text', 2);
       
   268 		test_form_field ('text div.error', 'id_title',		'text', 0, 'Title', true);
       
   269 		test_form_field ('text div.error', 'id_content',	'textarea', 2, 'Content', true);
       
   270 
   229         test_unlogged_footer ();
   271         test_unlogged_footer ();
   230     });
   272     });
   231 
   273 
   232 	suite ('upload text page conformity', function () {
   274 	suite ('upload text page conformity', function () {
   233         test_page_loading	('/create/upload/', 'Upload a text - '+t['#id_workspace_name']);
   275         test_page_loading	('/create/upload/', 'Upload a text - '+t['#id_workspace_name']);
   236         test_count  ('#text ul.sub_list:eq(0) a', 3);
   278         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');
   279         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');
   280         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');
   281         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);
   282         test_count  ('#text form[action="."]:eq(0) :input', 6);
   241 		test_form_field ('text', 'id_title',		'text', 0, 'Title');
   283 		test_form_field ('text', 'id_title',	'text', 0, 'Title');
   242 		test_form_field ('text', 'id_format',		'select', 1, 'Format', true);
   284 		test_form_field ('text', 'id_format',	'select', 1, 'Format', true);
   243 		test_form_field ('text', 'id_tags',			'text', 2, 'Tags');
   285 		test_form_field ('text', 'id_tags',		'text', 2, 'Tags');
   244 		test_form_field ('text', 'id_file',			'file', 3, 'Upload file (optional)');
   286 		test_form_field ('text', 'id_file',		'file', 3, 'Upload file (optional)');
   245 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   287 		test_val	('#text :input:eq(4)[type=submit]', 'Save');
   246 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   288 		test_val	('#text :input:eq(5)#cancel_button[type=button]', 'Cancel');
   247 		test_count	('select#id_format option', 3);
   289 		test_count	('select#id_format option', 3);
   248         test_text   ('select#id_format option:eq(0)[value="markdown"][selected]', 'markdown', non_visible);
   290         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);
   291         test_text   ('select#id_format option:eq(1)[value="rst"]', 'rst', non_visible);
   298         test_logged_header	(w.USER_ADMIN);
   340         test_logged_header	(w.USER_ADMIN);
   299         test_default_tabs	();
   341         test_default_tabs	();
   300         test_count  ('#user ul.sub_list:eq(0) a', 2);
   342         test_count  ('#user ul.sub_list:eq(0) a', 2);
   301         test_text   ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user');
   343         test_text   ('#user ul.sub_list:eq(0) a:eq(0)[href="/user/add/"]', 'Add a new user');
   302         test_text   ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk');
   344         test_text   ('#user ul.sub_list:eq(0) a:eq(1)[href="/user/mass-add/"]', 'Add users in bulk');
   303         // TOTEST : filter by tag
   345         // TOTEST : filter by tag -> commentator user should be tagged commentator
   304         test_count  ('form#filter_form[action="."] :input', 1);
   346         test_count  ('form#filter_form[action="."] :input', 1);
   305 		test_text	('#filter_form a[href="?display=1"]', 'Display suspended users');
   347 		test_text	('#filter_form a[href="?display=1"]', 'Display suspended users');
   306         test_text   ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible);
   348         test_text   ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', non_visible);
   307         // TOTEST : pagination
   349         // TOTEST : pagination
   308         // TOTEST : Bulk Actions -> Apply does enable
   350         // TOTEST : Bulk Actions -> Apply does enable
   323         test_text   ('table.large_table:eq(1) th:eq(4) a[href="?order=role__name"]', 'Role');
   365         test_text   ('table.large_table:eq(1) th:eq(4) a[href="?order=role__name"]', 'Role');
   324         test_text   ('table.large_table:eq(1) th:eq(5)', 'Last week activity');
   366         test_text   ('table.large_table:eq(1) th:eq(5)', 'Last week activity');
   325 		test_text	('table.large_table:eq(1) tr:last a[href="/user/-/edit/"]', 'Anonymous users');
   367 		test_text	('table.large_table:eq(1) tr:last a[href="/user/-/edit/"]', 'Anonymous users');
   326 		test_text	('table.large_table:eq(1) a.main_object_title[href="/profile/"]', w.USER_ADMIN);
   368 		test_text	('table.large_table:eq(1) a.main_object_title[href="/profile/"]', w.USER_ADMIN);
   327 		test_text	('table.large_table:eq(1) div.hidden-user-actions a[href="/profile/"]', 'Your profile');
   369 		test_text	('table.large_table:eq(1) div.hidden-user-actions a[href="/profile/"]', 'Your profile');
       
   370 		// TOTEST presence of commentator and editor user
   328         test_unlogged_footer ();
   371         test_unlogged_footer ();
   329     });
   372     });
   330 
   373 
   331 	suite ('check user number', function () {
   374 	suite ('check user number', function () {
   332         test_page_loading	('/user/?display=1', 'People\' list\n - '+t['#id_workspace_name']);
   375         test_page_loading	('/user/?display=1', 'People\' list\n - '+t['#id_workspace_name']);
   367         test_text   ('select#id_role option:eq(4)[value="4"]', 'Commentator', non_visible);
   410         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);
   411         test_text   ('select#id_role option:eq(5)[value="5"]', 'Observer', non_visible);
   369 		test_val	('#user :input:eq(6)[type=submit]', 'Add user');
   412 		test_val	('#user :input:eq(6)[type=submit]', 'Add user');
   370 		test_val	('#user :input:eq(7)#cancel_button[type=button]', 'Cancel');
   413 		test_val	('#user :input:eq(7)#cancel_button[type=button]', 'Cancel');
   371         test_unlogged_footer ();
   414         test_unlogged_footer ();
   372 		// TOTEST add user (pending)
   415 		// X TOTEST add user (pending)
   373     });
   416     });
   374 
   417 
   375 	suite ('add users in bulk page conformity', function () {
   418 	suite ('add users in bulk page conformity', function () {
   376         test_page_loading	('/user/mass-add/', 'Add users in bulk\n - '+t['#id_workspace_name']);
   419         test_page_loading	('/user/mass-add/', 'Add users in bulk\n - '+t['#id_workspace_name']);
   377 		test_logged_header	(w.USER_ADMIN);
   420 		test_logged_header	(w.USER_ADMIN);
   416 		test_form_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments');
   459 		test_form_field ('settings', 'id_workspace_category_3', 'text', 7, 'Label for the third category of comments');
   417 		test_form_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments');
   460 		test_form_field ('settings', 'id_workspace_category_4', 'text', 8, 'Label for the fourth category of comments');
   418 		test_form_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments');
   461 		test_form_field ('settings', 'id_workspace_category_5', 'text', 9, 'Label for the fifth category of comments');
   419 		test_val	('#settings :input:eq(10)[type=submit]', 'Save');
   462 		test_val	('#settings :input:eq(10)[type=submit]', 'Save');
   420 		test_val	('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel');
   463 		test_val	('#settings :input:eq(11)#cancel_button[type=button]', 'Cancel');
   421 		// TOTEST Workspace registration
   464 		// TOTEST Workspace registration feature (with newly accessible page)
   422 		test_unlogged_footer ();
   465 		test_unlogged_footer ();
   423     });
   466     });
   424 
   467 
   425 	suite ('settings design page conformity', function () {
   468 	suite ('settings design page conformity', function () {
   426         test_page_loading	('/settings/design/', 'Settings - '+t['#id_workspace_name']);
   469         test_page_loading	('/settings/design/', 'Settings - '+t['#id_workspace_name']);
   434 		test_form_field ('settings', 'id_custom_font', 'text', 2, 'Custom font');
   477 		test_form_field ('settings', 'id_custom_font', 'text', 2, 'Custom font');
   435 		test_form_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles');
   478 		test_form_field ('settings', 'id_custom_titles_font', 'text', 3, 'Custom font for titles');
   436 		test_val	('#settings :input:eq(4)[type=submit]', 'Save');
   479 		test_val	('#settings :input:eq(4)[type=submit]', 'Save');
   437 		test_val	('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel');
   480 		test_val	('#settings :input:eq(5)#cancel_button[type=button]', 'Cancel');
   438 		test_val	('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo');
   481 		test_val	('#settings :input:eq(6)#delete_logo_button[type=submit]', 'Delete logo');
   439 		// TOTEST custom CSS, font, font for titles like the rest of the settings
       
   440 		test_unlogged_footer ();
   482 		test_unlogged_footer ();
   441     });
   483     });
   442 
   484 
   443 	suite ('followup page conformity', function () {
   485 	suite ('followup page conformity', function () {
   444 		test_page_loading	('/followup/', 'Followup\n - '+t['#id_workspace_name']);
   486 		test_page_loading	('/followup/', 'Followup\n - '+t['#id_workspace_name']);
   450 		test_count	('form#followup_form[action="."] :input', 3);
   492 		test_count	('form#followup_form[action="."] :input', 3);
   451 		test_val	('form#followup_form input[type=submit]', '(Activate private feed|Reset private feed url)');
   493 		test_val	('form#followup_form input[type=submit]', '(Activate private feed|Reset private feed url)');
   452 		test_val	('form#followup_form input#workspace_notify_check[type=checkbox]', 'on');
   494 		test_val	('form#followup_form input#workspace_notify_check[type=checkbox]', 'on');
   453 		test_val	('form#followup_form input#own_notify_check[type=checkbox]', 'on');
   495 		test_val	('form#followup_form input#own_notify_check[type=checkbox]', 'on');
   454 	
   496 	
   455 		// tester qu'une fois cliqué, le bouton à le nvo label, et qu'une adresse est disponible
   497 		// X TOTEST qu'une fois cliqué, le bouton a le nvo label, et qu'une adresse est disponible
   456 		// tester que si on reclique l'adresse est changée
   498 		// X TOTEST que si on reclique l'adresse est changée
   457 
   499 
   458 		test_unlogged_footer ();
   500 		test_unlogged_footer ();
   459 	});
   501 	});
       
   502 
       
   503 	// Tester les créations de textes
       
   504 	// Tester les champs obligatoires
       
   505 	// Tester les liens masqués des textes listés si bien créés
       
   506 	// Tester suppression de text
       
   507 	// Tester bulk actions sur les textes
       
   508 
       
   509 	// tester l'affichage d'un texte
       
   510 	// tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font
       
   511 	// tester que si Text preferences -> custom -> #textcontainer.custom font: Test_Sopinspace_custom_font
       
   512 	// #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace
   460 
   513 
   461 	suite ('settings restoration', function () {
   514 	suite ('settings restoration', function () {
   462         test_page_loading	('/settings/', 'Settings');
   515         test_page_loading	('/settings/', 'Settings');
   463 		test_fill_settings (z);
   516 		test_fill_settings (z);
   464 		test ('Restore settings ', dsl (function () {
   517 		test ('Restore settings ', dsl (function () {
   533 	test_text	('#footer a:nth-of-type(7)[href="/i18n/setlang/es/"]',		'Español');
   586 	test_text	('#footer a:nth-of-type(7)[href="/i18n/setlang/es/"]',		'Español');
   534 	test_text	('#footer a:nth-of-type(8)[href="/i18n/setlang/bg/"]',		'Български');
   587 	test_text	('#footer a:nth-of-type(8)[href="/i18n/setlang/bg/"]',		'Български');
   535 	test_text	('#footer a:nth-of-type(9)[href="/i18n/setlang/it/"]',		'Italiano');
   588 	test_text	('#footer a:nth-of-type(9)[href="/i18n/setlang/it/"]',		'Italiano');
   536 }
   589 }
   537 
   590 
       
   591 function test_readz_field (field_id) {
       
   592 	test ('get '+field_id, dsl(function () {
       
   593 		element (field_id).val (function (v) {
       
   594 			z[field_id] = v;
       
   595 		});
       
   596 	}));
       
   597 }
       
   598 
       
   599 function test_fill_field (field_id, stored) {
       
   600 	test ('set '+field_id, dsl(function () {
       
   601 		input (field_id).enter (stored[field_id]);
       
   602 	}));
       
   603 }
       
   604 
       
   605 function test_fill_settings (s) {
       
   606 	test_fill_field ('#id_workspace_name', s);
       
   607 	test_fill_field ('#id_workspace_tagline', s);
       
   608 	test_fill_field ('#id_workspace_registration', s);
       
   609 	test_fill_field ('#id_workspace_registration_moderation', s);
       
   610 	test_fill_field ('#id_workspace_role_model', s);
       
   611 	test_fill_field ('#id_workspace_category_1', s);
       
   612 	test_fill_field ('#id_workspace_category_2', s);
       
   613 	test_fill_field ('#id_workspace_category_3', s);
       
   614 	test_fill_field ('#id_workspace_category_4', s);
       
   615 	test_fill_field ('#id_workspace_category_5', s);
       
   616 }
       
   617 
       
   618 function test_fill_design (s) {
       
   619 	test_fill_field ('#id_custom_css', s);
       
   620 	test_fill_field ('#id_custom_font', s);
       
   621 	test_fill_field ('#id_custom_titles_font', s);
       
   622 }
       
   623 
   538 function test_i18n () {
   624 function test_i18n () {
   539 	test ('can change lang to french', dsl(function () {
   625 	test ('can change lang to french', dsl(function () {
   540 		element ('#footer a[href="/i18n/setlang/fr/"]').click ();
   626 		element ('#footer a[href="/i18n/setlang/fr/"]').click ();
   541 //		browser.waitForPageLoad ();
   627 //		browser.waitForPageLoad ();
   542 //		browser.navigateTo ('/');
   628 //		browser.navigateTo ('/');
   623 		if (mandatory)
   709 		if (mandatory)
   624 			expect (elt ('label[for='+field_id+'] + span.required_star').val ()).toBeDefined ();
   710 			expect (elt ('label[for='+field_id+'] + span.required_star').val ()).toBeDefined ();
   625 	}));
   711 	}));
   626 }
   712 }
   627 
   713 
   628 function test_readz_field (field_id) {
       
   629 	test ('get '+field_id, dsl(function () {
       
   630 		element (field_id).val (function (v) {
       
   631 			z[field_id] = v;
       
   632 		});
       
   633 	}));
       
   634 }
       
   635 
       
   636 function test_fill_field (field_id, stored) {
       
   637 	test ('set '+field_id, dsl(function () {
       
   638 		input (field_id).enter (stored[field_id]);
       
   639 	}));
       
   640 }
       
   641 
       
   642 function test_fill_settings (s) {
       
   643 	test_fill_field ('#id_workspace_name', s);
       
   644 	test_fill_field ('#id_workspace_tagline', s);
       
   645 	test_fill_field ('#id_workspace_registration', s);
       
   646 	test_fill_field ('#id_workspace_registration_moderation', s);
       
   647 	test_fill_field ('#id_workspace_role_model', s);
       
   648 	test_fill_field ('#id_workspace_category_1', s);
       
   649 	test_fill_field ('#id_workspace_category_2', s);
       
   650 	test_fill_field ('#id_workspace_category_3', s);
       
   651 	test_fill_field ('#id_workspace_category_4', s);
       
   652 	test_fill_field ('#id_workspace_category_5', s);
       
   653 }
       
   654 
       
   655 function test_fill_design (s) {
       
   656 	test_fill_field ('#id_custom_css', s);
       
   657 	test_fill_field ('#id_custom_font', s);
       
   658 	test_fill_field ('#id_custom_titles_font', s);
       
   659 }
       
   660 
       
   661 /** Ensure the given element is visible
   714 /** Ensure the given element is visible
   662  *  s : CSS selector of the DOM element to check
   715  *  s : CSS selector of the DOM element to check
   663  *  v : should the element being visible
   716  *  v : should the element being visible
   664  */
   717  */
   665 function elt (s, v) {
   718 function elt (s, v) {