Created
May 26, 2014 01:32
-
-
Save misterdjules/c6aaf12b4d2b06f1e99c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| casper.test.begin "Login with Sammy.js routing", 4, (test) -> | |
| casper.start someHost | |
| casper.then -> | |
| test.assertExists "form#login-form", "Index page must have a register form." | |
| # This is needed so that your frontend code can do whatever it needs | |
| # to do (like loading models) when initializing your single page app. | |
| # Going to the next step without the initialization completed can make it look | |
| # like issues happen in the next steps for other reasons. | |
| this.wait 1000, -> | |
| casper.log "Waiting for loading..." | |
| casper.then -> | |
| this.fill "form#login-form", { "username": "test", "password": "test" }, false | |
| this.click "form#login-form #btn-login" | |
| # Setting navigationRequested to true is needed to tell casperjs | |
| # that navigation to another location is expected. | |
| this.navigationRequested = true | |
| casper.then -> | |
| casper.log "current URL: #{this.getCurrentUrl()}" | |
| test.assertUrlMatch /#\/user\/loggedin\/route/, "User is redirected to the expected frontend route" | |
| casper.run -> | |
| test.done() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment