title: Capybara/Rspec - Is there a way to test if an input box has been filled before clicking on submit?
body: <p>I am learning RSpec and Capybara and trying to test if a user can navigate to the login page (powered by Devise) and successfully login. The test is not seeing the page it should be after logging in successfully. When using the browser, if input is not present, it returns to the login page. I am using Rails 5.</p>
  
  <p><strong>login_spec.rb</strong></p>
  
  <pre><code>require 'spec_helper'
  require 'rails_helper'
  RSpec.feature "Logging in a User" do
      scenario "Logging in user shows special content" do
          visit "/"
          click_link "Sign In"    
  
          page.should have_content("Password")
  
          #fill in login information
          page.fill_in 'Email', with: 'admin@example.com'
          page.fill_in 'Password', with: 'some_password'
          click_on 'Log in'
  
          page.should have_no_content("Wait for the text which is available in the sign in page but not on next page")
          page.should have_content('User:')
          expect(page.current_path).to eq(root_path)
      end
  end
  </code></pre>
  
  <p><strong>Capybara error message:</strong></p>
  
  <pre><code>  1) Logging in a User Logging in user shows special content
       Failure/Error: page.should have_content('User:')
         expected to find text "User:" in "Log in\nEmail\nPassword\nRemember me\nSign up Forgot your password?"
       # ./spec/features/login_spec.rb:17:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>