This is my first casper test, so I'm still struggling with the basics. I would like to fill in the username and password on my login form, then submit it. And then confirm if a 'log off' link is rendered on the next page (confirming that the user has been logged in).
But as far as I can tell, when then is called, the url is still the same. Looks like no post or redirect to the next page is happening. What am I doing wrong?
casper.start "http://test.local.mycompany.local/", ->
@echo 'at ' + @getCurrentUrl()
@fill 'form', { UserAlias : 'joe', Password : 'password' }, true
casper.then ->
@echo 'at ' + @getCurrentUrl()
@test.assertExists '#log-off-link', 'log-off link exists'
casper.run ->
@test.done()
So the echo of @getCurrentUrl both returns the same URL, which is wrong.
You can try to use chrome extension ressurectio to generate automated tests, for casperjs, in browser. It's very simple to use and useful. May be in a few lines(- part of generated code) you should to make some fixes but anyway it's very useful and convenient.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With