简体   繁体   中英

Integration testing login with oauth using Rails, Capybara and Selenium?

I created a simple Rails 4 app that uses Facebook to login. I'm writing a feature test that would allow me to sign in to Github and verify that it redirects back to my home page.

The problem:

  • Facebook app is configured to respond to localhost:5000 .
  • Selenium browser launches app in 127.0.0.1:5723

So the login fails.

``` require 'rails_helper'

describe 'the registration process', js: true do it 'signs me in using Github' do visit root_path

click_link 'Sign up / Login'
find("a[href='/users/auth/facebook']").click
within('.auth-form-body') do
  fill_in 'login', with: 'foobar'
  fill_in 'password', with: 'barbaz'
end
click_button 'Sign in'

end end ```

What can I do to configure Selenium to use the same old localhost:5000 ?

Capybara.server_port = 8200

This worked. And I found it from When running selenium with capybara/rails, how do I configure the server?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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