capybara-screenshot
capybara-screenshot copied to clipboard
"No such file or directory @ rb_sysopen" when saving multiple screenshots in 1 run (cucumber)
When I run a cucumber feature, in this case a scenario outline with multiple examples, only the first failure's screenshot gets saved. The subsequent ones produce this error:
No such file or directory @ rb_sysopen - features/failure_screenshots/<filename>.png (Errno::ENOENT)
I don't get any line numbers or other information to help diagnose this.
I've modified Capybara's save_path, prune_strategy, append_timestamp, and used my own filename (register_filename_prefix_formatter). Has anyone else had this issue?
I've modified Capybara's save_path, prune_strategy, append_timestamp, and used my own filename (register_filename_prefix_formatter).
Can you show the code for that?
Sure,
Capybara.save_path = "features/failure_screenshots"
Capybara::Screenshot.prune_strategy = :keep_last_run
Capybara::Screenshot.register_filename_prefix_formatter(:cucumber) do |example|
"screenshot_#{example.name.gsub(' ', '-').gsub(',', '_')}"
end
Capybara::Screenshot.append_timestamp = false
I'm using save_path instead of the alternative because of a deprecated warning from capybara.
I have accounted the same problem, if you have solved it, please show me the way, Thanks in advance. @Heanthor
I have just solved it. you could change the save path to "./features/failure_screenshots", have a try @Heanthor
I have just solved it. you could change the save path to "./features/failure_screenshots", have a try @Heanthor
worked for me