简体   繁体   English

Rails-devise-roles测试中的代码船中断

[英]Codeship breaks on rails-devise-roles tests

The rails-devise-roles app's Selenium tests for user-delete-spec.rb and user-edit-spec.rb seems to break when running in Codeship's CI. 在Codeship的CI中运行时,rails user-edit-spec.rb -roles应用程序对user-delete-spec.rbuser-edit-spec.rb的Selenium测试似乎已中断。 The rspec works fine on my local machine, but breaks in Codeship. rspec在我的本地计算机上可以正常工作,但是在Codeship中中断。

The rspec output I get is as follows: 我得到的rspec输出如下:

Failures:

1) User delete user can delete own account
Failure/Error: visit edit_user_registration_path(user)

Selenium::WebDriver::Error::ServerError:
  status code 500
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:72:in `assert_ok'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/common.rb:83:in `new'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/common.rb:83:in `create_response'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/default.rb:107:in `request'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/common.rb:61:in `call'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/w3c_bridge.rb:640:in `execute'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/w3c_bridge.rb:114:in `create_session'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/w3c_bridge.rb:76:in `initialize'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:45:in `initialize'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/driver.rb:52:in `new'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/driver.rb:52:in `for'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver.rb:88:in `for'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/selenium/driver.rb:22:in `browser'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/selenium/driver.rb:62:in `visit'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/session.rb:269:in `visit'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/dsl.rb:50:in `block (2 levels) in <module:DSL>'
# ./spec/features/users/user_delete_spec.rb:21:in `block (2 levels) in <top (required)>'

2) User edit user changes email address
Failure/Error: visit edit_user_registration_path(user)

Selenium::WebDriver::Error::ServerError:
  status code 500
# [removed stack trace]

3) User edit user cannot cannot edit another user's profile
Failure/Error: visit edit_user_registration_path(other)

Selenium::WebDriver::Error::ServerError:
  status code 500
# [removed stack trace]

Finished in 23.21 seconds (files took 2.99 seconds to load)
31 examples, 3 failures

Failed examples:

rspec ./spec/features/users/user_delete_spec.rb:18 # User delete user can delete own account
rspec ./spec/features/users/user_edit_spec.rb:18 # User edit user changes email address
rspec ./spec/features/users/user_edit_spec.rb:45 # User edit user cannot cannot edit another user's profile

This is an example of one of the failing scenarios: 这是其中一种失败情况的示例:

scenario 'user can delete own account' do
    # skip 'skip a slow test' [removed from the original file]
    user = FactoryGirl.create(:user)
    login_as(user, :scope => :user)
    visit edit_user_registration_path(user)
    click_button 'Cancel my account'
    page.driver.browser.switch_to.alert.accept
    expect(page).to have_content I18n.t 'devise.registrations.destroyed'
end

What's going wrong here, and how can I modify this so the test passes? 这里出了什么问题,我该如何修改才能通过测试? (To clarify, there is no error 500 on my local deployment on any of these pages, nor on the Heroku live deployment of my app which is based off rails-devise-roles.) (为澄清起见,在这些页面中的任何页面上,我的本地部署都没有错误500,也没有基于rails-devise-roles的我的应用程序的Heroku实时部署中出现错误500。)

Reached out to Codeship support, who were very helpful, and told me that this was an issue with both Firefox and geckodriver for Firefox needing to be updated on the Codeship VM. 接触到了非常有帮助的Codeship支持人员,他告诉我这是Firefox和Firefox的geckodriver都存在的问题,需要在Codeship VM上进行更新。 If anyone else also has this issue, the code that makes it work is below: 如果其他任何人也有此问题,请参见以下代码:

export FIREFOX_VERSION=53.0.3
curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/firefox.sh | bash -s
export GECKODRIVER_VERSION=0.17.0
source /dev/stdin <<< "$(curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/languages/rust.sh)"
curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/geckodriver.sh | bash -s

Huge props to Joe Siewert from the Codeship support team for getting this fix out to me! 来自Codeship支持团队的Joe Siewert的巨大道具,可以帮助我解决这个问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM