src/cm/scripts/test-suite/tests/tests.js
author Simon Descarpentries <sid@sopinspace.com>
Thu, 27 Feb 2014 19:18:08 +0100
changeset 582 63b489ad02a3
parent 581 d50d457e7e39
child 583 084934fe912e
permissions -rw-r--r--
rewritting and new tests
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
575
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     1
577
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
     2
// try to login
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
     3
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
     4
// create texts and co-ments
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
     5
// collect newly created URLs
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
     6
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
     7
// Get workspace name, public texts…
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
     8
577
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
     9
// unlog
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
    10
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
    11
// check that public texts still work while unlogged
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    12
// check that non public texts are unavailable
577
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
    13
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    14
// Is the workspace name correctly displayed ? 
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    15
// Are the public texts displayed in the login page ?
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    16
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    17
var w = __karma__.config.w;
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    18
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    19
suite ('comt', function () {
575
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    20
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    21
	this.timeout(150000);
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    22
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    23
	suite ('contact page', function () {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    24
		test_page_loading ('/contact/', 'Contact');
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    25
		test_unlogged_header ();
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    26
		test_val ('form#profile[action="."]'); // the form exists
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    27
		test_count ('form#profile .label', 5); // it has no more than 5 labels (may be no more fields)
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    28
		test_form_field ('profile', 'id_name', 'text', 0, 'Your name', true); // the field id_name is…
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    29
		test_form_field ('profile', 'id_email', 'text', 1, 'Your email address', true);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    30
		test_form_field ('profile', 'id_title', 'text', 2, 'Subject of the message', true);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    31
		test_form_field ('profile', 'id_body', 'textarea', 3, 'Body of the message', true);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    32
		test_form_field ('profile', 'id_copy', 'checkbox', 4, 'Send me a copy of the email', false);
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    33
		test_val ('#profile input[type=submit]','Send'); // test that a the .val() of the element is
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    34
		test_val ('input#cancel_button[type=button]', 'Cancel');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    35
		test_unlogged_footer ();
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    36
		test ('to check that toBeDefined test still works', dsl(function () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    37
			expect (elt ('#header_controls a[href="/xxx/"]').val ()).not ().toBeDefined ();
577
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
    38
		}));
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    39
		test ('get back to / to avoid bugging next page load', dsl(function () {
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    40
			browser.navigateTo ('/');
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    41
		}));
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    42
	});
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    43
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    44
	suite ('help page', function () {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    45
		test_page_loading ('/help/', 'Help');
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    46
		test_unlogged_header ();
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    47
		test_unlogged_footer ();
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    48
	});
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    49
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    50
	suite ('reset password page', function () {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    51
		test_page_loading ('/password_reset/', 'Reset my password');
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    52
		test_unlogged_header ();
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    53
		test_val ('form#profile[action="."]');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    54
		test_count ('form#profile .label', 1);
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    55
		test_form_field ('profile', 'id_email', 'text', 1, 'E-mail', true);
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    56
		test_val ('#profile input[type=submit]', 'Reset my password');
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    57
		test_unlogged_footer ();
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    58
	});
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    59
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    60
	suite ('login page', function () {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    61
		test_page_loading ('/', 'Home');
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    62
		test_unlogged_header ();
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    63
		test_val ('form#login[action="/login/"]');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    64
		test_count ('form#login[action="/login/"] .label', 2);
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    65
		test_form_field ('login', 'id_username', 'text', 0, 'Username', true);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    66
		test_form_field ('login', 'id_password', 'password', 1, 'Password', true);
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    67
		test_val ('form#login input[type=submit]', 'Login');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    68
		test_text ('form#login a[href="/password_reset/"]', 'Forgot password?');
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    69
		test_unlogged_footer ();
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    70
		// test_i18n ();
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    71
		test ('logs an admin in', dsl(function () {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    72
			input ('#id_username').enter (w.USER_ADMIN);
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    73
			input ('#id_password').enter (w.PASS_ADMIN);
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    74
			elt ('#login input[type=submit]').click ();
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    75
			// Must be done here in this test() block
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    76
			browser.waitForPageLoad ();
575
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    77
			browser.navigateTo ('/');
577
65fab7b5ce5e Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents: 575
diff changeset
    78
			expect (element ('title').text ()).toMatch (/Dashboard/m);
575
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    79
		}));
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    80
	});
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
    81
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    82
	suite ('admin dashboard', function () {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    83
		// Should starts with :
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    84
		// test_page_loading ('/', 'Dashboard');
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    85
		// But its the last thing we did in the previous test
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
    86
		test_logged_header (w.USER_ADMIN);
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
    87
		test_default_tabs ();
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    88
		test_count	('table.dash_table', 5);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    89
		test_text	('table.dash_table th:eq(0)', 'Actions');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    90
		test_match	('table.dash_table:eq(0) a:eq(0)[href="/create/content/"]', /\sCreate a text/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    91
		test_text	('table.dash_table:eq(0) a:eq(1).tip[href="#"]', ' ');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    92
		test_match	('table.dash_table:eq(0) a:eq(2)[href="/create/upload/"]', /\sUpload a text/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    93
		test_text	('table.dash_table:eq(0) a:eq(3).tip[href="#"]', ' ');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    94
		test_match	('table.dash_table:eq(0) a:eq(4)[href="/create/import/"]', /\sImport a co-mented text/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    95
		test_text	('table.dash_table:eq(0) a:eq(5).tip[href="#"]', ' ');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    96
		test_match	('table.dash_table:eq(0) a:eq(6)[href="/user/add/"]', /\sInvite user/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    97
		test_match	('table.dash_table:eq(0) a:eq(7)[href="/profile/"]', /\sEdit your profile/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    98
		test_match	('table.dash_table:eq(0) a:eq(8)[href="/text/"]', /\sView text list/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
    99
		test_match	('table.dash_table:eq(0) a:eq(9)[href="/settings/"]', /\sConfigure workspace/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   100
		test_text	('table.dash_table th:eq(1)', 'Recent texts (all)');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   101
		test_text	('table.dash_table:eq(1) a:eq(0)[href="/text/"]', 'all');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   102
		test_text	('table.dash_table th:eq(2)', 'Recent comments');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   103
		test_match	('table.dash_table th:eq(3)', /^Workspace activity\n\s+\(month\/week\/24 hours\)$/m);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   104
		test_text	('table.dash_table:eq(3) a:eq(0)[href="?span=month"]', 'month');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   105
		test_text	('table.dash_table:eq(3) a:eq(1)[href="?span=day"]', '24 hours');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   106
		test_text	('table.dash_table th:eq(4) span.em', 'Activities');
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
   107
		test_unlogged_footer ();
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   108
	});
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   109
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   110
	suite ('followup', function () {
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   111
		test_page_loading ('/followup/', 'Followup');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   112
		test_text	('#followup a:eq(0)[href="/help/#public_private_feed"]', '?');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   113
		test_match	('#followup a:eq(1)[href$="/feed/"]', new RegExp (w.WORKSPACE_URL+'feed/', 'm'));
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   114
		test_text	('#followup a:eq(2)[href="/help/#public_private_feed"]', '?');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   115
		test_count	('form#followup_form[action="."] input', 3);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   116
		test_val	('form#followup_form input[type=submit]', '(Activate private feed|Reset private feed url)');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   117
		test_val	('form#followup_form input#workspace_notify_check[type=checkbox]', 'on');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   118
		test_val	('form#followup_form input#own_notify_check[type=checkbox]', 'on');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   119
	
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   120
		// tester qu'une fois cliqué, le bouton à le nvo label, et qu'une adresse est disponible
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   121
		// tester que si on reclique l'adresse est changée
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   122
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   123
	});
575
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
   124
});
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   125
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   126
function test_default_tabs () {
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   127
	test_count	('#main-tabs a', 5);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   128
	test_text	('#main-tabs li:nth-of-type(1) a[href="/"]', 'Dashboard');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   129
	test_match	('#main-tabs li:nth-of-type(2) a[href="/text/"]', /^Texts \(\d+\) $/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   130
	test_match	('#main-tabs li:nth-of-type(3) a[href="/user/"]', /^People  \(\d+\)$/);
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   131
	test_text	('#main-tabs li:nth-of-type(4) a[href="/settings/"]', 'Settings');
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   132
	test_text	('#main-tabs li:nth-of-type(5) a[href="/followup/"]', 'Followup');
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   133
}
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   134
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   135
function test_logged_header (username) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   136
	test_text	('#header_controls b', username)
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   137
	test_count	('#header_controls a', 6);
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   138
	test_text	('#header_controls a:nth-of-type(1)[href="/"]',					'Home');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   139
	test_text	('#header_controls a:nth-of-type(2)[href="/create/content/"]',	'Create a text');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   140
	test_text	('#header_controls a:nth-of-type(3)[href="/create/upload/"]',	'Upload a text');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   141
	test_text	('#header_controls a:nth-of-type(4)[href="/create/import/"]',	'Import a co-mented text');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   142
	test_text	('#header_controls a:nth-of-type(5)[href="/profile/"]',			'Profile');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   143
	test_text	('#header_controls a:nth-of-type(6)[href="/logout/"]',			'Logout');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   144
}
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   145
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   146
function test_unlogged_header () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   147
	test_count	('#header_controls a', 2);
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   148
	test_text	('#header_controls a[href="/"]', 'Home');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   149
	test_text	('#header_controls a[href="/login/"]', 'Login');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   150
}
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   151
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   152
function test_unlogged_footer (url) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   153
	test_count	('#footer a', 9);
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   154
	test_text	('#footer a:nth-of-type(1)[href="/contact/"]', 'Contact');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   155
	test_match	('#footer #comentlink[href="http://www.co-ment.com"]', /Powered by/m);
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   156
	test_text	('#footer a:nth-of-type(3)[href="/help/"]', 'Help');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   157
	test_text	('#footer a:nth-of-type(4)[href="/i18n/setlang/fr/"]', 'Français');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   158
	test_text	('#footer a:nth-of-type(5)[href="/i18n/setlang/no/"]', 'Norsk');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   159
	test_text	('#footer a:nth-of-type(6)[href="/i18n/setlang/pt_BR/"]', 'Português Brasileiro');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   160
	test_text	('#footer a:nth-of-type(7)[href="/i18n/setlang/es/"]', 'Español');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   161
	test_text	('#footer a:nth-of-type(8)[href="/i18n/setlang/bg/"]', 'Български');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   162
	test_text	('#footer a:nth-of-type(9)[href="/i18n/setlang/it/"]', 'Italiano');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   163
}
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   164
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   165
function test_i18n () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   166
	test ('can change lang to french', dsl(function () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   167
		element ('#footer a[href="/i18n/setlang/fr/"]').click ();
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   168
//		browser.waitForPageLoad ();
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   169
//		browser.navigateTo ('/');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   170
//		browser.reload ();
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   171
		expect (elt ('#footer a[href="/help/"]').text ()).toBe ('Aide');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   172
		element ('#footer a[href="/i18n/setlang/en/"]').click ();
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   173
//		browser.waitForPageLoad ();
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   174
//		browser.navigateTo ('/');
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   175
	}));
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   176
}
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   177
579
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
   178
function test_page_loading (url, title) {
869f02c75687 daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents: 578
diff changeset
   179
	test ('loads', dsl(function () {
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   180
		// here we are in Karma page
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   181
		browser.navigateTo (url);
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   182
		expect (element ('title').text ()).toMatch (new RegExp (title,'m'));
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   183
		// The same test agin vaniller javascript
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   184
		element ('title').text (function (page_title) {
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   185
			// here we got a value from the test iframe
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   186
			// to display the tested value : console.log (page_title);
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   187
			if (!(new RegExp (title, 'm').test (page_title))) throw 'got page '+page_title+' instead';
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   188
		});
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   189
	}));
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   190
}
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   191
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   192
/** Test if the selected DOM element is defined or has a given value : .val()
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   193
 *  s : CSS selector
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   194
 *  e : expected value, if omited, test existence
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   195
 */
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   196
function test_val (s, e) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   197
	e = typeof e == 'undefined' ? '' : e; // .val() returns defined ? '' : undefined; // if no value
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   198
	test (s+' is '+e, dsl(function () {
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   199
		expect (elt (s).val ()).toMatch (new RegExp (e, 'm'));
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   200
	}));
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   201
}
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   202
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   203
/** Test if the selected DOM element has the given text : .text()
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   204
 *  s : CSS selector
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   205
 *  e : expected value
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   206
 */
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   207
function test_text (s, e) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   208
	test (s+' has text '+e, dsl(function () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   209
		expect (elt (s).text ()).toBe (e);
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   210
	}));
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   211
}
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   212
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   213
/** Test if the selected DOM element .text() value match the given regexp
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   214
 *  s : CSS selector
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   215
 *  r : regexp to match
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   216
 */
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   217
function test_match (s, r) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   218
	test (s+' text match '+r, dsl(function () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   219
		expect (elt (s).text ()).toMatch (r);
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   220
	}));
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   221
}
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   222
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   223
/** Count selector occurences
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   224
 *  s : CSS selector
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   225
 *  e : expected count
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   226
 */
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   227
function test_count (s, e) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   228
	test (s+' count is '+e, dsl(function () {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   229
		expect (elt (s).count ()).toBe (e);
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   230
	}));
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   231
}
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   232
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   233
/** Test Django form field presence
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   234
 */
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   235
function test_form_field (form_id, field_id, type, position, label, mandatory) {
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   236
	test ('has a '+label+' form field', dsl(function () {
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   237
		var s = type == 'textarea' ? 'textarea#'+field_id : 'input#'+field_id+'[type='+type+']';
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   238
		expect (elt (s).val ()).toBeDefined ();
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   239
		expect (elt ('#'+form_id+' :input:eq('+position+')#'+field_id).val ()).toBeDefined ();
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   240
		expect (elt ('label[for='+field_id+']').text ()).toBe (label);
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   241
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   242
		if (mandatory)
582
63b489ad02a3 rewritting and new tests
Simon Descarpentries <sid@sopinspace.com>
parents: 581
diff changeset
   243
			expect (elt ('label[for='+field_id+'] + span.required_star').val ()).toBeDefined ();
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   244
	}));
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   245
}
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   246
581
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   247
/** Ensure the given element is visible
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   248
 *  s : CSS selector of the DOM element to check
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   249
 */
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   250
function elt (s) {
d50d457e7e39 rewritting of up to 102 tests, admin dashboard conformity
Simon Descarpentries <sid@sopinspace.com>
parents: 579
diff changeset
   251
	return element (s + ':visible');
578
1793daa8df8a Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents: 577
diff changeset
   252
}