Class: Applitools::Calabash::IosScreenshotProvider

Inherits:
CalabashScreenshotProvider show all
Includes:
Singleton
Defined in:
lib/applitools/calabash/calabash_screenshot_provider.rb

Constant Summary

Constants inherited from CalabashScreenshotProvider

CalabashScreenshotProvider::WAIT_BEFORE_SCREENSHOT

Instance Attribute Summary

Attributes inherited from CalabashScreenshotProvider

#context, #debug_screenshot_provider, #density

Instance Method Summary collapse

Methods inherited from CalabashScreenshotProvider

#initialize, #using_context, #with_debug_screenshot_provider, #with_density

Constructor Details

This class inherits a constructor from Applitools::Calabash::CalabashScreenshotProvider

Instance Method Details

#capture_screenshot(options = {}) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/applitools/calabash/calabash_screenshot_provider.rb', line 66

def capture_screenshot(options = {})
  sleep WAIT_BEFORE_SCREENSHOT
  result = nil
  Applitools::Calabash::Utils.using_screenshot(context) do |screenshot_path|
    screenshot = ::ChunkyPNG::Image.from_file(screenshot_path)
    save_debug_screenshot(screenshot, options[:debug_suffix])
    result = Applitools::Calabash::EyesCalabashIosScreenshot.new(
      Applitools::Screenshot.from_image(
        screenshot
      ),
      scale_factor: density
    )
  end
  result
end