我刚刚将项目与bitbucket管道集成,但我收到了一些功能规格错误。
我的第一次尝试as capybara-webkit mentioned是安装xvfb
并运行xvfb-run -a bundle exec rspec
,因此我将脚本部分保留在bitbucket-pipelines.yml
文件中,如下所示:
image: ruby:2.2.5
# stuffs...
script:
- curl -sL https://deb.nodesource.com/setup_6.x | bash -
- apt-get install -y --no-install-recommends build-essential nodejs libpq-dev libmagickwand-dev imagemagick qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x xvfb
- bundle install
- cp config/database.yml.example config/database.yml
- (cd client && npm install)
- bundle exec rake db:drop db:create db:schema:load db:migrate RAILS_ENV=test
- xvfb-run -a bundle exec rspec
但是我开始收到xvfb-run: error: xauth command not found
。然后我尝试了headless gem,我刚刚在脚本部分中留下bundle exec rspec
(没有调用xvfb-run
)并添加到我的spec_helper.rb
:
config.before(:suite) do
Headless.new(destroy_on_exit: false).start
end
有了这个,我开始收到规格:
1) Macros displays macro index
Got 0 failures and 2 other errors:
1.1) Failure/Error: visit macros_path
EOFError:
end of file reached
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:41:in `read_nonblock'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:41:in `read'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:32:in `gets'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:299:in `check'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:211:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:19:in `visit'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/driver.rb:50:in `visit'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/session.rb:233:in `visit'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/macros_spec.rb:12:in `block (2 levels) in <top (required)>'
1.2) Failure/Error:
raise(Capybara::Webkit::CrashError, <<-MESSAGE.strip)
The webkit_server process crashed!
#{exception.message}
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
MESSAGE
Capybara::Webkit::CrashError:
The webkit_server process crashed!
Broken pipe
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:215:in `rescue in command'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:205:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:39:in `reset!'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/driver.rb:264:in `reset!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/session.rb:109:in `reset!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara.rb:331:in `block in reset_sessions!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara.rb:331:in `reverse_each'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara.rb:331:in `reset_sessions!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::EPIPE:
# Broken pipe
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:22:in `write'
2) Messages when there are no messages displays a `no messages` message
Got 0 failures and 2 other errors:
2.1) Failure/Error: visit messages_path
EOFError:
end of file reached
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:41:in `read_nonblock'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:41:in `read'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:32:in `gets'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:299:in `check'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:211:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:19:in `visit'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/driver.rb:50:in `visit'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/session.rb:233:in `visit'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/messages_spec.rb:9:in `block (2 levels) in <top (required)>'
2.2) Failure/Error:
raise(Capybara::Webkit::CrashError, <<-MESSAGE.strip)
The webkit_server process crashed!
#{exception.message}
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
MESSAGE
Capybara::Webkit::CrashError:
The webkit_server process crashed!
Broken pipe
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:215:in `rescue in command'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:205:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/browser.rb:39:in `reset!'
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/driver.rb:264:in `reset!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/session.rb:109:in `reset!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara.rb:331:in `block in reset_sessions!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara.rb:331:in `reverse_each'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara.rb:331:in `reset_sessions!'
# /usr/local/bundle/gems/capybara-2.7.1/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::EPIPE:
# Broken pipe
# /usr/local/bundle/gems/capybara-webkit-1.11.1/lib/capybara/webkit/connection.rb:22:in `write'
正如错误中提到的,我按照说明在Reporting Crashes wiki中调试日志,新显示的信息是:
Finished "EnableLogging()" with response "Success()"
Wrote response true ""
Received "SetUnknownUrlMode(block)"
Started "SetUnknownUrlMode(block)"
Finished "SetUnknownUrlMode(block)" with response "Success()"
Wrote response true ""
Received "SetTimeout(-1)"
Started "SetTimeout(-1)"
Finished "SetTimeout(-1)" with response "Success()"
Wrote response true ""
Received "Visit(http://127.0.0.1:44341/macros)"
Started "Visit(http://127.0.0.1:44341/macros)"
Load started
"Visit(http://127.0.0.1:44341/macros)" started page load
Started request to "http://127.0.0.1:44341/macros"
Finished "Visit(http://127.0.0.1:44341/macros)" with response "Success()"
Started request to "http://127.0.0.1:44341/assets/application-d83f12f0b0ea0b43e79104a90e874634910929f3a471ffe1d17fce392956fc76.css"
Started request to "http://127.0.0.1:44341/assets/application-40a174b892afd166ed6429966cb6c56b09bb9aa5ed8a35b697855aca2ee9792a.js"
Received 200 from "http://127.0.0.1:44341/macros"
Started request to "http://127.0.0.1:44341/assets/logo128-8f969fe4ae654a8578aeb686f3c537290f2d2e4731cb15026c036d18a3456022.png"
Started request to "http://127.0.0.1:44341/assets/active_scaffold/indicator-07b202d8027099d3add8213095a203cecb4938acdebc80f755ef2251a1a5b880.gif"
Received 200 from "http://127.0.0.1:44341/assets/application-d83f12f0b0ea0b43e79104a90e874634910929f3a471ffe1d17fce392956fc76.css"
Started request to "http://127.0.0.1:44341/assets/active_scaffold/add-e1facc6f96a51e281f4fdfcdc0a648a6ff84cb2526523459343d8a4f6196a1da.png"
Started request to "http://127.0.0.1:44341/assets/active_scaffold/magnifier-475a6335fb52c21b5fa732518e89408f4277779bf5b015391358b047602b8aff.png"
Received 200 from "http://127.0.0.1:44341/assets/logo128-8f969fe4ae654a8578aeb686f3c537290f2d2e4731cb15026c036d18a3456022.png"
Received 200 from "http://127.0.0.1:44341/assets/active_scaffold/indicator-07b202d8027099d3add8213095a203cecb4938acdebc80f755ef2251a1a5b880.gif"
Received 200 from "http://127.0.0.1:44341/assets/application-40a174b892afd166ed6429966cb6c56b09bb9aa5ed8a35b697855aca2ee9792a.js"
Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see
displays macro index (FAILED - 1)
Messages
when there are no messages
Request to unknown URL: https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css
To block requests to unknown URLs:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
To allow just this URL:
Capybara::Webkit.configure do |config|
config.allow_url("https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css")
end
To allow requests to URLs from this host:
Capybara::Webkit.configure do |config|
config.allow_url("maxcdn.bootstrapcdn.com")
end
Request to unknown URL: https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css
To block requests to unknown URLs:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
To allow just this URL:
Capybara::Webkit.configure do |config|
config.allow_url("https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css")
end
To allow requests to URLs from this host:
Capybara::Webkit.configure do |config|
config.allow_url("code.ionicframework.com")
end
Request to unknown URL: https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic
To block requests to unknown URLs:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
To allow just this URL:
Capybara::Webkit.configure do |config|
config.allow_url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic")
end
To allow requests to URLs from this host:
Capybara::Webkit.configure do |config|
config.allow_url("fonts.googleapis.com")
end
displays a `no messages` message (FAILED - 2)
我打算更新宝石,也许真的是一个错误,但我的想法已经不多了 任何建议都会很棒。
更新
我已更新为capybara-2.13.0
和capybara-webkit-1.14.0
,但错误和调试消息相同:
Finished "EnableLogging()" with response "Success()"
Wrote response true ""
Received "SetUnknownUrlMode(block)"
Started "SetUnknownUrlMode(block)"
Finished "SetUnknownUrlMode(block)" with response "Success()"
Wrote response true ""
Received "SetTimeout(-1)"
Started "SetTimeout(-1)"
Finished "SetTimeout(-1)" with response "Success()"
Wrote response true ""
Received "Visit(http://127.0.0.1:34333/macros)"
Started "Visit(http://127.0.0.1:34333/macros)"
Load started
"Visit(http://127.0.0.1:34333/macros)" started page load
Started request to "http://127.0.0.1:34333/macros"
Finished "Visit(http://127.0.0.1:34333/macros)" with response "Success()"
Started request to "http://127.0.0.1:34333/assets/application-d83f12f0b0ea0b43e79104a90e874634910929f3a471ffe1d17fce392956fc76.css"
Started request to "http://127.0.0.1:34333/assets/application-40a174b892afd166ed6429966cb6c56b09bb9aa5ed8a35b697855aca2ee9792a.js"
Received 200 from "http://127.0.0.1:34333/macros"
Started request to "http://127.0.0.1:34333/assets/logo128-8f969fe4ae654a8578aeb686f3c537290f2d2e4731cb15026c036d18a3456022.png"
Started request to "http://127.0.0.1:34333/assets/active_scaffold/indicator-07b202d8027099d3add8213095a203cecb4938acdebc80f755ef2251a1a5b880.gif"
Received 200 from "http://127.0.0.1:34333/assets/application-d83f12f0b0ea0b43e79104a90e874634910929f3a471ffe1d17fce392956fc76.css"
Started request to "http://127.0.0.1:34333/assets/active_scaffold/add-e1facc6f96a51e281f4fdfcdc0a648a6ff84cb2526523459343d8a4f6196a1da.png"
Started request to "http://127.0.0.1:34333/assets/active_scaffold/magnifier-475a6335fb52c21b5fa732518e89408f4277779bf5b015391358b047602b8aff.png"
Received 200 from "http://127.0.0.1:34333/assets/logo128-8f969fe4ae654a8578aeb686f3c537290f2d2e4731cb15026c036d18a3456022.png"
Received 200 from "http://127.0.0.1:34333/assets/active_scaffold/indicator-07b202d8027099d3add8213095a203cecb4938acdebc80f755ef2251a1a5b880.gif"
Received 200 from "http://127.0.0.1:34333/assets/application-40a174b892afd166ed6429966cb6c56b09bb9aa5ed8a35b697855aca2ee9792a.js"
Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see
displays macro index (FAILED - 1)
Messages
when there are no messages
Request to unknown URL: https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css
To block requests to unknown URLs:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
To allow just this URL:
Capybara::Webkit.configure do |config|
config.allow_url("https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css")
end
To allow requests to URLs from this host:
Capybara::Webkit.configure do |config|
config.allow_url("maxcdn.bootstrapcdn.com")
end
Request to unknown URL: https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css
To block requests to unknown URLs:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
To allow just this URL:
Capybara::Webkit.configure do |config|
config.allow_url("https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css")
end
To allow requests to URLs from this host:
Capybara::Webkit.configure do |config|
config.allow_url("code.ionicframework.com")
end
Request to unknown URL: https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic
To block requests to unknown URLs:
Capybara::Webkit.configure do |config|
config.block_unknown_urls
end
To allow just this URL:
Capybara::Webkit.configure do |config|
config.allow_url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic")
end
To allow requests to URLs from this host:
Capybara::Webkit.configure do |config|
config.allow_url("fonts.googleapis.com")
end
displays a `no messages` message (FAILED - 2)
错误:
1) Macros displays macro index
Got 0 failures and 2 other errors:
1.1) Failure/Error: visit macros_path
EOFError:
end of file reached
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:41:in `read_nonblock'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:41:in `read'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:32:in `gets'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:315:in `check'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:221:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:20:in `visit'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/driver.rb:50:in `visit'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/session.rb:254:in `visit'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/macros_spec.rb:12:in `block (2 levels) in <top (required)>'
1.2) Failure/Error:
raise(Capybara::Webkit::CrashError, <<-MESSAGE.strip)
The webkit_server process crashed!
#{exception.message}
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
MESSAGE
Capybara::Webkit::CrashError:
The webkit_server process crashed!
Broken pipe
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:227:in `rescue in command'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:215:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:41:in `reset!'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/driver.rb:285:in `reset!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/session.rb:112:in `reset!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara.rb:336:in `block in reset_sessions!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara.rb:336:in `reverse_each'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara.rb:336:in `reset_sessions!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::EPIPE:
# Broken pipe
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:22:in `write'
2) Messages when there are no messages displays a `no messages` message
Got 0 failures and 2 other errors:
2.1) Failure/Error: visit messages_path
EOFError:
end of file reached
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:41:in `read_nonblock'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:41:in `read'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:32:in `gets'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:315:in `check'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:221:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:20:in `visit'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/driver.rb:50:in `visit'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/session.rb:254:in `visit'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/messages_spec.rb:9:in `block (2 levels) in <top (required)>'
2.2) Failure/Error:
raise(Capybara::Webkit::CrashError, <<-MESSAGE.strip)
The webkit_server process crashed!
#{exception.message}
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
MESSAGE
Capybara::Webkit::CrashError:
The webkit_server process crashed!
Broken pipe
This is a bug in capybara-webkit. For help with this crash, please visit:
https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:227:in `rescue in command'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:215:in `command'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/browser.rb:41:in `reset!'
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/driver.rb:285:in `reset!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/session.rb:112:in `reset!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara.rb:336:in `block in reset_sessions!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara.rb:336:in `reverse_each'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara.rb:336:in `reset_sessions!'
# /usr/local/bundle/gems/capybara-2.13.0/lib/capybara/rspec.rb:21:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::EPIPE:
# Broken pipe
# /usr/local/bundle/gems/capybara-webkit-1.14.0/lib/capybara/webkit/connection.rb:22:in `write'