# HG changeset patch # User Simon Descarpentries # Date 1392399864 -3600 # Node ID 65fab7b5ce5ed54c178fefeef04c370aedaa9c84 # Parent 43700c10a1fc092a6bd7ff567d6312692ce22f61 Add 1st tests of login page congruency diff -r 43700c10a1fc -r 65fab7b5ce5e src/cm/scripts/test-suite/tests/tests.js --- a/src/cm/scripts/test-suite/tests/tests.js Thu Feb 13 18:55:46 2014 +0100 +++ b/src/cm/scripts/test-suite/tests/tests.js Fri Feb 14 18:44:24 2014 +0100 @@ -1,12 +1,23 @@ // console.log ('args '+args); +// try to login + +// create texts and co-ments +// collect newly created URLs + +// unlog + +// check that public texts still work while unlogged + +// check that non public texts are unavailable + describe ('comt', function () { this.timeout(150000); - describe ('connexion', function () { - it ('should load login page', dsl(function () { + describe ('login page', function () { + it ('should load', dsl(function () { // here we are in Karma page browser.navigateTo ('/'); @@ -17,14 +28,29 @@ });*/ expect (element ('title').text ()).toBeDefined (); - expect (element ('title').text ()).toMatch (/Home - Workspace/); + expect (element ('title').text ()).toMatch (/Home/); - // it should have a header + })); + it ('should have 2 links in #header_controls', dsl(function () { + expect (element ('#header_controls a').count ()).toBe (2); + })); + it ('should have a Home link in #header_controls', dsl(function () { + expect (element ('#header_controls a[href="/"]').val ()).toBeDefined (); + // to display the tested value : + //element ('#header_controls a[href="/"]').text ( function (txt) { console.log (txt); }); + // returns defined ? "" : undefined; + })); + it ('should have a Login link in #header_controls', dsl(function () { + expect (element ('#header_controls a[href="/login/"]').val ()).toBeDefined (); + })); + it ('should not have a XXX link in #header_controls', dsl(function () { + expect (element ('#header_controls a[href="/xxx/"]').val ()).not ().toBeDefined (); + })); // with visible homepage and login links // it should have a title // with workspace name in it… ? // it may have public texts - // how many max ? + // 0-5 // do we announce the right number of texts ? // it should have a login form // with labels @@ -37,7 +63,6 @@ // we should try the links // we should try urls as not logged to check the access avoidance - })); it ('should log in', dsl(function () { browser.navigateTo ('/'); input ('#id_username').enter ('siltaar'); @@ -45,7 +70,7 @@ element ('#login input[type=submit]').click (); browser.waitForPageLoad () browser.navigateTo ('/'); - expect (element ('title').text ()).toMatch (/Dashboard\n - Workspace/m); + expect (element ('title').text ()).toMatch (/Dashboard/m); })); }); diff -r 43700c10a1fc -r 65fab7b5ce5e src/cm/scripts/test-suite/workspace.info.js --- a/src/cm/scripts/test-suite/workspace.info.js Thu Feb 13 18:55:46 2014 +0100 +++ b/src/cm/scripts/test-suite/workspace.info.js Fri Feb 14 18:44:24 2014 +0100 @@ -1,6 +1,5 @@ define ("WORKSPACE_URL", 'http://192.168.2.61:8000/'); -define ("WORKSPACE_NAME", 'Workspace'); define ("USER_ADMIN", 'siltaar'); define ("PASS_ADMIN", 'oaueoaue');