test-suite/tests/001_comt-logged-admin.js
changeset 625 eb52900a0bbf
parent 624 3dd70d01cec2
equal deleted inserted replaced
624:3dd70d01cec2 625:eb52900a0bbf
     5 // set shiftwidth=4		  " as above
     5 // set shiftwidth=4		  " as above
     6 
     6 
     7 var k = __karma__.config,
     7 var k = __karma__.config,
     8 	test_ = JSON.parse (k.t, new Function (['k','v'], k.r)), // revive helper functions sent from Karma
     8 	test_ = JSON.parse (k.t, new Function (['k','v'], k.r)), // revive helper functions sent from Karma
     9 	t = {'text_nb': 0, 'user_nb': 4};
     9 	t = {'text_nb': 0, 'user_nb': 4};
       
    10 
       
    11 var long_text = '';
       
    12 
       
    13 for (var i = 20; i--;)
       
    14 	long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>';
    10 
    15 
    11 const non_visible = false,
    16 const non_visible = false,
    12 	no_tagline = false,
    17 	no_tagline = false,
    13 	c = {
    18 	c = {
    14 	'#id_workspace_name':	'Test workspace name',
    19 	'#id_workspace_name':	'Test workspace name',
    38 			'#id_tags':		'test_text, Text Second'
    43 			'#id_tags':		'test_text, Text Second'
    39 		},
    44 		},
    40 		{
    45 		{
    41 			'#id_title':	'Text Three Sopinspace-Test éléguant',
    46 			'#id_title':	'Text Three Sopinspace-Test éléguant',
    42 			'#id_format':	'html',
    47 			'#id_format':	'html',
    43 			'#id_content':	'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>',
    48 			'#id_content':	long_text,
    44 			'#id_tags':		'test_text, Text Troisième'
    49 			'#id_tags':		'test_text, Text Troisième'
    45 		}
    50 		}
    46 	]
    51 	]
    47 };
    52 };
    48 
    53 
   183 		test_.field ('text div.error', 'id_file',		'file', 0, 'Upload XML file', true);
   188 		test_.field ('text div.error', 'id_file',		'file', 0, 'Upload XML file', true);
   184 		test_.match	('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m);
   189 		test_.match	('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m);
   185 	});
   190 	});
   186 
   191 
   187 	suite ('create texts', function () {
   192 	suite ('create texts', function () {
   188 /*	'texts':	[
   193 		for (var i=3; i--;)
   189 		{
   194 			create_text (i);
   190 			'#id_title':	'Text One Sopinspace-Test éléguant',
   195 	});
   191 			'#id_format':	'markdown',
       
   192 			'#id_content':	'Contenu du premier texte.\nSur plusieurs lignes\nPour tester un cas réaliste',
       
   193 			'#id_tags':		'test_.text, Text Premier'
       
   194 		},*/
       
   195 		test_.page_loading	('/create/content/', 'Create a text - '+c['#id_workspace_name']);
       
   196 		test ('test creation', dsl(function () {
       
   197 			dropdownlist ('#id_format').option (c['texts'][0]['#id_format']);
       
   198 		}));
       
   199 		test_.fill_field ('#id_title', c['texts'][0]);
       
   200 		test_.fill_field ('#id_content', c['texts'][0]);
       
   201 		test_.fill_field ('#id_tags', c['texts'][0]);
       
   202 		test_.val ('#id_title', 'Text One Sopinspace-Test éléguant');
       
   203 		//test_.pause ();
       
   204 		//test_.submit ('#save_button');
       
   205 		//t.text_nb++;
       
   206 	});
       
   207 	// insert here text creation
       
   208 	// create successively : a markdown text, a html and a rst one
       
   209 	// with tags
       
   210 
   196 
   211 	// check that public texts still work while unlogged
   197 	// check that public texts still work while unlogged
   212 	// check that non public texts are unavailable
   198 	// check that non public texts are unavailable
   213 	// Are the public texts displayed in the login page ?
   199 	// Are the public texts displayed in the login page ?
   214 
   200 
   220 	// tester l'affichage d'un texte
   206 	// tester l'affichage d'un texte
   221 	// tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font
   207 	// tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font
   222 	// 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
   223 	// #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace
   209 	// #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace
   224 
   210 
   225 	suite.skip ('texts list page conformity', function () {
   211 	suite ('texts list page conformity', function () {
   226 		test_.page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
   212 		test_.page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
   227 		test_logged_header	(k.w.USER_ADMIN);
   213 		test_logged_header	(k.w.USER_ADMIN);
   228 		test_default_tabs	(t.text_nb, t.user_nb);
   214 		test_default_tabs	(t.text_nb, t.user_nb);
   229 		test_.count	('#text ul.sub_list:eq(0) a', 3);
   215 		test_.count	('#text ul.sub_list:eq(0) a', 3);
   230 		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');
   487 function test_fill_design (s) {
   473 function test_fill_design (s) {
   488 	test_.fill_field ('#id_custom_css', s);
   474 	test_.fill_field ('#id_custom_css', s);
   489 	test_.fill_field ('#id_custom_font', s);
   475 	test_.fill_field ('#id_custom_font', s);
   490 	test_.fill_field ('#id_custom_titles_font', s);
   476 	test_.fill_field ('#id_custom_titles_font', s);
   491 }
   477 }
       
   478 
       
   479 function create_text (i) {
       
   480 	test_.page_loading	('/create/content/', 'Create a text - '+c['#id_workspace_name']);
       
   481 	test ('test creation', dsl(function () {
       
   482 		dropdownlist ('#id_format').option (c['texts'][i]['#id_format']);
       
   483 	}));
       
   484 
       
   485 	test_.fill_field ('#id_title', c['texts'][i]);
       
   486 	test ('fill content', dsl(function (){
       
   487 		test_.elt ('#id_content').val (c['texts'][i]['#id_content']);
       
   488 	}));
       
   489 
       
   490 	test_.fill_field ('#id_tags', c['texts'][i]);
       
   491 	test_.submit ('#save_button');
       
   492 	t.text_nb++;
       
   493 }