| author | Simon Descarpentries <sid@sopinspace.com> |
| Tue, 18 Feb 2014 19:27:58 +0100 | |
| changeset 579 | 869f02c75687 |
| parent 578 | 1793daa8df8a |
| child 581 | d50d457e7e39 |
| permissions | -rw-r--r-- |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
1 |
|
|
577
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
2 |
// try to login |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
3 |
|
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
4 |
// create texts and co-ments |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
5 |
// collect newly created URLs |
|
65fab7b5ce5e
Add 1st tests of login page congruency
Simon Descarpentries <sid@sopinspace.com>
parents:
575
diff
changeset
|
6 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
7 |
// Get workspace name, public texts… |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
8 |
|
|
577
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 |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
12 |
// 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
|
13 |
|
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
14 |
// Is the workspace name correctly displayed ? |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
15 |
// 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
|
16 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
17 |
var w = __karma__.config.w; |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
18 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
19 |
suite ('comt', function () { |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
20 |
|
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
21 |
this.timeout(150000); |
|
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
22 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
23 |
suite ('contact page', function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
24 |
test_page_loading ('/contact/', 'Contact'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
25 |
test_unlogged_header (); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
26 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
27 |
test ('has a contact form', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
28 |
expect (elt ('#profile[action="."]').val ()).toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
29 |
})); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
30 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
31 |
test_form_field ('id_name', 'text', 'Your name', true); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
32 |
test_form_field ('id_email', 'text', 'Your email address', true); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
33 |
test_form_field ('id_title', 'text', 'Subject of the message', true); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
34 |
test_form_field ('id_body', 'textarea', 'Body of the message', true); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
35 |
test_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
|
36 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
37 |
test ('has some submit and cancel buttons', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
38 |
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
|
39 |
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
|
40 |
})); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
41 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
42 |
test_unlogged_footer (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
43 |
|
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
44 |
// To avoid bugging in loading the 2nd page |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
45 |
test ('just get back to /', dsl(function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
46 |
browser.navigateTo ('/'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
47 |
})); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
48 |
}); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
49 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
50 |
suite ('help page', function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
51 |
test_page_loading ('/help/', 'Help'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
52 |
test_unlogged_header (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
53 |
test_unlogged_footer (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
54 |
}); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
55 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
56 |
suite ('reset password page', function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
57 |
test_page_loading ('/password_reset/', 'Reset my password'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
58 |
test_unlogged_header (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
59 |
|
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
60 |
test ('has a contact form', dsl(function () { |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
64 |
test_form_field ('id_email', 'text', 'E-mail', true); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
65 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
66 |
test ('has a submit button', dsl(function () { |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
70 |
test_unlogged_footer (); |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
73 |
suite ('login page', function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
74 |
test_page_loading ('/', 'Home'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
75 |
test_unlogged_header (); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
76 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
77 |
test ('has a #login form', dsl(function () { |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
81 |
test_form_field ('id_username', 'text', 'Username', true); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
82 |
test_form_field ('id_password', 'password', 'Password', true); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
83 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
84 |
test ('has a login button and reset password links', dsl(function () { |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
89 |
test_unlogged_footer (); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
90 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
91 |
test ('logs an admin in', dsl(function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
92 |
input ('#id_username').enter (w.USER_ADMIN); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
93 |
input ('#id_password').enter (w.PASS_ADMIN); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
94 |
elt ('#login input[type=submit]').click (); |
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
95 |
// Must be done here in this test() block |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
96 |
browser.waitForPageLoad (); |
|
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
102 |
suite ('admin dashboard', function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
103 |
// Should starts with : |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
104 |
test_page_loading ('/', 'Dashboard'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
105 |
// But its the last thing we did in the previous test |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
106 |
test_logged_header (w.USER_ADMIN); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
107 |
test_unlogged_footer (); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
108 |
}); |
|
575
8ce80860c3fe
Add the skeleton of the future comt test-suite
Simon Descarpentries <sid@sopinspace.com>
parents:
diff
changeset
|
109 |
}); |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
110 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
111 |
function test_page_loading (url, title) { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
112 |
test ('loads', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
113 |
// here we are in Karma page |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
114 |
browser.navigateTo (url); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
115 |
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
|
116 |
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
|
117 |
// 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
|
118 |
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
|
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 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
122 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
123 |
function test_logged_header (username) { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
124 |
test ('has 6 links in #header_controls', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
125 |
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
|
126 |
})); |
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
127 |
test ('displays current connected user name', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
128 |
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
|
129 |
})); |
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
130 |
test ('has links', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
131 |
expect (elt ('#header_controls a:nth-of-type(1)[href="/"]').text ()).toBe ('Home'); |
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
132 |
expect (elt ('#header_controls a:nth-of-type(2)[href="/create/content/"]').text ()).toBe ('Create a text'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
133 |
expect (elt ('#header_controls a:nth-of-type(3)[href="/create/upload/"]').text ()).toBe ('Upload a text'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
134 |
expect (elt ('#header_controls a:nth-of-type(4)[href="/create/import/"]').text ()).toBe ('Import a co-mented text'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
135 |
expect (elt ('#header_controls a:nth-of-type(5)[href="/profile/"]').text ()).toBe ('Profile'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
136 |
expect (elt ('#header_controls a:nth-of-type(6)[href="/logout/"]').text ()).toBe ('Logout'); |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
140 |
function test_unlogged_header () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
141 |
test ('has 2 links', dsl(function () { |
|
578
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); }); |
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
146 |
// test returns defined ? "" : undefined; |
|
578
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 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
153 |
function test_unlogged_footer (url) { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
154 |
test ('has >= 9 links in #footer', dsl(function () { |
|
578
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 |
})); |
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
160 |
/* test ('can change lang to french', dsl(function () { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
161 |
element ('#footer a[href="/i18n/setlang/fr/"]').click (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
162 |
// browser.waitForPageLoad (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
163 |
// browser.navigateTo ('/'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
164 |
expect (elt ('#footer a[href="/help/"]').text ()).toBe ('Aide'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
165 |
element ('#footer a[href="/i18n/setlang/en/"]').click (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
166 |
// browser.waitForPageLoad (); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
167 |
// browser.navigateTo ('/'); |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
168 |
}));*/ |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
169 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
170 |
|
|
579
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
171 |
/* Test Django form field presence */ |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
172 |
function test_form_field (id, type, label, mandatory) { |
|
869f02c75687
daily progress : suite/test style, config from single config file, attempt to test i18n in footer
Simon Descarpentries <sid@sopinspace.com>
parents:
578
diff
changeset
|
173 |
test ('has a '+label+' field', dsl(function () { |
|
578
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
174 |
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
|
175 |
expect (elt (s).val ()).toBeDefined (); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
176 |
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
|
177 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
178 |
if (mandatory) |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
179 |
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
|
180 |
})); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
181 |
} |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
182 |
|
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
183 |
function elt (selector) { |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
184 |
return element (selector + ':visible'); |
|
1793daa8df8a
Add tests for other unloggedely accessible webpages
Simon Descarpentries <sid@sopinspace.com>
parents:
577
diff
changeset
|
185 |
} |