test-suite/tests/001_comt-unlogged-prelude.js
changeset 636 a8ab808d33c3
parent 635 57d3834c5c01
--- a/test-suite/tests/001_comt-unlogged-prelude.js	Mon Apr 14 11:05:01 2014 +0200
+++ b/test-suite/tests/001_comt-unlogged-prelude.js	Mon Apr 14 20:51:24 2014 +0200
@@ -4,6 +4,8 @@
 // set softtabstop=4	  " as above
 // set shiftwidth=4		  " as above
 
+const wait_page_load = true;
+
 suite ('comt unlogged prelude', function () {
 
 	this.timeout(20000);
@@ -13,11 +15,11 @@
 		test_unlogged_header ();
 		test_exist	('form#profile[action="."]'); // the form exists
 		test_count	('form#profile :input', 7); // it has no more than 5 labels (may be no more fields)
-		test_field ('profile', 'id_name', 'text', 0, 'Your name', true); // the field id_name is…
-		test_field ('profile', 'id_email', 'text', 1, 'Your email address', true);
-		test_field ('profile', 'id_title', 'text', 2, 'Subject of the message', true);
-		test_field ('profile', 'id_body', 'textarea', 3, 'Body of the message', true);
-		test_field ('profile', 'id_copy', 'checkbox', 4, 'Send me a copy of the email', false);
+		test_field	('profile', 'id_name', 'text', 0, 'Your name', true); // the field id_name is…
+		test_field	('profile', 'id_email', 'text', 1, 'Your email address', true);
+		test_field	('profile', 'id_title', 'text', 2, 'Subject of the message', true);
+		test_field	('profile', 'id_body', 'textarea', 3, 'Body of the message', true);
+		test_field	('profile', 'id_copy', 'checkbox', 4, 'Send me a copy of the email', false);
 		test_val	('#profile input[type=submit]','Send'); // test that a the .val() of the element is
 		test_val	('input#cancel_button[type=button]', 'Cancel');
 		test_unlogged_footer ();
@@ -48,33 +50,33 @@
 
 	suite ('contact page mandatory field test', function () {
 		test_page_loading ('/contact/', 'Contact');
-		test_submit('#profile input[type="submit"]');
-		test_count ('div.help_text span.error-text', 4);
-		test_field ('profile div.error', 'id_name', 'text', 0, 'Your name', true); // the field id_name is…
-		test_field ('profile div.error', 'id_email', 'text', 1, 'Your email address', true);
-		test_field ('profile div.error', 'id_title', 'text', 2, 'Subject of the message', true);
-		test_field ('profile div.error', 'id_body', 'textarea', 3, 'Body of the message', true);
-		test_field ('profile', 'id_copy', 'checkbox', 4, 'Send me a copy of the email', false);
+		test_click	('#profile input[type="submit"]', wait_page_load);
+		test_count	('div.help_text span.error-text', 4);
+		test_field	('profile div.error', 'id_name', 'text', 0, 'Your name', true); // the field id_name is…
+		test_field	('profile div.error', 'id_email', 'text', 1, 'Your email address', true);
+		test_field	('profile div.error', 'id_title', 'text', 2, 'Subject of the message', true);
+		test_field	('profile div.error', 'id_body', 'textarea', 3, 'Body of the message', true);
+		test_field	('profile', 'id_copy', 'checkbox', 4, 'Send me a copy of the email', false);
 	});
 
 	suite ('reset password page conformity', function () {
 		test_page_loading ('/password_reset/', 'Reset my password');
 		test_unlogged_header ();
 		test_count	('form#profile :input', 3);
-		test_field ('profile', 'id_email', 'text', 1, 'E-mail', true);
+		test_field	('profile', 'id_email', 'text', 1, 'E-mail', true);
 		test_val	('#profile input[type=submit]', 'Reset my password');
 		test_unlogged_footer ();
-		test_submit('#profile input[type="submit"]');
-		test_count ('div.help_text span.error-text', 1);
-		test_field ('profile div.error', 'id_email', 'text', 0, 'E-mail', true);
+		test_click	('#profile input[type="submit"]', wait_page_load);
+		test_count	('div.help_text span.error-text', 1);
+		test_field	('profile div.error', 'id_email', 'text', 0, 'E-mail', true);
 	});
 
 	suite ('login page conformity', function () {
 		test_page_loading ('/', 'Home');
 		test_unlogged_header ();
 		test_count	('form#login[action="/login/"] :input', 3);
-		test_field ('login', 'id_username', 'text', 0, 'Username', true);
-		test_field ('login', 'id_password', 'password', 1, 'Password', true);
+		test_field	('login', 'id_username', 'text', 0, 'Username', true);
+		test_field	('login', 'id_password', 'password', 1, 'Password', true);
 		test_val	('form#login input[type=submit]', 'Login');
 		test_text	('form#login a[href="/password_reset/"]', 'Forgot password?');
 		test_unlogged_footer ();
@@ -84,9 +86,9 @@
 			browser.navigateTo ('/');
 		}));
 		test_page_loading ('/login/', 'Login');
-		test_submit('#login input[type="submit"]');
-		test_field ('login div.error', 'id_username', 'text', 0, 'Username', true);
-		test_field ('login div.error', 'id_password', 'password', 1, 'Password', true);
+		test_click	('#login input[type="submit"]', wait_page_load);
+		test_field	('login div.error', 'id_username', 'text', 0, 'Username', true);
+		test_field	('login div.error', 'id_password', 'password', 1, 'Password', true);
 	});
 });