New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong screenshot path when attempting to render screenshot in system tests #1865
Comments
fables-tales
pushed a commit
that referenced
this issue
Sep 14, 2017
The problem here is that rails calls `#method_name` on the example a number of times in order to correctly generate the screenshot and then manipulate it. Given that we were randomising the integer that was generated on every call, this didn't work. This patch solves the problem by memoizing the generated method name so that the screenshot path is generated once per example and then correctly accessed on subsequent method calls.
Thanks a lot for fixing this @samphippen 馃挌 馃 |
11factory
pushed a commit
to 11factory/rspec-rails
that referenced
this issue
Oct 18, 2017
The problem here is that rails calls `#method_name` on the example a number of times in order to correctly generate the screenshot and then manipulate it. Given that we were randomising the integer that was generated on every call, this didn't work. This patch solves the problem by memoizing the generated method name so that the screenshot path is generated once per example and then correctly accessed on subsequent method calls.
sebjacobs
pushed a commit
to futurelearn/rspec-rails
that referenced
this issue
Mar 15, 2019
The problem here is that rails calls `#method_name` on the example a number of times in order to correctly generate the screenshot and then manipulate it. Given that we were randomising the integer that was generated on every call, this didn't work. This patch solves the problem by memoizing the generated method name so that the screenshot path is generated once per example and then correctly accessed on subsequent method calls.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#1813 introduced support for Rails 5.1 system tests. Thank you for that! 馃帀 We're already using it (living on the edge 馃槃).
We encountered an issue with automatic screenshots that are created when a spec fails. Apart from the actual failure message (for example
Failure/Error: expect(page).to have_content("Details zu Sendunggg")
) we also get an error message that screenshot cannot be displayed (No such file or directory @ rb_sysopen
).The screenshot is correctly saved to
tmp/screenshots
, but it cannot be displayed.See:
After looking at the
rspec-rails
code, it seems thatrspec-rails
implementsmethod_name
method here. Rails uses this method to generate the screenshot path here.The thing is that
method_name
generates a random number and Rails seems to call it twice, so we get two different paths and reading the image fails.Please let me know if I can provide any more details to help you identify the problem.
The text was updated successfully, but these errors were encountered: