Hi,
I'd like to zombie.js, mocha and should.js to perform functional testing for on web app. However, I can't figure out how to get multiple page visits to work. For example I'd like to login, navigate to a page, and check some data. I can login but I can't seem to visit another page after that. I'm not sure what I have to do to get this to work. Am I just not waiting long enough for things to process? Do I have to use cookies to save my session?
Here's an example test that doesn't work. I'm getting logged in but the second browser.visit() generates a "getaddrinfo ENOTFOUND".
describe 'Login and visit another route on the site', ->
browser = null
loginUrl = null
pageUrl = null
beforeEach (done) ->
browser = zombie.create()
browser.visit loginUrl, ->
browser
.fill("#password", "password")
.pressButton "#signIn", ->
browser.wait ->
browser.visit pageUrl, ->
done()
it 'should login and get to the other page', (done) ->
browser.query("#anotherPageID").should.exist
done()
Here's some code that DOES work... I go to google, then I go to facebook:
describe 'Zombie performing multiple page visits via callbacks', ->
browser = null
url = null
anotherUrl = null
beforeEach (done) ->
browser = zombie.create()
browser.visit url, ->
browser.visit anotherUrl, done
it 'should create a browser and visit google then facebook', (done) ->
browser.query("#facebook").should.exist
done()
Thanks!