Capybara: webkit and selenium cannot find url, racktest works

Multi-domain application. Using the POW server locally. Cucumber Tests

In one of the steps I set app_host (the subdomain belongs to the account and is fabricated every time):

def set_current_subdomain(subdomain)
  Capybara.app_host = "http://#{subdomain}.example.com:#{Capybara.server_port}"
end

in the cucumber settings:

Capybara.run_server = true 
Capybara.server_port = 8200
Capybara.javascript_driver = :selenium #default driver when you using @javascript tag
Capybara.app = Rack::ShowExceptions.new(MyApp::Application)
Capybara.default_driver = :rack_test

Step example

visit(new_user_session_url(subdomain: @account.subdomain, port: Capybara.server_port))

Cucumber tests are done with: rack_test, but not with: webkit or: selenium

Unable to load URL: http://veumbogan8d11d7feca.example.com:8200/signin because of error loading http://veumbogan8d11d7feca.example.com:8200/signin: Unknown error (Capybara::Webkit::InvalidResponseError)

webkit_debug output:

Finished "EnableLogging" with response "Success()" 
Wrote response true "" 
Received "Visit" 
Started "Visit" 
Load started 
"Visit" started page load 
Started request to "http://kuphal375cb65167.example.com:8200/signin" 
Finished "Visit" with response "Success()" 
Received 0 from "http://kuphal375cb65167.example.com:8200/signin" 
Page finished with false 
Load finished 
Page load from command finished 
Wrote response false "{"class":"InvalidResponseError","message":"Unable to load URL: http://kuphal375cb65167.example.com:8200/signin because of error loading http://kuphal375cb65167.example.com:8200/signin: Unknown error"}" 

When using selenium firefox opens with "Server not found"

Nothing suspicious in test.log: an account was not created, an email notification was sent, etc.

  • rails 3.2.17
  • mongoid 2.4.11
  • capybara 2.1.0
  • webkit 1.1.1
  • selenium-webdriver 2.40.0

Would thank advice on how to debug this and what could be the problem

PS: setting database_cleaner:

require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
Before { DatabaseCleaner.clean }
+4

Source: https://habr.com/ru/post/1540758/


All Articles