Module: Spec::Ui::WebappHelper
- Includes:
- ScreenshotHelper
- Defined in:
- lib/spec/ui/webapp_helper.rb
Constant Summary collapse
- @@spec_number =
0
Instance Method Summary collapse
-
#save_screenshot_and_source(browser) ⇒ Object
Call this method from your teardown block to have source and screenshot written to disk.
- #save_source(dir, spec_number, html) ⇒ Object
Methods included from ScreenshotHelper
Instance Method Details
#save_screenshot_and_source(browser) ⇒ Object
Call this method from your teardown block to have source and screenshot written to disk.
12 13 14 15 16 |
# File 'lib/spec/ui/webapp_helper.rb', line 12 def save_screenshot_and_source(browser) save_screenshot(Spec::Runner.configuration.spec_ui_image_dir, @@spec_number) save_source(Spec::Runner.configuration.spec_ui_image_dir, @@spec_number, browser.html) @@spec_number += 1 end |
#save_source(dir, spec_number, html) ⇒ Object
18 19 20 |
# File 'lib/spec/ui/webapp_helper.rb', line 18 def save_source(dir, spec_number, html) File.open("#{dir}/#{spec_number}.html", "w") {|io| io.write(html)} end |