title: Why js from a file in tests does not work?
body: <p>I have a small test to check the appearance of an select by pressing the checkbox.</p>
  
  <p>The js code is in a separate file. If start the server and check manually, everything works.</p>
  
  <p>I also include this file in application.js</p>
  
  <p>But in the test this file is not connected.</p>
  
  <p><strong>If I insert js code directly into the html code, then everything works again.</strong></p>
  
  <p>My js file:</p>
  
  <pre><code>$(document).on('ready', function() {
    $('#checkme').on('change', function(e) {
      if ($(this).is(':checked')) {
        $('#interval').css('display', 'block');
      } else {
        $('#interval').css('display', 'none');
      }
    })
  });
  </code></pre>
  
  <p>My test:</p>
  
  <pre><code>assert_not page.has_select?(:interval) #true
  page.check('Checkme')                 #true
  page.save_and_open_screenshot(full: true) #screenshot
  assert page.has_select?(:interval) #false
  </code></pre>
  
  <p>In the screenshot I received, I see that the checkbox is active, but js does not work.</p>