testcentricity_web 2.3.17 → 2.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/devices/devices.yml +2 -2
- data/lib/testcentricity_web/page_objects_helper.rb +162 -112
- data/lib/testcentricity_web/page_sections_helper.rb +166 -116
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_elements/select_list.rb +34 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46cfb329a606408f5145832f268199fa1b3590a1
|
4
|
+
data.tar.gz: 7bae7e8f22feb92f28b914b9d9768607b26e6563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/devices/devices.yml
CHANGED
@@ -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
|
+
: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/
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
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
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
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
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
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
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
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
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
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
|
@@ -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 => '
|
11
|
-
:selected_item => '
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
46
|
-
|
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,
|
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, "
|
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(
|
66
|
+
options = obj.all(@list_item).collect(&:text)
|
56
67
|
sleep(2) unless options.include?(option)
|
57
|
-
first(:css,
|
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,
|
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,
|
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,
|
127
|
-
obj.first(:css,
|
137
|
+
if first(:css, @list_item)
|
138
|
+
obj.first(:css, @selected_item).text
|
128
139
|
else
|
129
|
-
obj.first(
|
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.
|
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-
|
11
|
+
date: 2018-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|