zombie icon indicating copy to clipboard operation
zombie copied to clipboard

not connecting

Open cruiser12 opened this issue 9 years ago • 6 comments

const Browser = require('zombie');
const browser = new Browser();
Browser.localhost('http:/www.google.com',3000);
browser.debug();
browser.visit('/');
Sat, 09 Apr 2016 15:11:51 GMT zombie Opened window http://localhost/ 
Sat, 09 Apr 2016 15:11:51 GMT zombie Resource error Error: connect ECONNREFUSED 127.0.0.1:80
    at Object.exports._errnoException (util.js:870:11)
    at exports._exceptionWithHostPort (util.js:893:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1057:14)
Sat, 09 Apr 2016 15:11:51 GMT zombie TypeError: connect ECONNREFUSED 127.0.0.1:80
$ node --version
v4.4.0

What am i doing wrong here? Its also ignoring the port 3000;

cruiser12 avatar Apr 09 '16 15:04 cruiser12

@cruiser12 Did you ever resolve this? I've been struggling with similar test cases - I can get web pages outside of localhost, but anything on localhost reutrns ECONNREFUSED 127.0.0.1:3000

hoodsy avatar Aug 24 '16 16:08 hoodsy

Seeing almost the same error

const Browser = require('zombie');
Browser.localhost('example.com', 3000);
const browser = new Browser();
browser.visit('/').then(res => console.log(res));

Gives me TypeError: connect ECONNREFUSED 127.0.0.1:3000

benjick avatar Aug 31 '16 09:08 benjick

Seeing this problem too when requesting a local virtual host that runs inside a docker container on nginx. Other local vhosts seems to work randomly, some work, others don't.

Testing code:

const Browser = require('zombie');
const browser = new Browser();
const URL = 'http://example.local/';
browser.visit(URL, function() { console.log(browser.html()); });

Result:

<html><head></head><body>connect ECONNREFUSED 172.17.0.3:80</body></html>

The url resolves without problems in any browser on the computer. This is on OS X 10.11.6 with nodejs v5.12.0, zombiejs 2.5.1

berliner avatar Sep 02 '16 11:09 berliner

same here

mping avatar Oct 27 '16 16:10 mping

Can somebody confirm that a different node app can access the container by using http://localhost:3000/ or whatever the right port is?

mdlavin avatar Oct 28 '16 19:10 mdlavin

Replicated as well:

  • application running:

    $ npm start
    > [email protected] start /path/to/app-name
    node ./bin/www
    
    GET / 304 18.740 ms - -
    GET / 304 3.950 ms - -
    
  • run the default example test but used my app's localhost:3000 address:

    const Browser = require('zombie');
    
    // We're going to make requests to http://example.com/signup
    // Which will be routed to our test server localhost:3000
    Browser.localhost('http://localhost:3000/', 3000);
    
    describe('User visits signup page', function() {
    
      const browser = new Browser();
    
      before(function() {
        return browser.visit('/signup');
      });
    
      describe('submits form', function() {
    
        before(function() {
          browser
            .fill('email',    '[email protected]')
            .fill('password', 'eat-the-living');
          return browser.pressButton('Sign Me Up!');
        });
    
        it('should be successful', function() {
          browser.assert.success();
        });
    
        it('should see welcome page', function() {
          browser.assert.text('title', 'Welcome To Brains Depot');
        });
      });
    
    });
    
  • same error:

    > mocha test/functional/index.test.js 
    
    
      User visits signup page
        1) "before all" hook
    
    
      0 passing (74ms)
      1 failing
    
      1) User visits signup page "before all" hook:
         TypeError: getaddrinfo ENOTFOUND http http:80
          at node_modules/zombie/lib/pipeline.js:89:15
          at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
          at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
          at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
          at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
          at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:689:18)
          at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16)
          at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10)
          at Immediate.Async.drainQueues (node_modules/bluebird/js/release/async.js:17:14)
    

Environment:

  • OSX 10.12.4
  • Node v6.4.0
  • Express v4.15.12
  • Zombie v5.0.5

giltroymeren avatar Apr 23 '17 07:04 giltroymeren