testcentricity_web 2.3.17 → 2.3.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df906d46604b41bddf152f1b278b37dbd52bf288
4
- data.tar.gz: 88f6d0090a3779394e948fc1a6c598e639e70a9a
3
+ metadata.gz: 46cfb329a606408f5145832f268199fa1b3590a1
4
+ data.tar.gz: 7bae7e8f22feb92f28b914b9d9768607b26e6563
5
5
  SHA512:
6
- metadata.gz: 604568dc130aa338f194b430bf0ca5e39474175171b701ae54f2fd16cd7fc272d9801a1f94cf043f02a1da510a4e23b7c99ce86f07adeead452dc862db16fc51
7
- data.tar.gz: 701cac1a5faefcb72aeff3e5e3c3bee639be52e4a0800224acedcb4cce67f5fea7859dbb00aa2d2eaf1be04a56296f0c08fac8ce1bf5130f96425c76389a4aef
6
+ metadata.gz: 1797cf2da9ce93dbb13a69031d3346efb726806d975f81553d45049f9f0fb3d20ea042d1db153435290870a5ffedae1debc98f7e113bf7453729ff8af219e193
7
+ data.tar.gz: 1376133aa0c001a8f9a10629f251a4fced2d5322e22885cc2f315ebb830f578b8d2a5b3886f09264b5a6127ca05a034517e62055dffd1c8cf4148da7db90b11f
data/README.md CHANGED
@@ -28,6 +28,13 @@ hosted instances of Chrome, Firefox, Safari, and IE web browsers.
28
28
 
29
29
 
30
30
  ## What's New
31
+ ###Version 2.3.18
32
+
33
+ * Updated `SelectList.define_list_elements` method to accept value for `:list_trigger` element.
34
+ * Updated `SelectList.choose_option` to respect `:list_item` value and to click on `:list_trigger` element, if one is specified.
35
+ * Updated `PageSection` and `PageObject` UI element object declaration methods to no longer use `class_eval` pattern.
36
+ * Updated device profiles for iPhone 7 (iOS 10) with Chrome browser and iPad (iOS 10) with Chrome browser.
37
+
31
38
  ###Version 2.3.17
32
39
 
33
40
  * Added `List.wait_until_item_count_is` and `List.wait_until_item_count_changes` methods.
@@ -145,6 +152,9 @@ use the [parallel_tests gem](https://rubygems.org/gems/parallel_tests) to decrea
145
152
 
146
153
 
147
154
  ## What's Fixed
155
+ ###Version 2.3.18
156
+
157
+ * Fixed `SelectList.choose_option` to also accept `:text`, `:value`, and `:index` option hashes across all types of select list objects.
148
158
 
149
159
  ###Version 2.3.15
150
160
 
@@ -61,7 +61,7 @@
61
61
  :css_width: 375
62
62
  :css_height: 667
63
63
  :default_orientation: portrait
64
- :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) CriOS/64.0.3282.112 Mobile/14G60 Safari/602.1"
64
+ :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) CriOS/65.0.3325.152 Mobile/14G60 Safari/602.1"
65
65
  :iphone7_firefox:
66
66
  :name: "iPhone 7 - Firefox"
67
67
  :os: ios
@@ -237,7 +237,7 @@ nexus6:
237
237
  :css_width: 1024
238
238
  :css_height: 768
239
239
  :default_orientation: landscape
240
- :user_agent: "Mozilla/5.0 (iPad; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) CriOS/64.0.3282.112 Mobile/14G60 Safari/602.1"
240
+ :user_agent: "Mozilla/5.0 (iPad; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) CriOS/65.0.3325.152 Mobile/14G60 Safari/602.1"
241
241
  :ipad_firefox:
242
242
  :name: "iPad - Firefox"
243
243
  :os: ios
@@ -28,7 +28,12 @@ module TestCentricity
28
28
  # element :siebel_busy, "//html[contains(@class, 'siebui-busy')]"
29
29
  #
30
30
  def self.element(element_name, locator)
31
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::UIElement.new("#{element_name}", self, "#{locator}", :page);end))
31
+ define_method(element_name) do
32
+ ivar_name = "@#{element_name}"
33
+ ivar = instance_variable_get(ivar_name)
34
+ return ivar if ivar
35
+ instance_variable_set(ivar_name, TestCentricity::UIElement.new(element_name, self, locator, :page))
36
+ end
32
37
  end
33
38
 
34
39
  # Declare and instantiate a collection of generic UI Elements for this page object.
@@ -54,7 +59,12 @@ module TestCentricity
54
59
  # button :login_button, "//input[@id='submit_button']"
55
60
  #
56
61
  def self.button(element_name, locator)
57
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Button.new("#{element_name}", self, "#{locator}", :page);end))
62
+ define_method(element_name) do
63
+ ivar_name = "@#{element_name}"
64
+ ivar = instance_variable_get(ivar_name)
65
+ return ivar if ivar
66
+ instance_variable_set(ivar_name, TestCentricity::Button.new(element_name, self, locator, :page))
67
+ end
58
68
  end
59
69
 
60
70
  # Declare and instantiate a collection of buttons for this page object.
@@ -80,7 +90,12 @@ module TestCentricity
80
90
  # textfield :password_field, 'consumer_password'
81
91
  #
82
92
  def self.textfield(element_name, locator)
83
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::TextField.new("#{element_name}", self, "#{locator}", :page);end))
93
+ define_method(element_name) do
94
+ ivar_name = "@#{element_name}"
95
+ ivar = instance_variable_get(ivar_name)
96
+ return ivar if ivar
97
+ instance_variable_set(ivar_name, TestCentricity::TextField.new(element_name, self, locator, :page))
98
+ end
84
99
  end
85
100
 
86
101
  # Declare and instantiate a collection of text fields for this page object.
@@ -164,7 +179,12 @@ module TestCentricity
164
179
  # label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
165
180
  #
166
181
  def self.label(element_name, locator)
167
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Label.new("#{element_name}", self, "#{locator}", :page);end))
182
+ define_method(element_name) do
183
+ ivar_name = "@#{element_name}"
184
+ ivar = instance_variable_get(ivar_name)
185
+ return ivar if ivar
186
+ instance_variable_set(ivar_name, TestCentricity::Label.new(element_name, self, locator, :page))
187
+ end
168
188
  end
169
189
 
170
190
  def self.labels(element_hash)
@@ -182,7 +202,12 @@ module TestCentricity
182
202
  # link :shopping_basket_link, "//a[@href='shopping_basket']"
183
203
  #
184
204
  def self.link(element_name, locator)
185
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Link.new("#{element_name}", self, "#{locator}", :page);end))
205
+ define_method(element_name) do
206
+ ivar_name = "@#{element_name}"
207
+ ivar = instance_variable_get(ivar_name)
208
+ return ivar if ivar
209
+ instance_variable_set(ivar_name, TestCentricity::Link.new(element_name, self, locator, :page))
210
+ end
186
211
  end
187
212
 
188
213
  def self.links(element_hash)
@@ -199,7 +224,12 @@ module TestCentricity
199
224
  # table :payments_table, "//table[@class='payments_table']"
200
225
  #
201
226
  def self.table(element_name, locator)
202
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Table.new("#{element_name}", self, "#{locator}", :page);end))
227
+ define_method(element_name) do
228
+ ivar_name = "@#{element_name}"
229
+ ivar = instance_variable_get(ivar_name)
230
+ return ivar if ivar
231
+ instance_variable_set(ivar_name, TestCentricity::Table.new(element_name, self, locator, :page))
232
+ end
203
233
  end
204
234
 
205
235
  def self.tables(element_hash)
@@ -217,7 +247,12 @@ module TestCentricity
217
247
  # selectlist :gender_select, "//select[@id='customer_gender']"
218
248
  #
219
249
  def self.selectlist(element_name, locator)
220
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::SelectList.new("#{element_name}", self, "#{locator}", :page);end))
250
+ define_method(element_name) do
251
+ ivar_name = "@#{element_name}"
252
+ ivar = instance_variable_get(ivar_name)
253
+ return ivar if ivar
254
+ instance_variable_set(ivar_name, TestCentricity::SelectList.new(element_name, self, locator, :page))
255
+ end
221
256
  end
222
257
 
223
258
  def self.selectlists(element_hash)
@@ -234,7 +269,12 @@ module TestCentricity
234
269
  # list :x_axis_list, 'g.x-axis'
235
270
  #
236
271
  def self.list(element_name, locator)
237
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::List.new("#{element_name}", self, "#{locator}", :page);end))
272
+ define_method(element_name) do
273
+ ivar_name = "@#{element_name}"
274
+ ivar = instance_variable_get(ivar_name)
275
+ return ivar if ivar
276
+ instance_variable_set(ivar_name, TestCentricity::List.new(element_name, self, locator, :page))
277
+ end
238
278
  end
239
279
 
240
280
  def self.lists(element_hash)
@@ -252,7 +292,12 @@ module TestCentricity
252
292
  # image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
253
293
  #
254
294
  def self.image(element_name, locator)
255
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Image.new("#{element_name}", self, "#{locator}", :page);end))
295
+ define_method(element_name) do
296
+ ivar_name = "@#{element_name}"
297
+ ivar = instance_variable_get(ivar_name)
298
+ return ivar if ivar
299
+ instance_variable_set(ivar_name, TestCentricity::Image.new(element_name, self, locator, :page))
300
+ end
256
301
  end
257
302
 
258
303
  def self.images(element_hash)
@@ -269,7 +314,12 @@ module TestCentricity
269
314
  # filefield :attach_file, 's_SweFileName'
270
315
  #
271
316
  def self.filefield(element_name, locator)
272
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :page);end))
317
+ define_method(element_name) do
318
+ ivar_name = "@#{element_name}"
319
+ ivar = instance_variable_get(ivar_name)
320
+ return ivar if ivar
321
+ instance_variable_set(ivar_name, TestCentricity::FileField.new(element_name, self, locator, :page))
322
+ end
273
323
  end
274
324
 
275
325
  def self.filefields(element_hash)
@@ -502,98 +552,98 @@ module TestCentricity
502
552
  ui_states.each do |ui_object, object_states|
503
553
  object_states.each do |property, state|
504
554
  case property
505
- when :class
506
- actual = ui_object.get_attribute(:class)
507
- when :exists
508
- actual = ui_object.exists?
509
- when :enabled
510
- actual = ui_object.enabled?
511
- when :disabled
512
- actual = ui_object.disabled?
513
- when :visible
514
- actual = ui_object.visible?
515
- when :hidden
516
- actual = ui_object.hidden?
517
- when :displayed
518
- actual = ui_object.displayed?
519
- when :width
520
- actual = ui_object.width
521
- when :height
522
- actual = ui_object.height
523
- when :x
524
- actual = ui_object.x
525
- when :y
526
- actual = ui_object.y
527
- when :readonly
528
- actual = ui_object.read_only?
529
- when :checked
530
- actual = ui_object.checked?
531
- when :selected
532
- actual = ui_object.selected?
533
- when :value, :caption
534
- actual = ui_object.get_value
535
- when :maxlength
536
- actual = ui_object.get_max_length
537
- when :rowcount
538
- actual = ui_object.get_row_count
539
- when :columncount
540
- actual = ui_object.get_column_count
541
- when :placeholder
542
- actual = ui_object.get_placeholder
543
- when :min
544
- actual = ui_object.get_min
545
- when :max
546
- actual = ui_object.get_max
547
- when :step
548
- actual = ui_object.get_step
549
- when :options, :items, :list_items
550
- actual = ui_object.get_list_items
551
- when :optioncount, :itemcount
552
- actual = ui_object.get_item_count
553
- when :all_items, :all_list_items
554
- actual = ui_object.get_all_list_items
555
- when :all_items_count
556
- actual = ui_object.get_all_items_count
557
- when :column_headers
558
- actual = ui_object.get_header_columns
559
- when :siebel_options
560
- actual = ui_object.get_siebel_options
561
- else
562
- if property.is_a?(Hash)
563
- property.each do |key, value|
564
- case key
565
- when :cell
566
- actual = ui_object.get_table_cell(value[0].to_i, value[1].to_i)
567
- when :row
568
- actual = ui_object.get_table_row(value.to_i)
569
- when :column
570
- actual = ui_object.get_table_column(value.to_i)
571
- when :item
572
- actual = ui_object.get_list_item(value.to_i)
573
- when :attribute
574
- actual = ui_object.get_attribute(value)
575
- when :native_attribute
576
- actual = ui_object.get_native_attribute(value)
577
- end
578
- end
555
+ when :class
556
+ actual = ui_object.get_attribute(:class)
557
+ when :exists
558
+ actual = ui_object.exists?
559
+ when :enabled
560
+ actual = ui_object.enabled?
561
+ when :disabled
562
+ actual = ui_object.disabled?
563
+ when :visible
564
+ actual = ui_object.visible?
565
+ when :hidden
566
+ actual = ui_object.hidden?
567
+ when :displayed
568
+ actual = ui_object.displayed?
569
+ when :width
570
+ actual = ui_object.width
571
+ when :height
572
+ actual = ui_object.height
573
+ when :x
574
+ actual = ui_object.x
575
+ when :y
576
+ actual = ui_object.y
577
+ when :readonly
578
+ actual = ui_object.read_only?
579
+ when :checked
580
+ actual = ui_object.checked?
581
+ when :selected
582
+ actual = ui_object.selected?
583
+ when :value, :caption
584
+ actual = ui_object.get_value
585
+ when :maxlength
586
+ actual = ui_object.get_max_length
587
+ when :rowcount
588
+ actual = ui_object.get_row_count
589
+ when :columncount
590
+ actual = ui_object.get_column_count
591
+ when :placeholder
592
+ actual = ui_object.get_placeholder
593
+ when :min
594
+ actual = ui_object.get_min
595
+ when :max
596
+ actual = ui_object.get_max
597
+ when :step
598
+ actual = ui_object.get_step
599
+ when :options, :items, :list_items
600
+ actual = ui_object.get_list_items
601
+ when :optioncount, :itemcount
602
+ actual = ui_object.get_item_count
603
+ when :all_items, :all_list_items
604
+ actual = ui_object.get_all_list_items
605
+ when :all_items_count
606
+ actual = ui_object.get_all_items_count
607
+ when :column_headers
608
+ actual = ui_object.get_header_columns
609
+ when :siebel_options
610
+ actual = ui_object.get_siebel_options
579
611
  else
580
- props = property.to_s.split('_')
581
- case props[0].to_sym
582
- when :cell
583
- cell = property.to_s.delete('cell_')
584
- cell = cell.split('_')
585
- actual = ui_object.get_table_cell(cell[0].to_i, cell[1].to_i)
586
- when :row
587
- row = property.to_s.delete('row_')
588
- actual = ui_object.get_table_row(row.to_i)
589
- when :column
590
- column = property.to_s.delete('column_')
591
- actual = ui_object.get_table_column(column.to_i)
592
- when :item
593
- item = property.to_s.delete('item_')
594
- actual = ui_object.get_list_item(item.to_i)
612
+ if property.is_a?(Hash)
613
+ property.each do |key, value|
614
+ case key
615
+ when :cell
616
+ actual = ui_object.get_table_cell(value[0].to_i, value[1].to_i)
617
+ when :row
618
+ actual = ui_object.get_table_row(value.to_i)
619
+ when :column
620
+ actual = ui_object.get_table_column(value.to_i)
621
+ when :item
622
+ actual = ui_object.get_list_item(value.to_i)
623
+ when :attribute
624
+ actual = ui_object.get_attribute(value)
625
+ when :native_attribute
626
+ actual = ui_object.get_native_attribute(value)
627
+ end
628
+ end
629
+ else
630
+ props = property.to_s.split('_')
631
+ case props[0].to_sym
632
+ when :cell
633
+ cell = property.to_s.delete('cell_')
634
+ cell = cell.split('_')
635
+ actual = ui_object.get_table_cell(cell[0].to_i, cell[1].to_i)
636
+ when :row
637
+ row = property.to_s.delete('row_')
638
+ actual = ui_object.get_table_row(row.to_i)
639
+ when :column
640
+ column = property.to_s.delete('column_')
641
+ actual = ui_object.get_table_column(column.to_i)
642
+ when :item
643
+ item = property.to_s.delete('item_')
644
+ actual = ui_object.get_list_item(item.to_i)
645
+ end
595
646
  end
596
- end
597
647
  end
598
648
  error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
599
649
  ExceptionQueue.enqueue_comparison(state, actual, error_msg)
@@ -640,18 +690,18 @@ module TestCentricity
640
690
  data_field.clear
641
691
  else
642
692
  case data_field.get_object_type
643
- when :checkbox
644
- data_field.set_checkbox_state(data_param.to_bool)
645
- when :selectlist
646
- data_field.get_siebel_object_type == 'JComboBox' ?
647
- data_field.set("#{data_param}\t") :
648
- data_field.choose_option(data_param)
649
- when :radio
650
- data_field.set_selected_state(data_param.to_bool)
651
- when :textfield
652
- data_field.set("#{data_param}\t")
653
- when :section
654
- data_field.set(data_param)
693
+ when :checkbox
694
+ data_field.set_checkbox_state(data_param.to_bool)
695
+ when :selectlist
696
+ data_field.get_siebel_object_type == 'JComboBox' ?
697
+ data_field.set("#{data_param}\t") :
698
+ data_field.choose_option(data_param)
699
+ when :radio
700
+ data_field.set_selected_state(data_param.to_bool)
701
+ when :textfield
702
+ data_field.set("#{data_param}\t")
703
+ when :section
704
+ data_field.set(data_param)
655
705
  end
656
706
  end
657
707
  end
@@ -48,10 +48,10 @@ module TestCentricity
48
48
  locator = "#{@parent_list.get_locator}|#{locator}"
49
49
  unless @list_index.nil?
50
50
  case @locator_type
51
- when :xpath
52
- locator = "(#{locator})[#{@list_index}]"
53
- when :css
54
- locator = "#{locator}:nth-of-type(#{@list_index})"
51
+ when :xpath
52
+ locator = "(#{locator})[#{@list_index}]"
53
+ when :css
54
+ locator = "#{locator}:nth-of-type(#{@list_index})"
55
55
  end
56
56
  end
57
57
  end
@@ -140,7 +140,12 @@ module TestCentricity
140
140
  # element :basket_header, 'div.basket_header'
141
141
  #
142
142
  def self.element(element_name, locator)
143
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::UIElement.new("#{element_name}", self, "#{locator}", :section);end))
143
+ define_method(element_name) do
144
+ ivar_name = "@#{element_name}"
145
+ ivar = instance_variable_get(ivar_name)
146
+ return ivar if ivar
147
+ instance_variable_set(ivar_name, TestCentricity::UIElement.new(element_name, self, locator, :section))
148
+ end
144
149
  end
145
150
 
146
151
  # Declare and instantiate a collection of generic UI Elements for this page section.
@@ -166,7 +171,12 @@ module TestCentricity
166
171
  # button :login_button, "//input[@id='submit_button']"
167
172
  #
168
173
  def self.button(element_name, locator)
169
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Button.new("#{element_name}", self, "#{locator}", :section);end))
174
+ define_method(element_name) do
175
+ ivar_name = "@#{element_name}"
176
+ ivar = instance_variable_get(ivar_name)
177
+ return ivar if ivar
178
+ instance_variable_set(ivar_name, TestCentricity::Button.new(element_name, self, locator, :section))
179
+ end
170
180
  end
171
181
 
172
182
  # Declare and instantiate a collection of buttons for this page section.
@@ -192,7 +202,12 @@ module TestCentricity
192
202
  # textfield :password_field, 'input#consumer_password'
193
203
  #
194
204
  def self.textfield(element_name, locator)
195
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::TextField.new("#{element_name}", self, "#{locator}", :section);end))
205
+ define_method(element_name) do
206
+ ivar_name = "@#{element_name}"
207
+ ivar = instance_variable_get(ivar_name)
208
+ return ivar if ivar
209
+ instance_variable_set(ivar_name, TestCentricity::TextField.new(element_name, self, locator, :section))
210
+ end
196
211
  end
197
212
 
198
213
  # Declare and instantiate a collection of text fields for this page section.
@@ -276,7 +291,12 @@ module TestCentricity
276
291
  # label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
277
292
  #
278
293
  def self.label(element_name, locator)
279
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Label.new("#{element_name}", self, "#{locator}", :section);end))
294
+ define_method(element_name) do
295
+ ivar_name = "@#{element_name}"
296
+ ivar = instance_variable_get(ivar_name)
297
+ return ivar if ivar
298
+ instance_variable_set(ivar_name, TestCentricity::Label.new(element_name, self, locator, :section))
299
+ end
280
300
  end
281
301
 
282
302
  def self.labels(element_hash)
@@ -294,7 +314,12 @@ module TestCentricity
294
314
  # link :shopping_basket_link, "//a[@href='shopping_basket']"
295
315
  #
296
316
  def self.link(element_name, locator)
297
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Link.new("#{element_name}", self, "#{locator}", :section);end))
317
+ define_method(element_name) do
318
+ ivar_name = "@#{element_name}"
319
+ ivar = instance_variable_get(ivar_name)
320
+ return ivar if ivar
321
+ instance_variable_set(ivar_name, TestCentricity::Link.new(element_name, self, locator, :section))
322
+ end
298
323
  end
299
324
 
300
325
  def self.links(element_hash)
@@ -311,7 +336,12 @@ module TestCentricity
311
336
  # table :payments_table, "//table[@class='payments_table']"
312
337
  #
313
338
  def self.table(element_name, locator)
314
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Table.new("#{element_name}", self, "#{locator}", :section);end))
339
+ define_method(element_name) do
340
+ ivar_name = "@#{element_name}"
341
+ ivar = instance_variable_get(ivar_name)
342
+ return ivar if ivar
343
+ instance_variable_set(ivar_name, TestCentricity::Table.new(element_name, self, locator, :section))
344
+ end
315
345
  end
316
346
 
317
347
  def self.tables(element_hash)
@@ -329,7 +359,12 @@ module TestCentricity
329
359
  # selectlist :gender_select, "//select[@id='customer_gender']"
330
360
  #
331
361
  def self.selectlist(element_name, locator)
332
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::SelectList.new("#{element_name}", self, "#{locator}", :section);end))
362
+ define_method(element_name) do
363
+ ivar_name = "@#{element_name}"
364
+ ivar = instance_variable_get(ivar_name)
365
+ return ivar if ivar
366
+ instance_variable_set(ivar_name, TestCentricity::SelectList.new(element_name, self, locator, :section))
367
+ end
333
368
  end
334
369
 
335
370
  def self.selectlists(element_hash)
@@ -346,7 +381,12 @@ module TestCentricity
346
381
  # list :y_axis_list, 'g.y_axis'
347
382
  #
348
383
  def self.list(element_name, locator)
349
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::List.new("#{element_name}", self, "#{locator}", :section);end))
384
+ define_method(element_name) do
385
+ ivar_name = "@#{element_name}"
386
+ ivar = instance_variable_get(ivar_name)
387
+ return ivar if ivar
388
+ instance_variable_set(ivar_name, TestCentricity::List.new(element_name, self, locator, :section))
389
+ end
350
390
  end
351
391
 
352
392
  def self.lists(element_hash)
@@ -364,7 +404,12 @@ module TestCentricity
364
404
  # image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
365
405
  #
366
406
  def self.image(element_name, locator)
367
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Image.new("#{element_name}", self, "#{locator}", :section);end))
407
+ define_method(element_name) do
408
+ ivar_name = "@#{element_name}"
409
+ ivar = instance_variable_get(ivar_name)
410
+ return ivar if ivar
411
+ instance_variable_set(ivar_name, TestCentricity::Image.new(element_name, self, locator, :section))
412
+ end
368
413
  end
369
414
 
370
415
  def self.images(element_hash)
@@ -381,7 +426,12 @@ module TestCentricity
381
426
  # filefield :attach_file, 's_SweFileName'
382
427
  #
383
428
  def self.filefield(element_name, locator)
384
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :section);end))
429
+ define_method(element_name) do
430
+ ivar_name = "@#{element_name}"
431
+ ivar = instance_variable_get(ivar_name)
432
+ return ivar if ivar
433
+ instance_variable_set(ivar_name, TestCentricity::FileField.new(element_name, self, locator, :section))
434
+ end
385
435
  end
386
436
 
387
437
  def self.filefields(element_hash)
@@ -694,98 +744,98 @@ module TestCentricity
694
744
  ui_states.each do |ui_object, object_states|
695
745
  object_states.each do |property, state|
696
746
  case property
697
- when :class
698
- actual = ui_object.get_attribute(:class)
699
- when :exists
700
- actual = ui_object.exists?
701
- when :enabled
702
- actual = ui_object.enabled?
703
- when :disabled
704
- actual = ui_object.disabled?
705
- when :visible
706
- actual = ui_object.visible?
707
- when :hidden
708
- actual = ui_object.hidden?
709
- when :displayed
710
- actual = ui_object.displayed?
711
- when :width
712
- actual = ui_object.width
713
- when :height
714
- actual = ui_object.height
715
- when :x
716
- actual = ui_object.x
717
- when :y
718
- actual = ui_object.y
719
- when :readonly
720
- actual = ui_object.read_only?
721
- when :checked
722
- actual = ui_object.checked?
723
- when :selected
724
- actual = ui_object.selected?
725
- when :value, :caption
726
- actual = ui_object.get_value
727
- when :maxlength
728
- actual = ui_object.get_max_length
729
- when :rowcount
730
- actual = ui_object.get_row_count
731
- when :columncount
732
- actual = ui_object.get_column_count
733
- when :placeholder
734
- actual = ui_object.get_placeholder
735
- when :min
736
- actual = ui_object.get_min
737
- when :max
738
- actual = ui_object.get_max
739
- when :step
740
- actual = ui_object.get_step
741
- when :options, :items, :list_items
742
- actual = ui_object.get_list_items
743
- when :optioncount, :itemcount
744
- actual = ui_object.get_item_count
745
- when :all_items, :all_list_items
746
- actual = ui_object.get_all_list_items
747
- when :all_items_count
748
- actual = ui_object.get_all_items_count
749
- when :column_headers
750
- actual = ui_object.get_header_columns
751
- when :siebel_options
752
- actual = ui_object.get_siebel_options
753
- else
754
- if property.is_a?(Hash)
755
- property.each do |key, value|
756
- case key
757
- when :cell
758
- actual = ui_object.get_table_cell(value[0].to_i, value[1].to_i)
759
- when :row
760
- actual = ui_object.get_table_row(value.to_i)
761
- when :column
762
- actual = ui_object.get_table_column(value.to_i)
763
- when :item
764
- actual = ui_object.get_list_item(value.to_i)
765
- when :attribute
766
- actual = ui_object.get_attribute(value)
767
- when :native_attribute
768
- actual = ui_object.get_native_attribute(value)
769
- end
770
- end
747
+ when :class
748
+ actual = ui_object.get_attribute(:class)
749
+ when :exists
750
+ actual = ui_object.exists?
751
+ when :enabled
752
+ actual = ui_object.enabled?
753
+ when :disabled
754
+ actual = ui_object.disabled?
755
+ when :visible
756
+ actual = ui_object.visible?
757
+ when :hidden
758
+ actual = ui_object.hidden?
759
+ when :displayed
760
+ actual = ui_object.displayed?
761
+ when :width
762
+ actual = ui_object.width
763
+ when :height
764
+ actual = ui_object.height
765
+ when :x
766
+ actual = ui_object.x
767
+ when :y
768
+ actual = ui_object.y
769
+ when :readonly
770
+ actual = ui_object.read_only?
771
+ when :checked
772
+ actual = ui_object.checked?
773
+ when :selected
774
+ actual = ui_object.selected?
775
+ when :value, :caption
776
+ actual = ui_object.get_value
777
+ when :maxlength
778
+ actual = ui_object.get_max_length
779
+ when :rowcount
780
+ actual = ui_object.get_row_count
781
+ when :columncount
782
+ actual = ui_object.get_column_count
783
+ when :placeholder
784
+ actual = ui_object.get_placeholder
785
+ when :min
786
+ actual = ui_object.get_min
787
+ when :max
788
+ actual = ui_object.get_max
789
+ when :step
790
+ actual = ui_object.get_step
791
+ when :options, :items, :list_items
792
+ actual = ui_object.get_list_items
793
+ when :optioncount, :itemcount
794
+ actual = ui_object.get_item_count
795
+ when :all_items, :all_list_items
796
+ actual = ui_object.get_all_list_items
797
+ when :all_items_count
798
+ actual = ui_object.get_all_items_count
799
+ when :column_headers
800
+ actual = ui_object.get_header_columns
801
+ when :siebel_options
802
+ actual = ui_object.get_siebel_options
771
803
  else
772
- props = property.to_s.split('_')
773
- case props[0].to_sym
774
- when :cell
775
- cell = property.to_s.delete('cell_')
776
- cell = cell.split('_')
777
- actual = ui_object.get_table_cell(cell[0].to_i, cell[1].to_i)
778
- when :row
779
- row = property.to_s.delete('row_')
780
- actual = ui_object.get_table_row(row.to_i)
781
- when :column
782
- column = property.to_s.delete('column_')
783
- actual = ui_object.get_table_column(column.to_i)
784
- when :item
785
- item = property.to_s.delete('item_')
786
- actual = ui_object.get_list_item(item.to_i)
804
+ if property.is_a?(Hash)
805
+ property.each do |key, value|
806
+ case key
807
+ when :cell
808
+ actual = ui_object.get_table_cell(value[0].to_i, value[1].to_i)
809
+ when :row
810
+ actual = ui_object.get_table_row(value.to_i)
811
+ when :column
812
+ actual = ui_object.get_table_column(value.to_i)
813
+ when :item
814
+ actual = ui_object.get_list_item(value.to_i)
815
+ when :attribute
816
+ actual = ui_object.get_attribute(value)
817
+ when :native_attribute
818
+ actual = ui_object.get_native_attribute(value)
819
+ end
820
+ end
821
+ else
822
+ props = property.to_s.split('_')
823
+ case props[0].to_sym
824
+ when :cell
825
+ cell = property.to_s.delete('cell_')
826
+ cell = cell.split('_')
827
+ actual = ui_object.get_table_cell(cell[0].to_i, cell[1].to_i)
828
+ when :row
829
+ row = property.to_s.delete('row_')
830
+ actual = ui_object.get_table_row(row.to_i)
831
+ when :column
832
+ column = property.to_s.delete('column_')
833
+ actual = ui_object.get_table_column(column.to_i)
834
+ when :item
835
+ item = property.to_s.delete('item_')
836
+ actual = ui_object.get_list_item(item.to_i)
837
+ end
787
838
  end
788
- end
789
839
  end
790
840
  error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
791
841
  ExceptionQueue.enqueue_comparison(state, actual, error_msg)
@@ -833,18 +883,18 @@ module TestCentricity
833
883
  data_field.clear
834
884
  else
835
885
  case data_field.get_object_type
836
- when :checkbox
837
- data_field.set_checkbox_state(data_param.to_bool)
838
- when :selectlist
839
- data_field.get_siebel_object_type == 'JComboBox' ?
840
- data_field.set("#{data_param}\t") :
841
- data_field.choose_option(data_param)
842
- when :radio
843
- data_field.set_selected_state(data_param.to_bool)
844
- when :textfield
845
- data_field.set("#{data_param}\t")
846
- when :section
847
- data_field.set(data_param)
886
+ when :checkbox
887
+ data_field.set_checkbox_state(data_param.to_bool)
888
+ when :selectlist
889
+ data_field.get_siebel_object_type == 'JComboBox' ?
890
+ data_field.set("#{data_param}\t") :
891
+ data_field.choose_option(data_param)
892
+ when :radio
893
+ data_field.set_selected_state(data_param.to_bool)
894
+ when :textfield
895
+ data_field.set("#{data_param}\t")
896
+ when :section
897
+ data_field.set(data_param)
848
898
  end
849
899
  end
850
900
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '2.3.17'
2
+ VERSION = '2.3.18'
3
3
  end
@@ -2,13 +2,15 @@ module TestCentricity
2
2
  class SelectList < UIElement
3
3
  attr_accessor :list_item
4
4
  attr_accessor :selected_item
5
+ attr_accessor :list_trigger
5
6
 
6
7
  def initialize(name, parent, locator, context)
7
8
  super
8
9
  @type = :selectlist
9
10
  list_spec = {
10
- :list_item => 'option',
11
- :selected_item => 'option[selected]'
11
+ :list_item => "li[class*='active-result']",
12
+ :selected_item => "li[class*='result-selected']",
13
+ :list_trigger => nil
12
14
  }
13
15
  define_list_elements(list_spec)
14
16
  end
@@ -16,12 +18,14 @@ module TestCentricity
16
18
  def define_list_elements(element_spec)
17
19
  element_spec.each do |element, value|
18
20
  case element
19
- when :list_item
20
- @list_item = value
21
- when :selected_item
22
- @selected_item = value
23
- else
24
- raise "#{element} is not a recognized selectlist element"
21
+ when :list_item
22
+ @list_item = value
23
+ when :selected_item
24
+ @selected_item = value
25
+ when :list_trigger
26
+ @list_trigger = value
27
+ else
28
+ raise "#{element} is not a recognized selectlist element"
25
29
  end
26
30
  end
27
31
  end
@@ -42,19 +46,26 @@ module TestCentricity
42
46
  def choose_option(option)
43
47
  obj, = find_element
44
48
  object_not_found_exception(obj, nil)
45
- obj.click
46
- if first(:css, "li[class*='active-result']")
49
+ if @list_trigger.nil?
50
+ obj.click
51
+ else
52
+ page.find(:css, @list_trigger).click
53
+ sleep(1)
54
+ end
55
+ if first(:css, @list_item)
47
56
  if option.is_a?(Array)
48
57
  option.each do |item|
49
- page.find(:css, "li[class*='active-result']", text: item.strip).click
58
+ page.find(:css, @list_item, text: item.strip).click
50
59
  end
51
60
  else
52
61
  if option.is_a?(Hash)
53
- page.find(:css, "li[class*='active-result']:nth-of-type(#{option[:index]})").click if option.has_key?(:index)
62
+ page.find(:css, "#{@list_item}:nth-of-type(#{option[:index]})").click if option.has_key?(:index)
63
+ page.find(:css, "#{@list_item}:nth-of-type(#{option[:value]})").click if option.has_key?(:value)
64
+ page.find(:css, "#{@list_item}:nth-of-type(#{option[:text]})").click if option.has_key?(:text)
54
65
  else
55
- options = obj.all("li[class*='active-result']").collect(&:text)
66
+ options = obj.all(@list_item).collect(&:text)
56
67
  sleep(2) unless options.include?(option)
57
- first(:css, "li[class*='active-result']", text: option).click
68
+ first(:css, @list_item, text: option).click
58
69
  end
59
70
  end
60
71
  else
@@ -78,10 +89,10 @@ module TestCentricity
78
89
  def get_options
79
90
  obj, = find_element
80
91
  object_not_found_exception(obj, nil)
81
- if first(:css, "li[class*='active-result']")
82
- obj.all("li[class*='active-result']").collect(&:text)
83
- else
92
+ if first(:css, @list_item)
84
93
  obj.all(@list_item).collect(&:text)
94
+ else
95
+ obj.all('option').collect(&:text)
85
96
  end
86
97
  end
87
98
 
@@ -97,10 +108,10 @@ module TestCentricity
97
108
  def get_option_count
98
109
  obj, = find_element
99
110
  object_not_found_exception(obj, nil)
100
- if first(:css, "li[class*='active-result']")
101
- obj.all("li[class*='active-result']").count
102
- else
111
+ if first(:css, @list_item)
103
112
  obj.all(@list_item).count
113
+ else
114
+ obj.all('option').count
104
115
  end
105
116
  end
106
117
 
@@ -123,10 +134,10 @@ module TestCentricity
123
134
  def get_selected_option
124
135
  obj, = find_element
125
136
  object_not_found_exception(obj, nil)
126
- if first(:css, "li[class*='active-result']")
127
- obj.first(:css, "li[class*='result-selected']").text
137
+ if first(:css, @list_item)
138
+ obj.first(:css, @selected_item).text
128
139
  else
129
- obj.first(@selected_item).text
140
+ obj.first('option[selected]').text
130
141
  end
131
142
  end
132
143
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.17
4
+ version: 2.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler