test-suite/tests/002_comt-logged-admin.js
changeset 637 71d87ca43d6a
parent 636 a8ab808d33c3
--- a/test-suite/tests/002_comt-logged-admin.js	Mon Apr 14 20:51:24 2014 +0200
+++ b/test-suite/tests/002_comt-logged-admin.js	Thu Apr 17 18:38:19 2014 +0200
@@ -5,11 +5,7 @@
 // set shiftwidth=4		  " as above
 
 var w = __karma__.config.w,
-	t = {'text_nb': 0, 'user_nb': 4},
-	long_text = '';
-
-for (var i = 20; i--;)
-	long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>';
+	t = {'text_nb': 0, 'user_nb': 4};
 
 const hidden = false,
 	no_tagline = false,
@@ -27,35 +23,15 @@
 	'#id_workspace_category_5':	'ws_cat_5',
 	'#id_custom_css': "h2 {  font-family: Test_Sopinspace !important; }",
 	'#id_custom_font': 'Test_Sopinspace_custom_font',
-	'#id_custom_titles_font': 'Test_Sopinspace_custom_titles_font',
-	'texts':	[
-		{
-			'#id_title':	'Text One Sopinspace-Test éléguant',
-			'#id_format':	'markdown',
-			'#id_content':	'Contenu du premier texte.\nSur plusieurs lignes\nPour tester un cas réaliste',
-			'#id_tags':		'test_text, Text Premier'
-		},
-		{
-			'#id_title':	'Text Two Sopinspace-Test éléguant',
-			'#id_format':	'rst',
-			'#id_content':	'Contenu du deuxième texte.\nSur plusieurs lignes aussi\nPour tester un cas réaliste',
-			'#id_tags':		'test_text, Text Second'
-		},
-		{
-			'#id_title':	'Text Three Sopinspace-Test éléguant',
-			'#id_format':	'html',
-			'#id_content':	long_text,
-			'#id_tags':		'test_text, Text Troisième'
-		}
-	]
+	'#id_custom_titles_font': 'Test_Sopinspace_custom_titles_font'
 };
 
 suite ('comt logged admin', function () {
 
-	this.timeout(200000);
+	this.timeout(20000);
 
 	suite ('logs as an admin', function () {
-		test ('logs an admin in', dsl(function () {
+		test ('with '+w.USER_ADMIN+' - '+w.PASS_ADMIN, dsl(function () {
 			browser.navigateTo ('/');
 			input ('#id_username').enter (w.USER_ADMIN);
 			input ('#id_password').enter (w.PASS_ADMIN);
@@ -104,18 +80,6 @@
 		test_unlogged_footer ();
 	});
 
-	suite ('empty texts list page conformity', function () {
-		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
-		test_logged_header	(w.USER_ADMIN);
-		test_default_tabs	(t.text_nb, t.user_nb);
-		test_count	('#text ul.sub_list:eq(0) a', 3);
-		test_text	('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text');
-		test_text	('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text');
-		test_text	('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text');
-		test_match	('#text', /No texts yet/m);
-		test_count	('#texts_form :input', 0);
-	});
-
 	suite ('create a text page conformity', function () {
 		test_page_loading	('/create/content/', 'Create a text - '+c['#id_workspace_name']);
 		test_logged_header	(w.USER_ADMIN);
@@ -188,98 +152,6 @@
 		test_match	('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m);
 	});
 
-	suite ('create texts', function () {
-		for (var j=4; j--;)
-			for (var i=3; i--;)
-				 create_text (i);
-	});
-
-	// check that public texts still worwhile unlogged
-	// check that non public texts are unavailable
-	// Are the public texts displayed in the login page ?
-
-	// vérifier les valeurs de settings sauvées
-	// Tester les liens masqués des textes listés si bien créés
-	// Tester suppression de text
-	// Tester bulk actions sur les textes
-
-	// tester l'affichage d'un texte
-	// tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font
-	// tester que si Text preferences -> custom -> #textcontainer.custom font: Test_Sopinspace_custom_font
-	// #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace
-
-	suite ('texts list page conformity', function () {
-		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
-		test_logged_header	(w.USER_ADMIN);
-		test_default_tabs	(t.text_nb, t.user_nb);
-		test_count	('#text ul.sub_list:eq(0) a', 3);
-		test_text	('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text');
-		test_text	('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text');
-		test_text	('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text');
-		test_count	('form#filter_form[action="."] :input', 1);
-		test_text	('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', hidden);
-		test_page_loading ('/text/?tag_selected=Text+Troisième', 'Texts\n - '+c['#id_workspace_name']);
-		test_count	('#texts_form :input', 4 + 3);
-		test_match	('#paginator', /\s1-4 of 4\s/m);
-
-		for (var i=4; i--;) {
-			test_text	('a.main_object_title:eq('+i+')', c.texts[2]['#id_title']);
-			test_match	('.tag_list:eq('+i+')', /tags: test_text Text Troisième /);
-			test_text	('.tag_list:eq('+i+') a:eq(0)[href="?tag_selected=test_text"]', 'test_text');
-			test_text	('.tag_list:eq('+i+') a:eq(1)[href="?tag_selected=Text+Troisi%C3%A8me"]','Text Troisième');
-			test_text	('#text .hidden-text-actions:eq('+i+') a:eq(0)[href^="/text/"][href$="/view/"]', 'View');
-			test_text	('#text .hidden-text-actions:eq('+i+') a:eq(1)[href^="/text/"][href$="/edit/"]', 'Edit');
-			test_text	('#text .hidden-text-actions:eq('+i+') a:eq(2)[href$="#"][id*=delete]', 'Delete');
-			test_text	('#text .hidden-text-actions:eq('+i+') a:eq(3)[href^="/text/"][href$="/share/"]', 'Users');
-			test_text	('#text .hidden-text-actions:eq('+i+') a:eq(4)[href^="/text/"][href$="/settings/"]', 'Settings');
-			test_text	('#text a[title="Edit user"][href^="/user/"][href$="/edit/"]:eq('+i+')', 'admin');
-			test_text	('#text table[summary="text list"] tr:eq('+(i+1)+') td:eq(4)', '0');
-		}
-
-		test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']);
-		test_count	('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3);
-		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
-		test_text	('#paginator a:eq(0)[href="?page=2"]', '»');
-		test_text	('#paginator a:eq(1)[href="?paginate=0"]', 'all');
-		test_click	('#paginator a:eq(0)[href="?page=2"]');
-		test_match	('#paginator', new RegExp ('\\s11-12 of '+t.text_nb+'\\s','m'));
-		test_count	('#texts_form :input', t.text_nb % 10 + 3);
-		test_click	('#paginator a:eq(0)[href="?page=1"]');
-		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
-		test_count	('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3);
-		test_click	('#paginator a:eq(1)[href="?paginate=0&page=1"]');
-		test_match	('#paginator', /\s\(paginate\)\s/m);
-		test_count	('#texts_form :input', t.text_nb + 3);
-		test_click	('#paginator a:eq(0)[href="?paginate=&page=1"]');
-		test_count	('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3);
-		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
-		test_page_loading	('/text/', 'Texts\n - '+c['#id_workspace_name']);
-		test_text	('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', hidden);
-		test_text	('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', hidden);
-		test_val	('form#texts_form input#apply[type=button][disabled]', 'Apply');
-		test_count	('table.large_table:eq(1) th', 6);
-		test_val	('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on');
-		test_text	('table.large_table:eq(1) th:eq(1) a[href="?order=title"]', 'Text');
-		test_text	('table.large_table:eq(1) th:eq(2)', 'Author');
-		test_text	('table.large_table:eq(1) th:eq(3) a[href="?order=-modified"]', 'Modified');
-		test_text	('table.large_table:eq(1) th:eq(4)', '# comments');
-		test_text	('table.large_table:eq(1) th:eq(5)', 'Last week activity');
-		test_page_loading ('/text/?page=2', 'Texts\n - '+c['#id_workspace_name']);
-		test		('choose bulk action Delete', dsl(function () { input ('#bulk_actions').option ('delete'); }));
-		test_click	('#all_check');
-		test_count	('form#texts_form input:checked', t.text_nb % 10 + 1);
-		test_val	('form#texts_form input#apply[type=button]:not([disabled])', 'Apply');
-		// test_click	('#texts_form #apply'); // can't click on the confirm dialog
-		test_submit	('#texts_form');
-		test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']);
-		t.text_nb -= 2;
-		test_count	('form#texts_form :input', t.text_nb + 3);
-		test_match	('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m'));
-		// TOTEST : unitary delete 
-
-		test_unlogged_footer ();
-	});
-
 	suite ('edit profile page conformity', function () {
 		test_page_loading	('/profile/', 'Your profile \\('+w.USER_ADMIN+'\\)\n - '+c['#id_workspace_name']);
 		test_logged_header	(w.USER_ADMIN, no_tagline);
@@ -519,19 +391,3 @@
 	test_fill_field ('#id_custom_font', s);
 	test_fill_field ('#id_custom_titles_font', s);
 }
-
-function create_text (i) {
-	test_page_loading	('/create/content/', 'Create a text - '+c['#id_workspace_name']);
-	test ('test creation', dsl(function () {
-		dropdownlist ('#id_format').option (c['texts'][i]['#id_format']);
-	}));
-
-	test_fill_field ('#id_title', c['texts'][i]);
-	test ('fill content', dsl(function (){
-		elt ('#id_content').val (c['texts'][i]['#id_content']);
-	}));
-
-	test_fill_field ('#id_tags', c['texts'][i]);
-	test_click	 ('#save_button', wait_page_load);
-	t.text_nb++;
-}