Class: TestCentricity::ScreenSection

Inherits:
BaseScreenSectionObject show all
Includes:
Test::Unit::Assertions
Defined in:
lib/testcentricity_mobile/app_core/screen_section.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseScreenSectionObject

#populate_data_fields, #swipe_gesture, trait, #verify_ui_states

Constructor Details

#initialize(name, parent, locator, context) ⇒ ScreenSection

Returns a new instance of ScreenSection.



13
14
15
16
17
18
19
20
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 13

def initialize(name, parent, locator, context)
  @name        = name
  @parent      = parent
  @locator     = locator
  @context     = context
  @parent_list = nil
  @list_index  = nil
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



7
8
9
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 7

def context
  @context
end

#list_indexObject

Returns the value of attribute list_index.



11
12
13
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 11

def list_index
  @list_index
end

#locatorObject

Returns the value of attribute locator.



8
9
10
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 8

def locator
  @locator
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 7

def name
  @name
end

#parentObject

Returns the value of attribute parent.



9
10
11
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 9

def parent
  @parent
end

#parent_listObject

Returns the value of attribute parent_list.



10
11
12
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 10

def parent_list
  @parent_list
end

Class Method Details

.button(element_name, locator) ⇒ Object

Declare and instantiate a single button UI Element for this screen section object.

Examples:

button :video_play,  { accessibility_id: 'video icon play' }

Parameters:

  • element_name (Symbol)

    name of button object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



125
126
127
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 125

def self.button(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppButton, locator)
end

.buttons(element_hash) ⇒ Object

Declare and instantiate a collection of buttons for this screen section object.

Examples:

buttons video_back:    { accessibility_id: 'video icon backward' },
        video_play:    { accessibility_id: 'video icon play' },
        video_pause:   { accessibility_id: 'video icon stop' },
        video_forward: { accessibility_id: 'video icon forward' }

Parameters:

  • element_hash (Hash)

    names of buttons (as symbol) and locator Hash



138
139
140
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 138

def self.buttons(element_hash)
  element_hash.each_pair { |element_name, locator| button(element_name, locator) }
end

.checkbox(element_name, locator) ⇒ Object

Declare and instantiate a single checkbox UI Element for this screen section object.

Examples:

checkbox :bill_address_check, { xpath: '//XCUIElementTypeOther[contains(@name, "billing checkbox")]'}

Parameters:

  • element_name (Symbol)

    name of checkbox object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



194
195
196
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 194

def self.checkbox(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppCheckBox, locator)
end

.checkboxes(element_hash) ⇒ Object

Declare and instantiate a collection of checkboxes for this screen section object.

Examples:

checkboxes bill_address_check: { xpath: '//XCUIElementTypeOther[contains(@name, "billing checkbox")]'},
           is_gift_check: { accessibility_id: 'is a gift' }

Parameters:

  • element_hash (Hash)

    names of checkboxes (as symbol) and locator Hash



205
206
207
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 205

def self.checkboxes(element_hash)
  element_hash.each_pair { |element_name, locator| checkbox(element_name, locator) }
end

.element(element_name, locator) ⇒ Object

Declare and instantiate a single generic UI Element for this screen section object.

  • The locator_identifier (a String) is the value or attribute that uniquely and unambiguously identifies the UI element.

Examples:

element :video_player, { accessibility_id: 'YouTube Video Player' }

Parameters:

  • element_name (Symbol)

    name of UI object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier } The locator_strategy (a Symbol) specifies the selector strategy that Appium will use to find the UI element. Valid selectors are accessibility_id:, id:, name:, class:, xpath:, predicate: (iOS only), class_chain: (iOS only), and css: (WebViews in hybrid apps only).



102
103
104
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 102

def self.element(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppUIElement, locator)
end

.elements(element_hash) ⇒ Object

Declare and instantiate a collection of generic UI Elements for this screen section object.

Examples:

elements drop_down_field: { accessibility_id: 'drop_trigger' },
         settings_item: { accessibility_id: 'settings' },
         log_out_item:  { accessibility_id: 'logout' }

Parameters:

  • element_hash (Hash)

    names of UI objects (as a Symbol) and locator Hash



114
115
116
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 114

def self.elements(element_hash)
  element_hash.each_pair { |element_name, locator| element(element_name, locator) }
end

.image(element_name, locator) ⇒ Object

Declare and instantiate a single image UI Element for this screen section object.

Examples:

image :product_image, { xpath: '//XCUIElementTypeImage' }

Parameters:

  • element_name (Symbol)

    name of image object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



282
283
284
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 282

def self.image(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppImage, locator)
end

.images(element_hash) ⇒ Object

Declare and instantiate a collection of images for this screen section object.

Examples:

images empty_cart_image: { accessibility_id: 'empty_cart' },
       logo_image: { accessibility_id: 'WebdriverIO logo' }

Parameters:

  • element_hash (Hash)

    names of images (as symbol) and locator Hash



293
294
295
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 293

def self.images(element_hash)
  element_hash.each_pair { |element_name, locator| image(element_name, locator) }
end

.label(element_name, locator) ⇒ Object

Declare and instantiate a single label UI Element for this screen section object.

Examples:

label :header_label, { accessibility_id: 'container header' }

Parameters:

  • element_name (Symbol)

    name of label object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



238
239
240
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 238

def self.label(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppLabel, locator)
end

.labels(element_hash) ⇒ Object

Declare and instantiate a collection of labels for this screen section object.

Examples:

labels total_qty_value:   { accessibility_id: 'total number' },
       total_price_value: { accessibility_id: 'total price' }

Parameters:

  • element_hash (Hash)

    names of labels (as symbol) and locator Hash



249
250
251
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 249

def self.labels(element_hash)
  element_hash.each_pair { |element_name, locator| label(element_name, locator) }
end

.list(element_name, locator) ⇒ Object

Declare and instantiate a single list UI Element for this screen section object.

Examples:

list :carousel_list, { accessibility_id: 'Carousel' }

Parameters:

  • element_name (Symbol)

    name of list object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



260
261
262
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 260

def self.list(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppList, locator)
end

.lists(element_hash) ⇒ Object

Declare and instantiate a collection of lists for this screen section object.

Examples:

lists product_grid: { xpath: '//android.widget.ScrollView/android.view.ViewGroup' },
      cart_list: { xpath: '//android.widget.ScrollView[@content-desc="cart screen"]' }

Parameters:

  • element_hash (Hash)

    names of lists (as symbol) and locator Hash



271
272
273
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 271

def self.lists(element_hash)
  element_hash.each_pair { |element_name, locator| list(element_name, locator) }
end

.radio(element_name, locator) ⇒ Object

Declare and instantiate a single radio button UI Element for this screen section object.

Examples:

radio :unicode_radio, { xpath: '//XCUIElementTypeRadioButton[@label="Unicode"]'}

Parameters:

  • element_name (Symbol)

    name of radio button object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



216
217
218
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 216

def self.radio(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppRadio, locator)
end

.radios(element_hash) ⇒ Object

Declare and instantiate a collection of radio buttons for this screen section object.

Examples:

radios unicode_radio: { xpath: '//XCUIElementTypeRadioButton[@label="Unicode"]'},
       ascii_radio:   { xpath: '//XCUIElementTypeRadioButton[@label="ASCII"] }

Parameters:

  • element_hash (Hash)

    names of radio buttons (as symbol) and locator Hash



227
228
229
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 227

def self.radios(element_hash)
  element_hash.each_pair { |element_name, locator| radio(element_name, locator) }
end

.section(section_name, obj, locator = 0) ⇒ Object

Instantiate a single ScreenSection object within this ScreenSection object.

Examples:

section :nav_menu, NavMenu

Parameters:

  • section_name (Symbol)

    name of ScreenSection object (as a symbol)

  • class_name (Class)

    Class name of ScreenSection object



304
305
306
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 304

def self.section(section_name, obj, locator = 0)
  define_section_element(section_name, obj, locator)
end

.sections(section_hash) ⇒ Object

Declare and instantiate a collection of ScreenSection objects for this ScreenSection object.

Examples:

sections product_grid_item: ProductGridItem,
         sort_by_menu:      SortByMenu

Parameters:

  • element_hash (Hash)

    names of ScreenSections (as symbol) and class name



315
316
317
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 315

def self.sections(section_hash)
  section_hash.each_pair { |section_name, class_name| section(section_name, class_name) }
end

.switch(element_name, locator) ⇒ Object

Declare and instantiate a single switch UI Element for this screen section object.

Examples:

switch :debug_mode_switch, { accessibility_id: 'debug mode' }

Parameters:

  • element_name (Symbol)

    name of switch object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



172
173
174
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 172

def self.switch(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppSwitch, locator)
end

.switches(element_hash) ⇒ Object

Declare and instantiate a collection of switches for this screen section object.

Examples:

switches debug_mode_switch: { accessibility_id: 'debug mode' },
         metrics_switch: { accessibility_id: 'metrics' }

Parameters:

  • element_hash (Hash)

    names of switches (as symbol) and locator Hash



183
184
185
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 183

def self.switches(element_hash)
  element_hash.each_pair { |element_name, locator| switch(element_name, locator) }
end

.textfield(element_name, locator) ⇒ Object

Declare and instantiate a single textfield UI Element for this screen section object.

Examples:

textfield :payee_name_field, { xpath: '//android.widget.EditText[@content-desc="Full Name* input field"]' }
textfield :payee_name_field, { xpath: '//XCUIElementTypeTextField[@name="Full Name* input field"]' }

Parameters:

  • element_name (Symbol)

    name of textfield object (as a symbol)

  • locator (Hash)

    { locator_strategy: locator_identifier }



150
151
152
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 150

def self.textfield(element_name, locator)
  define_section_element(element_name, TestCentricity::AppElements::AppTextField, locator)
end

.textfields(element_hash) ⇒ Object

Declare and instantiate a collection of textfields for this screen section object.

Examples:

textfields username_field: { accessibility_id: 'Username input field' },
           password_field: { accessibility_id: 'Password input field' }

Parameters:

  • element_hash (Hash)

    names of textfields (as symbol) and locator Hash



161
162
163
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 161

def self.textfields(element_hash)
  element_hash.each_pair { |element_name, locator| textfield(element_name, locator) }
end

Instance Method Details

#clickObject

Click on a screen Section object

Examples:

bar_chart_section.click


324
325
326
327
328
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 324

def click
  section = find_section
  section_not_found_exception(section)
  section.click
end

#disabled?Boolean

Is screen Section object disabled (not enabled)?

Examples:

bar_chart_section.disabled?

Returns:

  • (Boolean)


444
445
446
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 444

def disabled?
  !enabled?
end

#double_tapObject

Double-tap on a screen Section object

Examples:

bar_chart_section.double_tap


349
350
351
352
353
354
355
356
357
358
359
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 349

def double_tap
  section = find_section
  section_not_found_exception(section)
  driver.action
        .click_and_hold(section)
        .release
        .pause(duration: 0.2)
        .click_and_hold(section)
        .release
        .perform
end

#enabled?Boolean

Is screen Section object enabled?

Examples:

bar_chart_section.enabled?

Returns:

  • (Boolean)


432
433
434
435
436
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 432

def enabled?
  section = find_section
  section_not_found_exception(section)
  section.enabled?
end

#exists?Boolean

Does screen Section object exists?

Examples:

navigation_toolbar.exists?

Returns:

  • (Boolean)


421
422
423
424
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 421

def exists?
  section = find_section
  section != nil
end

#get_item_countObject



59
60
61
62
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 59

def get_item_count
  raise 'No parent list defined' if @parent_list.nil?
  @parent_list.get_item_count
end

#get_list_itemsObject



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 64

def get_list_items
  items = []
  (1..get_item_count).each do |item|
    set_list_index(nil, item)
    begin
      items.push(get_value)
    rescue
      scroll_into_view(@parent_list.scroll_mode)
      items.push(get_value)
    end
  end
  items
end

#get_locatorObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 22

def get_locator
  my_locator = if @locator.zero? && defined?(section_locator)
                 section_locator
               else
                 @locator
               end
  locators = []
  if @context == :section && !@parent.nil?
    locators = @parent.get_locator
  end

  if @parent_list.nil?
    locators.push(my_locator)
  else
    locators.push(@parent_list.get_locator)
    if @list_index.nil?
      locators.push(my_locator)
    else
      item_objects = @parent_list.item_refs
      if item_objects.nil?
        list_key = my_locator.keys[0]
        list_value = "#{my_locator.values[0]}[#{@list_index}]"
      else
        list_key = :object
        list_value = item_objects[@list_index - 1]
      end
      locators.push( { list_key => list_value } )
    end
  end
  locators
end

#get_nameObject



82
83
84
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 82

def get_name
  @name
end

#get_object_typeObject



78
79
80
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 78

def get_object_type
  :section
end

#heightInteger

Return height of screen Section object.

Examples:

button_height = my_button.height

Returns:

  • (Integer)


565
566
567
568
569
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 565

def height
  section = find_section
  section_not_found_exception(section)
  section.size.height
end

#hidden?Boolean

Is screen Section object hidden (not visible)?

Examples:

navigation_toolbar.hidden?

Returns:

  • (Boolean)


467
468
469
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 467

def hidden?
  !visible?
end

#long_press(duration = 1) ⇒ Object

Long press on a screen Section object

Examples:

header_image.long_press(1.5)

Parameters:

  • duration (Float) (defaults to: 1)

    duration of long press in seconds



367
368
369
370
371
372
373
374
375
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 367

def long_press(duration = 1)
  section = find_section
  section_not_found_exception(section)
  driver.action
        .click_and_hold(section)
        .pause(duration: duration)
        .release
        .perform
end

#scroll_into_view(scroll_mode = :vertical) ⇒ Object

Scroll the screen Section object until it is visible. If scroll_mode is not specified, then vertical scrolling will be used.

Examples:

carousel_item.scroll_into_view(scroll_mode = :horizontal)

Parameters:

  • scroll_mode (Symbol) (defaults to: :vertical)

    :vertical (default) or :horizontal



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 384

def scroll_into_view(scroll_mode = :vertical)
  return if visible?
  obj = element
  object_not_found_exception(obj)
  driver.action.move_to(obj).perform
  case scroll_mode
  when :vertical
    start_direction = :down
    end_direction = :up
  when :horizontal
    start_direction = :right
    end_direction = :left
  else
    raise "#{scroll_mode} is not a valid selector"
  end
  try_count = 8
  direction = start_direction
  while hidden?
    swipe_gesture(direction, distance = 0.2)
    try_count -= 1
    if try_count.zero?
      if direction == end_direction
        break
      else
        direction = end_direction
        try_count = 8
      end
    end
  end
end

#set_list_index(list, index = 1) ⇒ Object



54
55
56
57
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 54

def set_list_index(list, index = 1)
  @parent_list = list unless list.nil?
  @list_index  = index
end

#set_parent(parent) ⇒ Object



86
87
88
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 86

def set_parent(parent)
  @parent = parent
end

#tapObject

Tap on a screen Section object

Examples:

bar_chart_section.tap


335
336
337
338
339
340
341
342
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 335

def tap
  section = find_section
  section_not_found_exception(section)
  driver.action
        .click_and_hold(section)
        .release
        .perform
end

#visible?Boolean

Is screen Section object visible?

Examples:

navigation_toolbar.visible?

Returns:

  • (Boolean)


454
455
456
457
458
459
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 454

def visible?
  section = find_section
  return false if section.nil?

  section.displayed?
end

#wait_until_exists(seconds = nil, post_exception = true) ⇒ Object

Wait until the screen Section object exists, or until the specified wait time has expired. If the wait time is nil, then the wait time will be Environ.default_max_wait_time.

Examples:

navigation_toolbar.wait_until_exists(1.5)

Parameters:

  • seconds (Integer or Float) (defaults to: nil)

    wait time in seconds



478
479
480
481
482
483
484
485
486
487
488
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 478

def wait_until_exists(seconds = nil, post_exception = true)
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
  wait.until { exists? }
rescue
  if post_exception
    raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless exists?
  else
    exists?
  end
end

#wait_until_gone(seconds = nil, post_exception = true) ⇒ Object

Wait until the screen Section object no longer exists, or until the specified wait time has expired. If the wait time is nil, then the wait time will be Environ.default_max_wait_time.

Examples:

navigation_toolbar.wait_until_gone(5)

Parameters:

  • seconds (Integer or Float) (defaults to: nil)

    wait time in seconds



497
498
499
500
501
502
503
504
505
506
507
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 497

def wait_until_gone(seconds = nil, post_exception = true)
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
  wait.until { !exists? }
rescue
  if post_exception
    raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if exists?
  else
    exists?
  end
end

#wait_until_hidden(seconds = nil, post_exception = true) ⇒ Object

Wait until the screen Section object is hidden, or until the specified wait time has expired. If the wait time is nil, then the wait time will be Environ.default_max_wait_time.

Examples:

navigation_toolbar.wait_until_hidden(2)

Parameters:

  • seconds (Integer or Float) (defaults to: nil)

    wait time in seconds



535
536
537
538
539
540
541
542
543
544
545
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 535

def wait_until_hidden(seconds = nil, post_exception = true)
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
  wait.until { hidden? }
rescue
  if post_exception
    raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if visible?
  else
    visible?
  end
end

#wait_until_visible(seconds = nil, post_exception = true) ⇒ Object

Wait until the screen Section object is visible, or until the specified wait time has expired. If the wait time is nil, then the wait time will be Environ.default_max_wait_time.

Examples:

navigation_toolbar.wait_until_visible(1.5)

Parameters:

  • seconds (Integer or Float) (defaults to: nil)

    wait time in seconds



516
517
518
519
520
521
522
523
524
525
526
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 516

def wait_until_visible(seconds = nil, post_exception = true)
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
  wait.until { visible? }
rescue
  if post_exception
    raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless visible?
  else
    visible?
  end
end

#widthInteger

Return width of screen Section object.

Examples:

button_width = my_button.width

Returns:

  • (Integer)


553
554
555
556
557
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 553

def width
  section = find_section
  section_not_found_exception(section)
  section.size.width
end

#x_locInteger

Return x coordinate of screen Section object's location.

Examples:

button_x = my_button.x_loc

Returns:

  • (Integer)


577
578
579
580
581
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 577

def x_loc
  section = find_section
  section_not_found_exception(section)
  section.location.x
end

#y_locInteger

Return y coordinate of screen Section object's location.

Examples:

button_x = my_button.x_loc

Returns:

  • (Integer)


589
590
591
592
593
# File 'lib/testcentricity_mobile/app_core/screen_section.rb', line 589

def y_loc
  section = find_section
  section_not_found_exception(section)
  section.location.y
end