Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Intermittent issue with log out #997

Closed
gardha opened this issue Apr 18, 2017 · 4 comments
Closed

Intermittent issue with log out #997

gardha opened this issue Apr 18, 2017 · 4 comments

Comments

@gardha
Copy link

gardha commented Apr 18, 2017

Hello,

I have the following setup (latest versions for all):
capybara (2.13.0)
capybara-webkit (1.14.0)
database_cleaner (1.5.3)
Qt 5.5
MacOS Sierra

I am intermittently getting the following errors when attempting to log out my application

     Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `click' for nil:NilClass
     # ./spec/support/feature_helpers.rb:19:in `log_out'
     # ./spec/support/feature_class_helpers.rb:37:in `block in with_login_user'
     # ./spec/spec_helper.rb:75:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:68:in `times'
     # ./spec/spec_helper.rb:68:in `block (2 levels) in <top (required)>'
     # /Users/gardha/.rvm/gems/ruby-2.3.0/gems/rspec-retry-0.3.0/lib/rspec/retry.rb:36:in `block (3 levels) in apply'
     # /Users/gardha/.rvm/gems/ruby-2.3.0/gems/rspec-retry-0.3.0/lib/rspec/retry.rb:27:in `times'
     # /Users/gardha/.rvm/gems/ruby-2.3.0/gems/rspec-retry-0.3.0/lib/rspec/retry.rb:27:in `block (2 levels) in apply'

The page seems to have no content
save_and_open_page output

<!DOCTYPE html><html><head>
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <title>        My Title
</title>
  <meta name="description" content="abc">
  <meta name="robots" content="noindex">
  <link rel="stylesheet" media="all" href="/assets/application.css" data-turbolinks-track="true">
  <script src="/assets/application.js" data-turbolinks-track="true"></script></head></html>

Thanks, any help would be appreciated!

@twalpole
Copy link
Collaborator

If the page has no content then there is nothing to click on, and I guess you're using first rather than find to locate the item you want to click on, which disables Capybaras waiting behaviors. Show the code for your test.

@gardha
Copy link
Author

gardha commented Apr 18, 2017

Your right, I am using first as opposed to find. I have now changed the code to use find to make the test more stable. What I don't understand is why the page would load without the content intermittently. Could it be related to #724

    def log_out
      begin
      visit '/'
      find('.dropdown-toggle').click
      click_link 'Logout'
      expect(page).to have_content 'You have been successfully logged out.'
      rescue
        puts 'Intermittent issue logging out.'
      end
    end

@twalpole
Copy link
Collaborator

twalpole commented Apr 18, 2017

Sure it could be, or it could be throttling you have set up in your app, or it could be something else entirely. Try the fix mentioned at the end of #724 and see if it fixes it for you. Your test.log should also show whether your app was responding with a 304 message which would imply it is issue #724

@twalpole
Copy link
Collaborator

Closing due to lack of response

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants