testcentricity_web 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/.rubocop.yml +41 -0
  4. data/.yardopts +0 -0
  5. data/Gemfile +0 -0
  6. data/LICENSE.txt +0 -0
  7. data/README.md +9 -3
  8. data/Rakefile +0 -0
  9. data/lib/devices/devices.yml +0 -0
  10. data/lib/testcentricity_web.rb +16 -6
  11. data/lib/testcentricity_web/browser_helper.rb +6 -6
  12. data/lib/testcentricity_web/elements/button.rb +0 -0
  13. data/lib/testcentricity_web/elements/checkbox.rb +4 -4
  14. data/lib/testcentricity_web/elements/file_field.rb +1 -1
  15. data/lib/testcentricity_web/elements/image.rb +1 -1
  16. data/lib/testcentricity_web/elements/label.rb +0 -0
  17. data/lib/testcentricity_web/elements/link.rb +0 -0
  18. data/lib/testcentricity_web/elements/list.rb +5 -5
  19. data/lib/testcentricity_web/elements/radio.rb +3 -3
  20. data/lib/testcentricity_web/elements/select_list.rb +16 -16
  21. data/lib/testcentricity_web/elements/table.rb +3 -4
  22. data/lib/testcentricity_web/elements/textfield.rb +4 -4
  23. data/lib/testcentricity_web/environment.rb +30 -2
  24. data/lib/testcentricity_web/excel_helper.rb +12 -12
  25. data/lib/testcentricity_web/exception_queue_helper.rb +1 -1
  26. data/lib/testcentricity_web/page_objects_helper.rb +102 -102
  27. data/lib/testcentricity_web/page_sections_helper.rb +112 -112
  28. data/lib/testcentricity_web/siebel_open_ui_helper.rb +1 -1
  29. data/lib/testcentricity_web/ui_elements_helper.rb +45 -45
  30. data/lib/testcentricity_web/utility_helpers.rb +0 -0
  31. data/lib/testcentricity_web/version.rb +1 -1
  32. data/lib/testcentricity_web/webdriver_helper.rb +79 -70
  33. data/lib/testcentricity_web/world_extensions.rb +0 -0
  34. data/testcentricity_web.gemspec +1 -0
  35. metadata +5 -3
@@ -37,7 +37,7 @@ module TestCentricity
37
37
  # element :basket_header, 'div.basket_header'
38
38
  #
39
39
  def self.element(element_name, locator)
40
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new("#{element_name}", self, "#{locator}", :section);end))
40
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new("#{element_name}", self, "#{locator}", :section);end))
41
41
  end
42
42
 
43
43
  # Declare and instantiate a collection of generic UI Elements for this page section.
@@ -63,7 +63,7 @@ module TestCentricity
63
63
  # button :login_button, "//input[@id='submit_button']"
64
64
  #
65
65
  def self.button(element_name, locator)
66
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Button.new("#{element_name}", self, "#{locator}", :section);end))
66
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Button.new("#{element_name}", self, "#{locator}", :section);end))
67
67
  end
68
68
 
69
69
  # Declare and instantiate a collection of buttons for this page section.
@@ -89,7 +89,7 @@ module TestCentricity
89
89
  # textfield :password_field, 'input#consumer_password'
90
90
  #
91
91
  def self.textfield(element_name, locator)
92
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new("#{element_name}", self, "#{locator}", :section);end))
92
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new("#{element_name}", self, "#{locator}", :section);end))
93
93
  end
94
94
 
95
95
  # Declare and instantiate a collection of text fields for this page section.
@@ -118,7 +118,7 @@ module TestCentricity
118
118
  # checkbox :accept_terms_checkbox, 'input#accept_terms_conditions', :accept_terms_label
119
119
  #
120
120
  def self.checkbox(element_name, locator, proxy = nil)
121
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
121
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
122
122
  end
123
123
 
124
124
  # Declare and instantiate a collection of checkboxes for this page section.
@@ -146,7 +146,7 @@ module TestCentricity
146
146
  # radio :decline_terms_radio, 'input#decline_terms_conditions', :decline_terms_label
147
147
  #
148
148
  def self.radio(element_name, locator, proxy = nil)
149
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
149
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
150
150
  end
151
151
 
152
152
  # Declare and instantiate a collection of radio buttons for this page section.
@@ -173,7 +173,7 @@ module TestCentricity
173
173
  # label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
174
174
  #
175
175
  def self.label(element_name, locator)
176
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Label.new("#{element_name}", self, "#{locator}", :section);end))
176
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Label.new("#{element_name}", self, "#{locator}", :section);end))
177
177
  end
178
178
 
179
179
  def self.labels(element_hash)
@@ -191,7 +191,7 @@ module TestCentricity
191
191
  # link :shopping_basket_link, "//a[@href='shopping_basket']"
192
192
  #
193
193
  def self.link(element_name, locator)
194
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Link.new("#{element_name}", self, "#{locator}", :section);end))
194
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Link.new("#{element_name}", self, "#{locator}", :section);end))
195
195
  end
196
196
 
197
197
  def self.links(element_hash)
@@ -208,7 +208,7 @@ module TestCentricity
208
208
  # table :payments_table, "//table[@class='payments_table']"
209
209
  #
210
210
  def self.table(element_name, locator)
211
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Table.new("#{element_name}", self, "#{locator}", :section);end))
211
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Table.new("#{element_name}", self, "#{locator}", :section);end))
212
212
  end
213
213
 
214
214
  def self.tables(element_hash)
@@ -226,7 +226,7 @@ module TestCentricity
226
226
  # selectlist :gender_select, "//select[@id='customer_gender']"
227
227
  #
228
228
  def self.selectlist(element_name, locator)
229
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::SelectList.new("#{element_name}", self, "#{locator}", :section);end))
229
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::SelectList.new("#{element_name}", self, "#{locator}", :section);end))
230
230
  end
231
231
 
232
232
  def self.selectlists(element_hash)
@@ -243,7 +243,7 @@ module TestCentricity
243
243
  # list :y_axis_list, 'g.y_axis'
244
244
  #
245
245
  def self.list(element_name, locator)
246
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::List.new("#{element_name}", self, "#{locator}", :section);end))
246
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::List.new("#{element_name}", self, "#{locator}", :section);end))
247
247
  end
248
248
 
249
249
  def self.lists(element_hash)
@@ -261,7 +261,7 @@ module TestCentricity
261
261
  # image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
262
262
  #
263
263
  def self.image(element_name, locator)
264
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new("#{element_name}", self, "#{locator}", :section);end))
264
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new("#{element_name}", self, "#{locator}", :section);end))
265
265
  end
266
266
 
267
267
  def self.images(element_hash)
@@ -278,7 +278,7 @@ module TestCentricity
278
278
  # filefield :attach_file, 's_SweFileName'
279
279
  #
280
280
  def self.filefield(element_name, locator)
281
- class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :section);end))
281
+ class_eval(%(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :section);end))
282
282
  end
283
283
 
284
284
  # Instantiate a single PageSection object within this PageSection object.
@@ -289,7 +289,7 @@ module TestCentricity
289
289
  # section :search_form, SearchForm
290
290
  #
291
291
  def self.section(section_name, class_name, locator = nil)
292
- class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new("#{section_name}", self, "#{locator}", :section);end))
292
+ class_eval(%(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new("#{section_name}", self, "#{locator}", :section);end))
293
293
  end
294
294
 
295
295
  def self.sections(section_hash)
@@ -318,7 +318,7 @@ module TestCentricity
318
318
  # navigation_toolbar.exists?
319
319
  #
320
320
  def exists?
321
- section, _ = find_section
321
+ section, = find_section
322
322
  section != nil
323
323
  end
324
324
 
@@ -329,7 +329,7 @@ module TestCentricity
329
329
  # bar_chart_section.enabled?
330
330
  #
331
331
  def enabled?
332
- not disabled?
332
+ !disabled?
333
333
  end
334
334
 
335
335
  # Is Section object disabled (not enabled)?
@@ -339,7 +339,7 @@ module TestCentricity
339
339
  # bar_chart_section.disabled?
340
340
  #
341
341
  def disabled?
342
- obj, _ = find_element
342
+ obj, = find_element
343
343
  object_not_found_exception(obj, nil)
344
344
  obj.disabled?
345
345
  end
@@ -351,7 +351,7 @@ module TestCentricity
351
351
  # navigation_toolbar.visible?
352
352
  #
353
353
  def visible?
354
- section, _ = find_section
354
+ section, = find_section
355
355
  exists = section
356
356
  visible = false
357
357
  visible = section.visible? if exists
@@ -366,7 +366,7 @@ module TestCentricity
366
366
  # navigation_toolbar.hidden?
367
367
  #
368
368
  def hidden?
369
- not visible?
369
+ !visible?
370
370
  end
371
371
 
372
372
  # Wait until the Section object exists, or until the specified wait time has expired.
@@ -433,97 +433,97 @@ module TestCentricity
433
433
  # bar_chart_section.click_at(10, 10)
434
434
  #
435
435
  def click_at(x, y)
436
- section, _ = find_section
436
+ section, = find_section
437
437
  raise "Section object '#{get_name}' (#{get_locator}) not found" unless section
438
438
  section.click_at(x, y)
439
439
  end
440
440
 
441
441
  def verify_ui_states(ui_states)
442
- ui_states.each do | ui_object, object_states |
443
- object_states.each do | property, state |
442
+ ui_states.each do |ui_object, object_states|
443
+ object_states.each do |property, state|
444
444
  case property
445
- when :exists
446
- actual = ui_object.exists?
447
- when :enabled
448
- actual = ui_object.enabled?
449
- when :disabled
450
- actual = ui_object.disabled?
451
- when :visible
452
- actual = ui_object.visible?
453
- when :hidden
454
- actual = ui_object.hidden?
455
- when :width
456
- actual = ui_object.get_width
457
- when :height
458
- actual = ui_object.get_height
459
- when :readonly
460
- actual = ui_object.read_only?
461
- when :checked
462
- actual = ui_object.checked?
463
- when :selected
464
- actual = ui_object.selected?
465
- when :value, :caption
466
- actual = ui_object.get_value
467
- when :maxlength
468
- actual = ui_object.get_max_length
469
- when :rowcount
470
- actual = ui_object.get_row_count
471
- when :columncount
472
- actual = ui_object.get_column_count
473
- when :placeholder
474
- actual = ui_object.get_placeholder
475
- when :options, :items, :list_items
476
- actual = ui_object.get_list_items
477
- when :optioncount, :itemcount
478
- actual = ui_object.get_item_count
479
- when :column_headers
480
- actual = ui_object.get_header_columns
481
- when :siebel_options
482
- actual = ui_object.get_siebel_options
483
- else
484
- if property.to_s.start_with? ('cell_')
485
- cell = property.to_s.gsub('cell_', '')
486
- cell = cell.split('_')
487
- actual = ui_object.get_table_cell(cell[0].to_i, cell[1].to_i)
488
- elsif property.to_s.start_with? ('row_')
489
- row = property.to_s.gsub('row_', '')
490
- actual = ui_object.get_table_row(row.to_i)
491
- elsif property.to_s.start_with? ('column_')
492
- column = property.to_s.gsub('column_', '')
493
- actual = ui_object.get_table_column(column.to_i)
494
- end
445
+ when :exists
446
+ actual = ui_object.exists?
447
+ when :enabled
448
+ actual = ui_object.enabled?
449
+ when :disabled
450
+ actual = ui_object.disabled?
451
+ when :visible
452
+ actual = ui_object.visible?
453
+ when :hidden
454
+ actual = ui_object.hidden?
455
+ when :width
456
+ actual = ui_object.get_width
457
+ when :height
458
+ actual = ui_object.get_height
459
+ when :readonly
460
+ actual = ui_object.read_only?
461
+ when :checked
462
+ actual = ui_object.checked?
463
+ when :selected
464
+ actual = ui_object.selected?
465
+ when :value, :caption
466
+ actual = ui_object.get_value
467
+ when :maxlength
468
+ actual = ui_object.get_max_length
469
+ when :rowcount
470
+ actual = ui_object.get_row_count
471
+ when :columncount
472
+ actual = ui_object.get_column_count
473
+ when :placeholder
474
+ actual = ui_object.get_placeholder
475
+ when :options, :items, :list_items
476
+ actual = ui_object.get_list_items
477
+ when :optioncount, :itemcount
478
+ actual = ui_object.get_item_count
479
+ when :column_headers
480
+ actual = ui_object.get_header_columns
481
+ when :siebel_options
482
+ actual = ui_object.get_siebel_options
483
+ else
484
+ if property.to_s.start_with?('cell_')
485
+ cell = property.to_s.gsub('cell_', '')
486
+ cell = cell.split('_')
487
+ actual = ui_object.get_table_cell(cell[0].to_i, cell[1].to_i)
488
+ elsif property.to_s.start_with?('row_')
489
+ row = property.to_s.gsub('row_', '')
490
+ actual = ui_object.get_table_row(row.to_i)
491
+ elsif property.to_s.start_with?('column_')
492
+ column = property.to_s.gsub('column_', '')
493
+ actual = ui_object.get_table_column(column.to_i)
494
+ end
495
495
  end
496
496
 
497
497
  if state.is_a?(Hash) && state.length == 1
498
498
  error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property.to_s} property to"
499
499
  state.each do |key, value|
500
500
  case key
501
- when :lt, :less_than
502
- ExceptionQueue.enqueue_exception("#{error_msg} be less than #{value} but found #{actual}") unless actual < value
503
- when :lt_eq, :less_than_or_equal
504
- ExceptionQueue.enqueue_exception("#{error_msg} be less than or equal to #{value} but found #{actual}") unless actual <= value
505
- when :gt, :greater_than
506
- ExceptionQueue.enqueue_exception("#{error_msg} be greater than #{value} but found #{actual}") unless actual > value
507
- when :gt_eq, :greater_than_or_equal
508
- ExceptionQueue.enqueue_exception("#{error_msg} be greater than or equal to #{value} but found #{actual}") unless actual >= value
509
- when :starts_with
510
- ExceptionQueue.enqueue_exception("#{error_msg} start with '#{value}' but found #{actual}") unless actual.start_with?(value)
511
- when :ends_with
512
- ExceptionQueue.enqueue_exception("#{error_msg} end with '#{value}' but found #{actual}") unless actual.end_with?(value)
513
- when :contains
514
- ExceptionQueue.enqueue_exception("#{error_msg} contain '#{value}' but found #{actual}") unless actual.include?(value)
515
- when :like, :is_like
516
- actual_like = actual.gsub("\n", '')
517
- actual_like = actual_like.gsub("\r", '')
518
- actual_like = actual_like.gsub("\t", '')
519
- actual_like = actual_like.gsub(' ', '')
520
- actual_like = actual_like.downcase
521
- expected = value.gsub("\n", '')
522
- expected = expected.gsub("\r", '')
523
- expected = expected.gsub("\t", '')
524
- expected = expected.gsub(' ', '')
525
- expected = expected.downcase
526
- ExceptionQueue.enqueue_exception("#{error_msg} be like '#{value}' but found #{actual}") unless actual_like.include?(expected)
501
+ when :lt, :less_than
502
+ ExceptionQueue.enqueue_exception("#{error_msg} be less than #{value} but found #{actual}") unless actual < value
503
+ when :lt_eq, :less_than_or_equal
504
+ ExceptionQueue.enqueue_exception("#{error_msg} be less than or equal to #{value} but found #{actual}") unless actual <= value
505
+ when :gt, :greater_than
506
+ ExceptionQueue.enqueue_exception("#{error_msg} be greater than #{value} but found #{actual}") unless actual > value
507
+ when :gt_eq, :greater_than_or_equal
508
+ ExceptionQueue.enqueue_exception("#{error_msg} be greater than or equal to #{value} but found #{actual}") unless actual >= value
509
+ when :starts_with
510
+ ExceptionQueue.enqueue_exception("#{error_msg} start with '#{value}' but found #{actual}") unless actual.start_with?(value)
511
+ when :ends_with
512
+ ExceptionQueue.enqueue_exception("#{error_msg} end with '#{value}' but found #{actual}") unless actual.end_with?(value)
513
+ when :contains
514
+ ExceptionQueue.enqueue_exception("#{error_msg} contain '#{value}' but found #{actual}") unless actual.include?(value)
515
+ when :like, :is_like
516
+ actual_like = actual.delete("\n")
517
+ actual_like = actual_like.delete("\r")
518
+ actual_like = actual_like.delete("\t")
519
+ actual_like = actual_like.delete(' ')
520
+ actual_like = actual_like.downcase
521
+ expected = value.delete("\n")
522
+ expected = expected.delete("\r")
523
+ expected = expected.delete("\t")
524
+ expected = expected.delete(' ')
525
+ expected = expected.downcase
526
+ ExceptionQueue.enqueue_exception("#{error_msg} be like '#{value}' but found #{actual}") unless actual_like.include?(expected)
527
527
  end
528
528
  end
529
529
  else
@@ -552,7 +552,7 @@ module TestCentricity
552
552
  # populate_data_fields(data)
553
553
  #
554
554
  def populate_data_fields(data)
555
- data.each do | data_field, data_param |
555
+ data.each do |data_field, data_param|
556
556
  unless data_param.blank?
557
557
  # make sure the intended UI target element exists before trying to set its value
558
558
  data_field.wait_until_exists(2)
@@ -560,16 +560,16 @@ module TestCentricity
560
560
  data_field.set('')
561
561
  else
562
562
  case data_field.get_object_type
563
- when :checkbox
564
- data_field.set_checkbox_state(data_param.to_bool)
565
- when :selectlist
566
- (data_field.get_siebel_object_type == 'JComboBox') ?
567
- data_field.set("#{data_param}\t") :
568
- data_field.choose_option(data_param)
569
- when :radio
570
- data_field.set_selected_state(data_param.to_bool)
571
- when :textfield
572
- data_field.set("#{data_param}\t")
563
+ when :checkbox
564
+ data_field.set_checkbox_state(data_param.to_bool)
565
+ when :selectlist
566
+ (data_field.get_siebel_object_type == 'JComboBox') ?
567
+ data_field.set("#{data_param}\t") :
568
+ data_field.choose_option(data_param)
569
+ when :radio
570
+ data_field.set_selected_state(data_param.to_bool)
571
+ when :textfield
572
+ data_field.set("#{data_param}\t")
573
573
  end
574
574
  end
575
575
  end
@@ -577,13 +577,13 @@ module TestCentricity
577
577
  end
578
578
 
579
579
  def get_attribute(attrib)
580
- section, _ = find_section
580
+ section, = find_section
581
581
  raise "Section object '#{get_name}' (#{get_locator}) not found" unless section
582
582
  section[attrib]
583
583
  end
584
584
 
585
585
  def get_native_attribute(attrib)
586
- section, _ = find_section
586
+ section, = find_section
587
587
  raise "Section object '#{get_name}' (#{get_locator}) not found" unless section
588
588
  section.native.attribute(attrib)
589
589
  end
@@ -597,9 +597,9 @@ module TestCentricity
597
597
  type = attributes[tries]
598
598
  case type
599
599
  when :css
600
- locator = locator.gsub('|', ' ')
600
+ locator = locator.delete('|')
601
601
  when :xpath
602
- locator = locator.gsub('|', '')
602
+ locator = locator.delete('|')
603
603
  end
604
604
  obj = page.find(type, locator, :wait => 0.1)
605
605
  [obj, type]
@@ -7,7 +7,7 @@ module TestCentricity
7
7
  end
8
8
 
9
9
  def get_siebel_object_type
10
- obj, _ = find_element
10
+ obj, = find_element
11
11
  object_not_found_exception(obj, 'Siebel object')
12
12
  obj.native.attribute('ot')
13
13
  end
@@ -66,7 +66,7 @@ module TestCentricity
66
66
  # basket_link.click
67
67
  #
68
68
  def click
69
- obj, _ = find_element
69
+ obj, = find_element
70
70
  object_not_found_exception(obj, nil)
71
71
  begin
72
72
  obj.click
@@ -81,7 +81,7 @@ module TestCentricity
81
81
  # file_image.double_click
82
82
  #
83
83
  def double_click
84
- obj, _ = find_element
84
+ obj, = find_element
85
85
  object_not_found_exception(obj, nil)
86
86
  page.driver.browser.action.double_click(obj.native).perform
87
87
  end
@@ -92,7 +92,7 @@ module TestCentricity
92
92
  # basket_item_image.right_click
93
93
  #
94
94
  def right_click
95
- obj, _ = find_element
95
+ obj, = find_element
96
96
  object_not_found_exception(obj, nil)
97
97
  page.driver.browser.action.context_click(obj.native).perform
98
98
  end
@@ -105,13 +105,13 @@ module TestCentricity
105
105
  # basket_item_image.click_at(10, 10)
106
106
  #
107
107
  def click_at(x, y)
108
- obj, _ = find_element
108
+ obj, = find_element
109
109
  raise "UI #{object_ref_message} not found" unless obj
110
110
  obj.click_at(x, y)
111
111
  end
112
112
 
113
113
  def set(value)
114
- obj, _ = find_element
114
+ obj, = find_element
115
115
  object_not_found_exception(obj, nil)
116
116
  obj.set(value)
117
117
  end
@@ -123,7 +123,7 @@ module TestCentricity
123
123
  # comment_field.send_keys(:enter)
124
124
  #
125
125
  def send_keys(*keys)
126
- obj, _ = find_element
126
+ obj, = find_element
127
127
  object_not_found_exception(obj, nil)
128
128
  obj.send_keys(*keys)
129
129
  end
@@ -135,7 +135,7 @@ module TestCentricity
135
135
  # basket_link.exists?
136
136
  #
137
137
  def exists?(visible = true)
138
- obj, _ = find_object(visible)
138
+ obj, = find_object(visible)
139
139
  obj != nil
140
140
  end
141
141
 
@@ -174,7 +174,7 @@ module TestCentricity
174
174
  # remember_me_checkbox.hidden?
175
175
  #
176
176
  def hidden?
177
- not visible?
177
+ !visible?
178
178
  end
179
179
 
180
180
  # Is UI object enabled?
@@ -184,7 +184,7 @@ module TestCentricity
184
184
  # login_button.enabled?
185
185
  #
186
186
  def enabled?
187
- not disabled?
187
+ !disabled?
188
188
  end
189
189
 
190
190
  # Is UI object disabled (not enabled)?
@@ -194,7 +194,7 @@ module TestCentricity
194
194
  # login_button.disabled?
195
195
  #
196
196
  def disabled?
197
- obj, _ = find_element
197
+ obj, = find_element
198
198
  object_not_found_exception(obj, nil)
199
199
  obj.disabled?
200
200
  end
@@ -285,17 +285,17 @@ module TestCentricity
285
285
  end
286
286
 
287
287
  def get_value(visible = true)
288
- obj, _ = find_element(visible)
288
+ obj, = find_element(visible)
289
289
  object_not_found_exception(obj, nil)
290
290
  case obj.tag_name.downcase
291
- when 'input', 'select', 'textarea'
292
- obj.value
293
- else
294
- obj.text
291
+ when 'input', 'select', 'textarea'
292
+ obj.value
293
+ else
294
+ obj.text
295
295
  end
296
296
  end
297
297
 
298
- alias :get_caption :get_value
298
+ alias get_caption get_value
299
299
 
300
300
  def verify_value(expected, enqueue = false)
301
301
  actual = get_value
@@ -304,7 +304,7 @@ module TestCentricity
304
304
  assert_equal(expected.strip, actual.strip, "Expected UI #{object_ref_message} to display '#{expected}' but found '#{actual}'")
305
305
  end
306
306
 
307
- alias :verify_caption :verify_value
307
+ alias verify_caption verify_value
308
308
 
309
309
  # Hover the cursor over an object
310
310
  #
@@ -312,34 +312,34 @@ module TestCentricity
312
312
  # basket_link.hover
313
313
  #
314
314
  def hover
315
- obj, _ = find_element
315
+ obj, = find_element
316
316
  object_not_found_exception(obj, nil)
317
317
  obj.hover
318
318
  end
319
319
 
320
320
  def drag_by(right_offset, down_offset)
321
- obj, _ = find_element
321
+ obj, = find_element
322
322
  object_not_found_exception(obj, nil)
323
323
  obj.drag_by(right_offset, down_offset)
324
324
  end
325
325
 
326
326
  def drag_and_drop(target, right_offset = nil, down_offset = nil)
327
- source, _ = find_element
327
+ source, = find_element
328
328
  object_not_found_exception(source, nil)
329
329
  page.driver.browser.action.click_and_hold(source.native).perform
330
330
  sleep(0.5)
331
- target_drop, _ = target.find_element
331
+ target_drop, = target.find_element
332
332
  page.driver.browser.action.move_to(target_drop.native, right_offset.to_i, down_offset.to_i).release.perform
333
333
  end
334
334
 
335
335
  def get_attribute(attrib)
336
- obj, _ = find_element
336
+ obj, = find_element
337
337
  object_not_found_exception(obj, nil)
338
338
  obj[attrib]
339
339
  end
340
340
 
341
341
  def get_native_attribute(attrib)
342
- obj, _ = find_element
342
+ obj, = find_element
343
343
  object_not_found_exception(obj, nil)
344
344
  obj.native.attribute(attrib)
345
345
  end
@@ -366,26 +366,26 @@ module TestCentricity
366
366
  if parent_section
367
367
  parent_locator = @parent.get_locator
368
368
  case type
369
- when :css
370
- parent_locator = parent_locator.gsub('|', ' ')
371
- obj = page.find(:css, parent_locator, :wait => 0.01).find(:css, obj_locator, :wait => 0.01, :visible => visible)
372
- when :xpath
373
- parent_locator = parent_locator.gsub('|', '')
374
- obj = page.find(:xpath, "#{parent_locator}#{obj_locator}", :wait => 0.01, :visible => visible)
375
- when :css_xpath
376
- type = :xpath
377
- parent_locator = parent_locator.gsub('|', ' ')
378
- obj = page.find(:css, parent_locator, :wait => 0.01).find(:xpath, obj_locator, :wait => 0.01, :visible => visible)
379
- when :xpath_css
380
- type = :css
381
- parent_locator = parent_locator.gsub('|', ' ')
382
- obj = page.find(:xpath, parent_locator, :wait => 0.01).find(:css, obj_locator, :wait => 0.01, :visible => visible)
383
- when :ignore_parent_css
384
- type = :css
385
- obj = page.find(:css, obj_locator, :wait => 0.01, :visible => visible)
386
- when :ignore_parent_xpath
387
- type = :xpath
388
- obj = page.find(:xpath, obj_locator, :wait => 0.01, :visible => visible)
369
+ when :css
370
+ parent_locator = parent_locator.gsub('|', ' ')
371
+ obj = page.find(:css, parent_locator, :wait => 0.01).find(:css, obj_locator, :wait => 0.01, :visible => visible)
372
+ when :xpath
373
+ parent_locator = parent_locator.delete('|')
374
+ obj = page.find(:xpath, "#{parent_locator}#{obj_locator}", :wait => 0.01, :visible => visible)
375
+ when :css_xpath
376
+ type = :xpath
377
+ parent_locator = parent_locator.gsub('|', ' ')
378
+ obj = page.find(:css, parent_locator, :wait => 0.01).find(:xpath, obj_locator, :wait => 0.01, :visible => visible)
379
+ when :xpath_css
380
+ type = :css
381
+ parent_locator = parent_locator.gsub('|', ' ')
382
+ obj = page.find(:xpath, parent_locator, :wait => 0.01).find(:css, obj_locator, :wait => 0.01, :visible => visible)
383
+ when :ignore_parent_css
384
+ type = :css
385
+ obj = page.find(:css, obj_locator, :wait => 0.01, :visible => visible)
386
+ when :ignore_parent_xpath
387
+ type = :xpath
388
+ obj = page.find(:xpath, obj_locator, :wait => 0.01, :visible => visible)
389
389
  end
390
390
  else
391
391
  obj = page.find(type, obj_locator, :wait => 0.01, :visible => visible)
@@ -398,7 +398,7 @@ module TestCentricity
398
398
 
399
399
  def object_not_found_exception(obj, obj_type)
400
400
  @alt_locator.nil? ? locator = @locator : locator = @alt_locator
401
- obj_type.nil? ? object_type = "Object" : object_type = obj_type
401
+ obj_type.nil? ? object_type = 'Object' : object_type = obj_type
402
402
  raise "#{object_type} named '#{@name}' (#{locator}) not found" unless obj
403
403
  end
404
404
 
@@ -410,7 +410,7 @@ module TestCentricity
410
410
  end
411
411
 
412
412
  def invoke_siebel_popup
413
- obj, _ = find_element
413
+ obj, = find_element
414
414
  object_not_found_exception(obj, 'Siebel object')
415
415
  trigger_name = obj.native.attribute('aria-describedby').strip
416
416
  trigger = "span##{trigger_name}"