lib/actir.rb in actir-1.2.4 vs lib/actir.rb in actir-1.2.5

- old
+ new

@@ -44,14 +44,15 @@ end end #若用例执行失败则进行截图,在每个用例的teardown方法中直接调用,传入浏览器对象实例 def screenshot_if_failed(browser) - unless self.passed? - Dir::mkdir('../screenshots') if not File.directory?('../screenshots') - #time = Time.now.strftime('%Y%m%d-%H%M%S') - screenshot = "../screenshots/FAILED_#{self.name}.png" - browser.screenshot.save screenshot + @screen_path = File.join($project_path, 'screenshots') + unless self.passed? + Dir::mkdir(@screen_path) if not File.directory?(@screen_path) + #time = Time.now.strftime('%Y%m%d-%H%M%S') + screenshot = @screen_path + "/FAILED_#{self.name}.png" + browser.screenshot.save screenshot end end end end