Class: Applitools::Calabash::FullPageCaptureAlgorithm::AndroidScrollView

Inherits:
Base
  • Object
show all
Defined in:
lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_SLEEP_INTERVAL

Instance Attribute Summary

Attributes inherited from Base

#context, #debug_screenshot_provider, #element, #screenshot_provider, #stitched_image

Instance Method Summary collapse

Methods included from Helpers

#abstract_attr_accessor, #abstract_method

Constructor Details

#initialize(*args) ⇒ AndroidScrollView

Returns a new instance of AndroidScrollView.



6
7
8
9
10
11
# File 'lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb', line 6

def initialize(*args)
  super
  @entire_content = nil
  @stitched_image = nil
  @original_position = nil
end

Instance Method Details

#get_stitched_region(scroll_to_top = true) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb', line 13

def get_stitched_region(scroll_to_top = true)
  create_entire_image
  store_original_position
  scroll_top if scroll_to_top

  scroll_it! do |scrollable_element|
    put_it_on_canvas!(
      screenshot_provider.capture_screenshot.sub_screenshot(
        eyes_window,
        Applitools::Calabash::EyesCalabashScreenshot::DRIVER,
        false,
        false
      ).image.image,
      element.location.offset_negative(scrollable_element.location)
    )
  end

  restore_original_position

  Applitools::Calabash::EyesCalabashAndroidScreenshot.new(
    Applitools::Screenshot.from_image(stitched_image),
    density: screenshot_provider.density
  )
end