Search code examples
rubycucumberappium

Appium Tests Screenshot folder delete programmatically


I am taking screen shots on each scenarios for report purpose. But folder size is increasing each time. Is there any way to delete old screen shots automatically?


Solution

  • You can write below code in hooks.rb file. It will delete all the screenshots before creating new screen shots for each new report.

    AfterConfiguration do
      FileUtils.rm_r("screenshots_folder_name") if File.directory?("screenshots_folder_name")
    end