2013-12-08 76 views

回答

3

我不知道如何可靠,這是,但它是很容易建立一個假的Twitter賬戶,並模擬與Zombie流量:

describe('GET /auth/twitter', function(){ 

    it('should redirect to /account', function(done){ 
     this.timeout(20e3) 
     var zombie = new Zombie() 
     zombie.visit(url.resolve(YOUR_HOST, '/auth/twitter'), function(err){ 
      if (err) throw err 
      zombie 
       .fill('#username_or_email', 'YOUR_USERNAME') 
       .fill('#password', 'YOUR_PASSWORD') 
       .pressButton('#allow', function(err){ 
        if (err) throw err 
        zombie.clickLink('.maintain-context', function(err){ 
         if (err) throw err 
         // Signed in! Do some assertions here. 
         return done() 
        }) 
       }) 
     }) 
    }) 

}) 
+0

我一直在使用這種成功的幾個星期現在我打包併發布到npm:https://npmjs.org/package/zombie-passport-twitter –