| author | Simon Descarpentries <sid@sopinspace.com> |
| Mon, 17 Feb 2014 19:18:42 +0100 | |
| changeset 578 | 1793daa8df8a |
| parent 577 | 65fab7b5ce5e |
| child 579 | 869f02c75687 |
| 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 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
9 |
// Get workspace name, public texts… |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
10 |
|
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
11 |
// unlog |
|
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 public texts still work while unlogged |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
14 |
// 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
|
15 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
16 |
// Is the workspace name correctly displayed ? |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
17 |
// 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
|
18 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
19 |
// var w = require ('./workspace.info.js'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
20 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
21 |
var admin_username = 'siltaar'; |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
22 |
var admin_password = 'oaueoaue'; |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
23 |
|
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
24 |
describe ('comt', function () { |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
25 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
26 |
this.timeout(150000); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
27 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
28 |
describe ('help page', function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
29 |
it_checks_page_loading ('/help/', 'Help'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
30 |
it_checks_unlogged_header (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
31 |
it_checks_unlogged_footer (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
32 |
}); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
33 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
34 |
describe ('contact page', function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
35 |
it_checks_page_loading ('/contact/', 'Contact'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
36 |
it_checks_unlogged_header (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
37 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
38 |
it ('should have a contact form', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
39 |
expect (elt ('#profile[action="."]').val ()).toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
40 |
})); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
41 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
42 |
it_checks_form_field ('id_name', 'text', 'Your name', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
43 |
it_checks_form_field ('id_email', 'text', 'Your email address', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
44 |
it_checks_form_field ('id_title', 'text', 'Subject of the message', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
45 |
it_checks_form_field ('id_body', 'textarea', 'Body of the message', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
46 |
it_checks_form_field ('id_copy', 'checkbox', 'Send me a copy of the email', false); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
47 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
48 |
it ('should have some submit and cancel buttons', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
49 |
expect (elt ('#profile input[type=submit]').val ()).toBe ('Send'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
50 |
expect (elt ('input#cancel_button[type=button]').val ()).toBe ('Cancel'); |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
51 |
})); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
52 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
53 |
it_checks_unlogged_footer (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
54 |
}); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
55 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
56 |
describe ('reset password page', function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
57 |
it_checks_page_loading ('/password_reset/', 'Reset my password'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
58 |
it_checks_unlogged_header (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
59 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
60 |
it ('should have a contact form', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
61 |
expect (elt ('#profile[action="."]').val ()).toBeDefined (); |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
62 |
})); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
63 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
64 |
it_checks_form_field ('id_email', 'text', 'E-mail', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
65 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
66 |
it ('should have a submit button', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
67 |
expect (elt ('#profile input[type=submit]').val ()).toBe ('Reset my password'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
68 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
69 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
70 |
it_checks_unlogged_footer (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
71 |
}); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
72 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
73 |
describe ('login page', function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
74 |
it_checks_page_loading ('/', 'Home'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
75 |
it_checks_unlogged_header (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
76 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
77 |
it ('should have a #login form', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
78 |
expect (elt ('#login[action="/login/"]').val ()).toBeDefined (); |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
79 |
})); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
80 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
81 |
it_checks_form_field ('id_username', 'text', 'Username', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
82 |
it_checks_form_field ('id_password', 'password', 'Password', true); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
83 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
84 |
it ('should have a login button and reset password links', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
85 |
expect (elt ('#login input[type=submit]').val ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
86 |
expect (elt ('#login a[href="/password_reset/"]').text ()).toBe ('Forgot password?'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
87 |
})); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
88 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
89 |
it_checks_unlogged_footer (); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
90 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
91 |
it ('should log an admin in', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
92 |
input ('#id_username').enter (admin_username); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
93 |
input ('#id_password').enter (admin_password); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
94 |
elt ('#login input[type=submit]').click (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
95 |
browser.waitForPageLoad (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
96 |
// Must be done here in this 'it' block |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
97 |
browser.navigateTo ('/'); |
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
98 |
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
|
99 |
})); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
100 |
}); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
101 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
102 |
describe ('admin dashboard', function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
103 |
// it_checks_page_loading ('/', 'Dashboard'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
104 |
it_checks_logged_header (admin_username); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
105 |
it_checks_unlogged_footer (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
106 |
}); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
107 |
}); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
108 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
109 |
function it_checks_page_loading (url, title) { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
110 |
it ('should load', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
111 |
// here we are in Karma page |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
112 |
browser.navigateTo (url); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
113 |
expect (element ('title').text ()).toMatch (new RegExp (title,'m')); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
114 |
element ('title').text (function (page_title) { // The same test with more vanilla javascript |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
115 |
// here we got a value from the test iframe |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
116 |
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
|
117 |
}); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
118 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
119 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
120 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
121 |
function it_checks_logged_header (username) { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
122 |
it ('should have 6 links in #header_controls', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
123 |
expect (elt ('#header_controls a').count ()).toBe (6); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
124 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
125 |
it ('should display current connected username', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
126 |
expect (elt ('#header_controls b').text ()).toBe (username); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
127 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
128 |
it ('should have a Home link', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
129 |
expect (elt ('#header_controls a:nth-of-type(1)[href="/"]').text ()).toBe ('Home'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
130 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
131 |
/* it ('should have a Login link', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
132 |
expect (elt ('#header_controls a[href="/login/"]').text ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
133 |
expect (elt ('#header_controls a[href="/login/"]').text ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
134 |
expect (elt ('#header_controls a[href="/login/"]').text ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
135 |
expect (elt ('#header_controls a[href="/login/"]').text ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
136 |
expect (elt ('#header_controls a[href="/login/"]').text ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
137 |
}));*/ |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
138 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
139 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
140 |
function it_checks_unlogged_header () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
141 |
it ('should have 2 links', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
142 |
expect (elt ('#header_controls a').count ()).toBe (2); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
143 |
expect (elt ('#header_controls a[href="/"]').val ()).toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
144 |
// to display the tested value : |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
145 |
//elt ('#header_controls a[href="/"]').text ( function (txt) { console.log (txt); }); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
146 |
// it returns defined ? "" : undefined; |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
147 |
expect (elt ('#header_controls a[href="/"]').text ()).toBe ('Home'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
148 |
expect (elt ('#header_controls a[href="/login/"]').text ()).toBe ('Login'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
149 |
expect (elt ('#header_controls a[href="/xxx/"]').val ()).not ().toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
150 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
151 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
152 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
153 |
function it_checks_unlogged_footer () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
154 |
it ('should have >= 9 links in #footer', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
155 |
expect (elt ('#footer a').count ()).toBeGreaterThan (8); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
156 |
expect (elt ('#footer a[href="/contact/"]').text ()).toBe ('Contact'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
157 |
expect (elt ('#footer #comentlink[href="http://www.co-ment.com"]').text ()).toMatch (/Powered by/m); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
158 |
expect (elt ('#footer a[href="/help/"]').text ()).toBe ('Help'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
159 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
160 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
161 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
162 |
function it_checks_form_field (id, type, label, mandatory) { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
163 |
it ('should have a '+label+' field', dsl(function () { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
164 |
var s = type == 'textarea' ? 'textarea#'+id : 'input#'+id+'[type='+type+']'; |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
165 |
expect (elt (s).val ()).toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
166 |
expect (elt ('label[for='+id+']').text ()).toBe (label); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
167 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
168 |
if (mandatory) |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
169 |
expect (elt ('label[for='+id+'] + span.required_star').val ()).toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
170 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
171 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
172 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
173 |
function elt (selector) { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
174 |
return element (selector + ':visible'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
175 |
} |