| author | Simon Descarpentries <sid@sopinspace.com> |
| Fri, 14 Feb 2014 18:44:24 +0100 | |
| changeset 577 | 65fab7b5ce5e |
| parent 575 | 8ce80860c3fe |
| child 578 | 1793daa8df8a |
| permissions | -rw-r--r-- |
|
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 |
|
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
4 |
// try to login |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
5 |
|
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
6 |
// create texts and co-ments |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
7 |
// collect newly created URLs |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
8 |
|
|
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 |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
12 |
|
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
13 |
// check that non public texts are unavailable |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
14 |
|
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
15 |
describe ('comt', function () { |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
16 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
17 |
this.timeout(150000); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
18 |
|
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
19 |
describe ('login page', function () { |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
20 |
it ('should load', dsl(function () { |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
21 |
// here we are in Karma page |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
22 |
browser.navigateTo ('/'); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
23 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
24 |
/*element ('title').text (function (page_title) { |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
25 |
// 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
|
26 |
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
|
27 |
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
|
28 |
});*/ |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
29 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
30 |
expect (element ('title').text ()).toBeDefined (); |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
31 |
expect (element ('title').text ()).toMatch (/Home/); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
32 |
|
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
33 |
})); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
34 |
it ('should have 2 links in #header_controls', dsl(function () { |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
35 |
expect (element ('#header_controls a').count ()).toBe (2); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
36 |
})); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
37 |
it ('should have a Home link in #header_controls', dsl(function () { |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
38 |
expect (element ('#header_controls a[href="/"]').val ()).toBeDefined (); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
39 |
// to display the tested value : |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
40 |
//element ('#header_controls a[href="/"]').text ( function (txt) { console.log (txt); }); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
41 |
// returns defined ? "" : undefined; |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
42 |
})); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
43 |
it ('should have a Login link in #header_controls', dsl(function () { |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
44 |
expect (element ('#header_controls a[href="/login/"]').val ()).toBeDefined (); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
45 |
})); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
46 |
it ('should not have a XXX link in #header_controls', dsl(function () { |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
47 |
expect (element ('#header_controls a[href="/xxx/"]').val ()).not ().toBeDefined (); |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
48 |
})); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
49 |
// with visible homepage and login links |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
50 |
// it should have a title |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
51 |
// with workspace name in it… ? |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
52 |
// it may have public texts |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
53 |
// 0-5 |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
54 |
// 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
|
55 |
// it should have a login form |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
56 |
// with labels |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
57 |
// with red stars |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
58 |
// green button |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
59 |
// forgoten password link |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
60 |
// it should have a footer |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
61 |
// 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
|
62 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
63 |
// we should try the links |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
64 |
// 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
|
65 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
66 |
it ('should log in', dsl(function () { |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
67 |
browser.navigateTo ('/'); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
68 |
input ('#id_username').enter ('siltaar'); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
69 |
input ('#id_password').enter ('oaueoaue'); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
70 |
element ('#login input[type=submit]').click (); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
71 |
browser.waitForPageLoad () |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
72 |
browser.navigateTo ('/'); |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
73 |
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
|
74 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
75 |
})); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
76 |
}); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
77 |
}); |