capybara-screenshot
capybara-screenshot copied to clipboard
capybara-screenshot does/does not/does make screenshots
rspec spec/features/auth/signin_spec.rb
FFFFFF
Failures:
1) Sign in process should not allow a sign in without a password
Failure/Error: log_in(user)
Capybara::ElementNotFound:
Unable to find link or button "#logoutMenu"
# ./spec/test_auth_helpers.rb:13:in `log_out'
# ./spec/test_auth_helpers.rb:4:in `log_in'
# ./spec/features/auth/signin_spec.rb:7:in `block (2 levels) in <top (required)>'
Finished in 7.64 seconds
6 examples, 6 failures
Failed examples:
rspec ./spec/features/auth/signin_spec.rb:17 # Sign in process should not allow a sign in without a password
rspec ./spec/features/auth/signin_spec.rb:43 # Sign in process should allow a user to log in with the correct credentials
rspec ./spec/features/auth/signin_spec.rb:29 # Sign in process should not allow a sign in with an incorrect username
rspec ./spec/features/auth/signin_spec.rb:23 # Sign in process should not allow a sign in without a username
rspec ./spec/features/auth/signin_spec.rb:36 # Sign in process should not allow a sign in with an incorrect password
rspec ./spec/features/auth/signin_spec.rb:12 # Sign in process should not allow a sign in with no data
When I try to do "screenshot_and_open_image" in my test-helper I get:
Launchy::ApplicationNotFoundError:
No application found to handle '/Users/.../development/.../tmp/capybara/screenshot_2014-10-29-10-19-32.772.png'
Which is absolute correct, bacause a 'ls -l' shows not a single file in the directory.
The funny thing: I can't tell when why it is working sometimes and most of the time not...
oh: used a old version, updated to 1.0.3, nothing changed. capybara is 2.2.1
Got it, after some problems I commented some stuff out to check where the error is. saver.rb:25,26:
# if current_path empty then nothing to screen shot as browser has not loaded any URL
return if capybara.current_path.to_s.empty?
One line I commented out was the visit '/' command ;) So one question remains: When it is a js-test, why no error is thrown (or at least a warning message)?
@AntonTrapp, apologies for not replying to this, is this still an issue? Did you find a solution?
Wow. Some time ago... ;) - Tnx for the answer.
Let me thing about it. When I remember correct the error occured before the first visit command. So everybody just has to use it in a "sane" way. However I would throw a "visit a page before you try to generate a screenshot" error instead of a silent return. Would be more user friendly and save many people a lot of time. Not sure so, quite some time and I am old and forget many things :D
I'm running into the same issue.
I have a single page Javascript app running on a remote server and the page being tested is the root URL. When any of the tests fail, it does not take a screenshot because capybara.current_path
is empty (even though the page was loaded successfully).
Are there any workarounds? Alternatively, is there a better way to check that the page was loaded? I'd happily create a PR.
I guess I don't have this issues because I stopped using after do
hook at all.
Are there any workarounds? Alternatively, is there a better way to check that the page was loaded? I'd happily create a PR.
A PR would be welcome, but are you sure you're using the latest version as we've recently had quite a few updates?