capybara-screenshot icon indicating copy to clipboard operation
capybara-screenshot copied to clipboard

"No such file or directory @ rb_sysopen" when saving multiple screenshots in 1 run (cucumber)

Open Heanthor opened this issue 8 years ago • 5 comments

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?

Heanthor avatar Aug 11 '16 14:08 Heanthor

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?

mattheworiordan avatar Aug 11 '16 18:08 mattheworiordan

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.

Heanthor avatar Aug 11 '16 19:08 Heanthor

I have accounted the same problem, if you have solved it, please show me the way, Thanks in advance. @Heanthor

Lupeipei avatar Dec 28 '17 05:12 Lupeipei

I have just solved it. you could change the save path to "./features/failure_screenshots", have a try @Heanthor

Lupeipei avatar Dec 28 '17 05:12 Lupeipei

I have just solved it. you could change the save path to "./features/failure_screenshots", have a try @Heanthor

worked for me

skarand avatar Jul 03 '19 09:07 skarand