@@ -146,6 +146,35 @@ CasperTest.begin('Can login to Ghost', 5, function suite(test) {
146
146
} ) ;
147
147
} , true ) ;
148
148
149
+ CasperTest . begin ( 'Authenticated user is redirected' , 8 , function suite ( test ) {
150
+ casper . thenOpenAndWaitForPageLoad ( 'signin' , function testTitleAndUrl ( ) {
151
+ test . assertTitle ( 'Ghost Admin' , 'Ghost admin has no title' ) ;
152
+ test . assertUrlMatch ( / g h o s t \/ s i g n i n \/ $ / , 'Landed on the correct URL' ) ;
153
+ } ) ;
154
+
155
+ casper . waitForOpaque ( '.login-box' , function then ( ) {
156
+ this . fillAndSave ( '#login' , user ) ;
157
+ } ) ;
158
+
159
+ casper . wait ( 2000 ) ;
160
+
161
+ casper . waitForResource ( / p o s t s / , function testForDashboard ( ) {
162
+ test . assertUrlMatch ( / g h o s t \/ \d + \/ $ / , 'Landed on the correct URL' ) ;
163
+ test . assertExists ( '#global-header' , 'Global admin header is present' ) ;
164
+ test . assertExists ( '.manage' , 'We\'re now on content' ) ;
165
+ } , function onTimeOut ( ) {
166
+ test . fail ( 'Failed to signin' ) ;
167
+ } ) ;
168
+
169
+ casper . thenOpenAndWaitForPageLoad ( 'signin-authenticated' , function testTitleAndUrl ( ) {
170
+ test . assertUrlMatch ( / g h o s t \/ \d + \/ $ / , 'Landed on the correct URL' ) ;
171
+ test . assertExists ( '#global-header' , 'Global admin header is present' ) ;
172
+ test . assertExists ( '.manage' , 'We\'re now on content' ) ;
173
+ } , function onTimeOut ( ) {
174
+ test . fail ( 'Failed to redirect' ) ;
175
+ } ) ;
176
+ } , true ) ;
177
+
149
178
// TODO: please uncomment when the validation problem is fixed (https://github.com/TryGhost/Ghost/issues/3120)
150
179
// CasperTest.begin('Ensure email field form validation', 3, function suite(test) {
151
180
// casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
0 commit comments