test-suite/tests/001_comt_test_utils.js
changeset 646 24067001082c
parent 641 8f7dafe42d15
child 656 a84519031134
equal deleted inserted replaced
641:8f7dafe42d15 646:24067001082c
     6 
     6 
     7 /**
     7 /**
     8  * Constants and variables
     8  * Constants and variables
     9  */
     9  */
    10 
    10 
    11 var test_comt = { 'text_nb': 0,	'user_nb': 4 };
    11 var test_comt = { text_nb: 0, user_nb: 4, long_text: '' };
       
    12 
       
    13 for (var i = 20; i--;)
       
    14     test_comt.long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>';
    12 
    15 
    13 const C = { 'HIDDEN': false,
    16 const C = { 'HIDDEN': false,
    14 	'H': false,
    17 	'H': false,
    15 	'NO_TAGLINE': false,
    18 	'NO_TAGLINE': false,
    16 	'WAIT_PAGE_LOAD': true,
    19 	'WAIT_PAGE_LOAD': true,
    25 	'#id_workspace_category_3': 'ws_cat_3',
    28 	'#id_workspace_category_3': 'ws_cat_3',
    26 	'#id_workspace_category_4': 'ws_cat_4',
    29 	'#id_workspace_category_4': 'ws_cat_4',
    27 	'#id_workspace_category_5': 'ws_cat_5',
    30 	'#id_workspace_category_5': 'ws_cat_5',
    28 	'#id_custom_css': "h2 {  font-family: Test_Sopinspace !important; }",
    31 	'#id_custom_css': "h2 {  font-family: Test_Sopinspace !important; }",
    29 	'#id_custom_font': 'Test_Sopinspace_custom_font',
    32 	'#id_custom_font': 'Test_Sopinspace_custom_font',
    30 	'#id_custom_titles_font': 'Test_Sopinspace_custom_titles_font'
    33 	'#id_custom_titles_font': 'Test_Sopinspace_custom_titles_font',
       
    34 	'TEXTS': [
       
    35 	    {
       
    36 	        '#id_title':    'Text One Sopinspace-Test éléguant',
       
    37 	        '#id_format':   'markdown',
       
    38 	        '#id_content':  'Contenu du premier texte.\nSur plusieurs lignes\nPour tester un cas réaliste',
       
    39 	        '#id_tags':     'test_text, Text Premier'
       
    40 	    },
       
    41 	    {
       
    42 	        '#id_title':    'Text Two Sopinspace-Test éléguant',
       
    43 	        '#id_format':   'rst',
       
    44 	        '#id_content':  'Contenu du deuxième texte.\nSur plusieurs lignes aussi\nPour tester un cas réaliste',
       
    45 	        '#id_tags':     'test_text, Text Second'
       
    46 	    },
       
    47 	    {
       
    48 	        '#id_title':    'Text Three Sopinspace-Test éléguant',
       
    49     	    '#id_format':   'html',
       
    50 	        '#id_content':  test_comt.long_text,
       
    51 	        '#id_tags':     'test_text, Text Troisième'
       
    52 	    }
       
    53 	],
       
    54 	'USERS': [
       
    55 	    {}, // to start counting at one
       
    56 		// SID roles should be : '', 4, 2, 5 ; but we're facing a bug here 
       
    57 	    { name: 'admin',        email: 'admin@mail.com',            date:'March 8, 2014 at 3:12 p.m.', role:'' },
       
    58 	    { name: 'user-com',     email: 'user-com@example.com',      date:'March 9, 2014 at 2:40 p.m.', role:'5'},
       
    59     	{ name: 'user-edit',    email: 'user-edit@example.com',     date:'March 9, 2014 at 2:40 p.m.', role:'5'},
       
    60 	    { name: 'user-observ',  email: 'user-observ@example.com',   date:'March 9, 2014 at 2:40 p.m.', role:'5'},
       
    61 	    { '#id_tags': 'user-created-1',   '#id_email': 'uc1@example.com',   '#id_role':'2'},
       
    62 	    { '#id_tags': 'user-created-2',   '#id_email': 'uc2@example.com',   '#id_role':'4'}
       
    63 	]
    31 };
    64 };
    32 
    65 
    33 
    66 
    34 /**
    67 /**
    35  * COMT test API
    68  * COMT test API
    63 	}));
    96 	}));
    64 
    97 
    65 	test_fill_field ('#id_tags', t);
    98 	test_fill_field ('#id_tags', t);
    66 	test_click	 ('#save_button', C.WAIT_PAGE_LOAD);
    99 	test_click	 ('#save_button', C.WAIT_PAGE_LOAD);
    67 	test_comt.text_nb++;
   100 	test_comt.text_nb++;
       
   101 }
       
   102 
       
   103 function test_comt_create_user (u) {
       
   104     test_page_loading   ('/user/add/', 'Add a new user\n - '+C['#id_workspace_name']);
       
   105 	test_fill_field ('#id_email', u);
       
   106 	test_fill_field ('#id_tags', u);
       
   107 
       
   108     test ('test creation', dsl(function () {
       
   109         dropdownlist ('#id_role').option (u['#id_role']);
       
   110     }));
       
   111 
       
   112     test_click   ('#user input[type="submit"]', C.WAIT_PAGE_LOAD);
       
   113     test_comt.user_nb++;
    68 }
   114 }
    69 
   115 
    70 
   116 
    71 /**
   117 /**
    72  * Other factorized tests
   118  * Other factorized tests