test-suite/tests/012_comt-admin-text-list.js
author ymh <ymh.work@gmail.com>
Wed, 30 Apr 2014 12:02:50 +0200
changeset 642 5d037d947cd6
parent 638 61dc5370b351
child 646 24067001082c
permissions -rw-r--r--
Integrate last change on test suite. rename specific files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     1
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     2
// " Vim settings
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     3
// set tabstop=4          " number of spaces in a tab
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     4
// set softtabstop=4      " as above
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     5
// set shiftwidth=4       " as above
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     6
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     7
var long_text = '';
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     8
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     9
for (var i = 20; i--;)
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    10
    long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>';
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    11
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    12
const ctexts = [ 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    13
    { 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    14
        '#id_title':    'Text One Sopinspace-Test éléguant', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    15
        '#id_format':   'markdown', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    16
        '#id_content':  'Contenu du premier texte.\nSur plusieurs lignes\nPour tester un cas réaliste', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    17
        '#id_tags':     'test_text, Text Premier' 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    18
    }, 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    19
    { 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    20
        '#id_title':    'Text Two Sopinspace-Test éléguant', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    21
        '#id_format':   'rst', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    22
        '#id_content':  'Contenu du deuxième texte.\nSur plusieurs lignes aussi\nPour tester un cas réaliste', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    23
        '#id_tags':     'test_text, Text Second' 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    24
    }, 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    25
    { 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    26
        '#id_title':    'Text Three Sopinspace-Test éléguant', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    27
        '#id_format':   'html', 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    28
        '#id_content':  long_text, 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    29
        '#id_tags':     'test_text, Text Troisième' 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    30
    } 
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    31
];
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    32
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    33
suite ('comt admin text list', function () {
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    34
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    35
    this.timeout(200000);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    36
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    37
    suite ('empty texts list page conformity', function () {
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    38
        test_page_loading   ('/text/', 'Texts\n - '+C['#id_workspace_name']);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    39
        test_comt_logged_header  (C.W.USER_ADMIN);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    40
        test_comt_default_tabs   (test_comt.text_nb, test_comt.user_nb);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    41
        test_count  ('#text ul.sub_list:eq(0) a', 3);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    42
        test_text   ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    43
        test_text   ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    44
        test_text   ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    45
        test_match  ('#text', /No texts yet/m);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    46
        test_count  ('#texts_form :input', 0);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    47
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    48
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    49
    suite ('create texts', function () {
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    50
        for (var j=4; j--;)
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    51
            for (var i=3; i--;)
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    52
                 test_comt_create_text (ctexts[i]);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    53
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    54
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    55
    suite ('texts list page conformity', function () {
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    56
        test_page_loading   ('/text/', 'Texts\n - '+C['#id_workspace_name']);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    57
        test_comt_logged_header  (C.W.USER_ADMIN);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    58
        test_comt_default_tabs   (test_comt.text_nb, test_comt.user_nb);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    59
        test_count  ('#text ul.sub_list:eq(0) a', 3);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    60
        test_text   ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    61
        test_text   ('#text ul.sub_list:eq(0) a:eq(1)[href="/create/upload/"]', 'Upload a text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    62
        test_text   ('#text ul.sub_list:eq(0) a:eq(2)[href="/create/import/"]', 'Import a co-mented text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    63
        test_count  ('form#filter_form[action="."] :input', 1);
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    64
        test_text   ('select#tag_selected option:eq(0)[selected][value="0"]', '- All -', C.HIDDEN);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    65
        test_text   ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', C.HIDDEN);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    66
        test_text   ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', C.HIDDEN);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    67
        test_val    ('form#texts_form input#apply[type=button][disabled]', 'Apply');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    68
        test_count  ('table.large_table:eq(1) th', 6);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    69
        test_val    ('table.large_table:eq(1) th:eq(0) input#all_check[type="checkbox"]', 'on');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    70
        test_text   ('table.large_table:eq(1) th:eq(1) a[href="?order=title"]', 'Text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    71
        test_text   ('table.large_table:eq(1) th:eq(2)', 'Author');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    72
        test_text   ('table.large_table:eq(1) th:eq(3) a[href="?order=-modified"]', 'Modified');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    73
        test_text   ('table.large_table:eq(1) th:eq(4)', '# comments');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    74
        test_text   ('table.large_table:eq(1) th:eq(5)', 'Last week activity');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    75
        test_comt_unlogged_footer ();
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    76
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    77
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    78
    suite ('texts list filter', function () {
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    79
        test_page_loading ('/text/?tag_selected=Text+Troisième', 'Texts\n - '+C['#id_workspace_name']);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    80
        test_count  ('#texts_form :input', 4 + 3);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    81
        test_match  ('#paginator', /\s1-4 of 4\s/m);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    82
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    83
        for (var i=4; i--;) {
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    84
            test_text   ('a.main_object_title:eq('+i+')', ctexts[2]['#id_title']);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    85
            test_match  ('.tag_list:eq('+i+')', /tags: test_text Text Troisième /);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    86
            test_text   ('.tag_list:eq('+i+') a:eq(0)[href="?tag_selected=test_text"]', 'test_text');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    87
            test_text   ('.tag_list:eq('+i+') a:eq(1)[href="?tag_selected=Text+Troisi%C3%A8me"]','Text Troisième');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    88
            test_text   ('#text .hidden-text-actions:eq('+i+') a:eq(0)[href^="/text/"][href$="/view/"]', 'View');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    89
            test_text   ('#text .hidden-text-actions:eq('+i+') a:eq(1)[href^="/text/"][href$="/edit/"]', 'Edit');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    90
            test_text   ('#text .hidden-text-actions:eq('+i+') a:eq(2)[href="#"][id*="text-delete-"]', 'Delete');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    91
            test_text   ('#text .hidden-text-actions:eq('+i+') a:eq(3)[href^="/text/"][href$="/share/"]', 'Users');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    92
            test_text   ('#text .hidden-text-actions:eq('+i+') a:eq(4)[href^="/text/"][href$="/settings/"]', 'Settings');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    93
            test_text   ('#text a[title="Edit user"][href^="/user/"][href$="/edit/"]:eq('+i+')', 'admin');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    94
            test_text   ('#text table[summary="text list"] tr:eq('+(i+1)+') td:eq(4)', '0');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    95
        }
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    96
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    97
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    98
    suite ('texts list pagination conformity', function () {
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
    99
        test_page_loading ('/text/', 'Texts\n - '+C['#id_workspace_name']);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   100
        test_count  ('#texts_form :input', (test_comt.text_nb < 10 ? test_comt.text_nb : 10) + 3);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   101
        test_match  ('#paginator', new RegExp ('\\s1-10 of '+test_comt.text_nb+'\\s','m'));
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   102
        test_text   ('#paginator a:eq(0)[href="?page=2"]', '»');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   103
        test_text   ('#paginator a:eq(1)[href="?paginate=0"]', 'all');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   104
        test_click  ('#paginator a:eq(0)[href="?page=2"]');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   105
        test_match  ('#paginator', new RegExp ('\\s11-12 of '+test_comt.text_nb+'\\s','m'));
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   106
        test_count  ('#texts_form :input', test_comt.text_nb % 10 + 3);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   107
        test_click  ('#paginator a:eq(0)[href="?page=1"]');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   108
        test_match  ('#paginator', new RegExp ('\\s1-10 of '+test_comt.text_nb+'\\s','m'));
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   109
        test_count  ('#texts_form :input', (test_comt.text_nb < 10 ? test_comt.text_nb : 10) + 3);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   110
        test_click  ('#paginator a:eq(1)[href="?paginate=0&page=1"]');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   111
        test_match  ('#paginator', /\s\(paginate\)\s/m);
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   112
        test_count  ('#texts_form :input', test_comt.text_nb + 3);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   113
        test_click  ('#paginator a:eq(0)[href="?paginate=&page=1"]');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   114
        test_count  ('#texts_form :input', (test_comt.text_nb < 10 ? test_comt.text_nb : 10) + 3);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   115
        test_match  ('#paginator', new RegExp ('\\s1-10 of '+test_comt.text_nb+'\\s','m'));
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   116
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   117
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   118
    suite ('texts list bulk deletion', function () {
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   119
        test_page_loading ('/text/?page=2', 'Texts\n - '+C['#id_workspace_name']);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   120
        test        ('choose bulk action Delete', dsl(function () { input('#bulk_actions').option('delete'); }));
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   121
        test_click  ('#all_check');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   122
        test_count  ('form#texts_form input:checked', test_comt.text_nb % 10 + 1);
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   123
        test_val    ('form#texts_form input#apply[type=button]:not([disabled])', 'Apply');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   124
        /* test_click   ('#texts_form #apply'); // can't click on the confirm dialog */
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   125
        test_submit ('#texts_form');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   126
        test_page_loading ('/text/', 'Texts\n - '+C['#id_workspace_name']);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   127
        test_comt.text_nb -= 2;
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   128
        test_count  ('form#texts_form :input', test_comt.text_nb + 3);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   129
        test_match  ('#paginator', new RegExp ('\\s1-'+test_comt.text_nb+' of '+test_comt.text_nb+'\\s','m'));
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   130
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   131
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   132
    suite ('texts list single deletion', function () {
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   133
        test        ('choose bulk action Delete', dsl(function () { input('#bulk_actions').option('delete'); }));
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   134
        test_click  ('.text_check:eq(0)');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   135
        test_count  ('form#texts_form input:checked', 1);
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   136
        test_val    ('form#texts_form input#apply[type=button]:not([disabled])', 'Apply');
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   137
        test_submit ('#texts_form');
638
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   138
        test_page_loading ('/text/', 'Texts\n - '+C['#id_workspace_name']);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   139
        test_comt.text_nb -= 1;
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   140
        test_count  ('form#texts_form :input', test_comt.text_nb + 3);
61dc5370b351 start building a COMT test API, automate testserver starting and stopping
Simon Descarpentries <sid@sopinspace.com>
parents: 637
diff changeset
   141
        test_match  ('#paginator', new RegExp ('\\s1-'+test_comt.text_nb+' of '+test_comt.text_nb+'\\s','m'));
637
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   142
    });
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   143
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   144
});
71d87ca43d6a Integration of django testserver start in start-test-suite.sh
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   145