src/cm/scripts/test-suite/tests/tests.js
author Simon Descarpentries <sid@sopinspace.com>
Thu, 13 Feb 2014 18:54:19 +0100
changeset 575 8ce80860c3fe
child 577 65fab7b5ce5e
permissions -rw-r--r--
Add the skeleton of the future comt test-suite
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
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     2
// console.log ('args '+args);
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     3
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     4
describe ('comt', function () {
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     5
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     6
	this.timeout(150000);
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     7
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     8
	describe ('connexion', function () {
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
     9
		it ('should load login page', dsl(function () {
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    10
			// here we are in Karma page
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    11
			browser.navigateTo ('/');
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    12
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    13
			/*element ('title').text (function (page_title) {
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    14
				// here we got a value from the test iframe
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    15
				if (typeof page_title != 'string') throw 'page_title not a string, network problem ?';
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    16
				if (!/(Accueil|Home) - Workspace/.test (page_title)) throw 'got page '+page_title+' instead';
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    17
			});*/
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    18
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    19
			expect (element ('title').text ()).toBeDefined ();
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    20
			expect (element ('title').text ()).toMatch (/Home - Workspace/);
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    21
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    22
			// it should have a header
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    23
				// with visible homepage and login links
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    24
			// it should have a title
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    25
				// with workspace name in it… ?
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    26
			// it may have public texts
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    27
				// how many max ?
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    28
				// do we announce the right number of texts ?
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    29
			// it should have a login form
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    30
				// with labels
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    31
				// with red stars
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    32
				// green button
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    33
				// forgoten password link
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    34
			// it should have a footer
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    35
				// with contact link, powered by co-ment logo, help link, languages links
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    36
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    37
			// we should try the links
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    38
			// we should try urls as not logged to check the access avoidance
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    39
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    40
		}));
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    41
		it ('should log in', dsl(function () {
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    42
			browser.navigateTo ('/');
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    43
			input ('#id_username').enter ('siltaar');
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    44
			input ('#id_password').enter ('oaueoaue');
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    45
			element ('#login input[type=submit]').click ();
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    46
			browser.waitForPageLoad ()
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    47
			browser.navigateTo ('/');
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    48
			expect (element ('title').text ()).toMatch (/Dashboard\n - Workspace/m);
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    49
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    50
		}));
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    51
	});
8ce80860c3fe Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff changeset
    52
});