How to visit multiple pages in a web app

132 views
Skip to first unread message

Brett Wiesner Elliot

unread,
Dec 17, 2014, 8:58:46 AM12/17/14
to zomb...@googlegroups.com
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) ->
        loginUrl = "http://localhost:11000/#/login"
        browser = zombie.create()
        browser.visit loginUrl, ->
            browser
                .fill("#email", "em...@email.com")
                .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) ->
        url = "http://google.com"
        anotherUrl = "http://facebook.com"
        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!

as...@labnotes.org

unread,
Dec 19, 2014, 1:18:34 PM12/19/14
to zomb...@googlegroups.com
Where is locationhost defined?

--
You received this message because you are subscribed to the Google Groups "zombie.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zombie-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brett Wiesner Elliot

unread,
Dec 22, 2014, 8:43:57 AM12/22/14
to zomb...@googlegroups.com
Sorry, locationHost was a type. I meant local host. I'm using an express server running locally for this testing.


On Friday, December 19, 2014 1:18:34 PM UTC-5, Assaf wrote:
Where is locationhost defined?

On Dec 17, 2014, at 5:58 AM, Brett Wiesner Elliot <br...@theelliots.net> wrote:

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) ->
        loginUrl = "http://localhost:11000/#/login"
        pageUrl = "http://localhost:11000/#/anotherPage

Assaf Arkin

unread,
Dec 22, 2014, 11:48:29 AM12/22/14
to zomb...@googlegroups.com
That was your ENOTFOUND error. It’s what happens when your computer can resolve a DNS name.
Reply all
Reply to author
Forward
0 new messages