teampoltergeist / poltergeist

A PhantomJS driver for Capybara

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Capybara::Poltergeist::StatusFailError: check DNS and/or server status

kieraneglin opened this issue · comments

Related to #677 and #791. Since both are closed, I'm opening a new discussion.

Problem

When running tests, some will randomly fail. The error is:

Capybara::Poltergeist::StatusFailError: Request to '<app sign_in page, port: 50994>' failed to reach server, check DNS and/or server status

Output with debug: true:

{"id":"76baef53-619e-405a-b940-18d680081839","name":"set_debug","args":[true]}
{"command_id":"76baef53-619e-405a-b940-18d680081839","response":true}
{"id":"206cb602-92fc-404a-a74c-4e70ad516795","name":"set_url_whitelist","args":["<required third party domain>","<local app domain>"]}
{"command_id":"206cb602-92fc-404a-a74c-4e70ad516795","response":true}
{"id":"04221ae6-0769-4b8f-b573-7a75bcf4dbc9","name":"visit","args":["<local sign in page, port: 50994>"]}
{"command_id":"04221ae6-0769-4b8f-b573-7a75bcf4dbc9","error":{"name":"Poltergeist.StatusFailError","args":["<local sign in page>",null]}}

Links redacted for brevity and privacy.

The code it fails on is always visit <path name>

Versions

  • phantomjs - 2.1.1
  • poltergeist - 1.14.0
  • capybara - 2.7.1
  • options - url_whitelist: %w(<3rd party> <local testing domain>) I have to redact the links.
  • os - OS X 10.11.4

Things I've Tried

  • Downgrading phantom
  • Precompiling assets in test env
  • Adding a timeout from 30-120 seconds
  • Adding ['--ignore-ssl-errors=yes','--load-images=no']

Other Comments

Some people say it only fails on their first test. For me, it's seemingly random as to what tests fail.

There are no iframes on the pages that fail.

Solved!

We were using a custom domain that pointed back to localhost to test subdomains. Adding that domain and subdomains to our hosts file as 127.0.0.1 solved the issue!

Glad to hear you solved it - I was in the middle of answering this, so I'll leave the explanation in place for others that come to this issue.


The only place StatusFailErrors can come from is https://github.com/teampoltergeist/poltergeist/blob/master/lib/capybara/poltergeist/client/browser.coffee#L111

That shows it can come from either timing out while there are open requests (but the second parameter in your log is null so it's not that), or from the request actually failing. The null parameter would tend to indicate it is because the request is actually failing.

Oh, and is there a specific reason you're still on Capybara 2.7.1?? That's a pretty old version.

This is literally my first day of work at a new company and I was trying to get everything set up.

So I don't really know why we're using that version of Capybara, but I'll update as soon as I can!

Thanks for the swift reply