testcentricity_web 3.0.8 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +5 -0
- data/README.md +5 -0
- data/lib/testcentricity_web/appium_server.rb +1 -2
- data/lib/testcentricity_web/browser_helper.rb +5 -3
- data/lib/testcentricity_web/data_objects/excel_helper.rb +6 -6
- data/lib/testcentricity_web/exception_queue_helper.rb +1 -1
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +5 -3
- data/lib/testcentricity_web/web_core/page_sections_helper.rb +15 -13
- data/lib/testcentricity_web/web_elements/list.rb +70 -20
- data/lib/testcentricity_web/web_elements/select_list.rb +56 -34
- data/lib/testcentricity_web/web_elements/table.rb +25 -23
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +12 -12
- 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: ce7b9d33fb084f3a6eb181258cf9eb01b50c5125
|
4
|
+
data.tar.gz: 470a8250a74ffd814ecf135e75ad471193b77605
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14d71fdfd37f86ebfbe036752486c2f91a0a81a9e7bcb227a4cdf12ad200e2ad9ed2234403e29880445c77daf049f1dba98e40d14f2068822530883c9b0d5e4d
|
7
|
+
data.tar.gz: 466a446c09b02791360e5f56d99a0ba78dfff67eba04c479cd3e1d8a62353b0d368ffeb4bfb389d442e12327ed702d5a06b8c4f780b56352585a9f2f116c5311
|
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -26,6 +26,11 @@ The TestCentricity™ Web gem supports running automated tests against the follo
|
|
26
26
|
|
27
27
|
A complete history of bug fixes and new features can be found in the {file:HISTORY.md HISTORY} file.
|
28
28
|
|
29
|
+
###Version 3.0.9
|
30
|
+
|
31
|
+
* Added `List.choose_item` and `List.get_selected_item` methods.
|
32
|
+
* Added `SelectList.set` method.
|
33
|
+
|
29
34
|
###Version 3.0.8
|
30
35
|
|
31
36
|
* Added `PageObject.wait_for_ajax` method.
|
@@ -152,9 +152,11 @@ module TestCentricity
|
|
152
152
|
default_orientation = device[:default_orientation].to_sym
|
153
153
|
if orientation
|
154
154
|
Environ.device_orientation = orientation
|
155
|
-
orientation.downcase.to_sym == default_orientation
|
156
|
-
|
157
|
-
|
155
|
+
size = if orientation.downcase.to_sym == default_orientation
|
156
|
+
[width, height]
|
157
|
+
else
|
158
|
+
[height, width]
|
159
|
+
end
|
158
160
|
else
|
159
161
|
Environ.device_orientation = device[:default_orientation]
|
160
162
|
size = [width, height]
|
@@ -81,9 +81,9 @@ module TestCentricity
|
|
81
81
|
end
|
82
82
|
|
83
83
|
pool_spec = {
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
84
|
+
start_row: row_start,
|
85
|
+
num_rows: row_end,
|
86
|
+
used_rows: mru_rows
|
87
87
|
}
|
88
88
|
else
|
89
89
|
# get column headings from row 0 of worksheet
|
@@ -113,9 +113,9 @@ module TestCentricity
|
|
113
113
|
|
114
114
|
new_row = found.sample.to_i
|
115
115
|
pool_spec = {
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
116
|
+
start_row: found[0],
|
117
|
+
num_rows: found.size,
|
118
|
+
used_rows: [new_row]
|
119
119
|
}
|
120
120
|
end
|
121
121
|
@mru[pool_spec_key] = pool_spec
|
@@ -100,7 +100,7 @@ module TestCentricity
|
|
100
100
|
Capybara.save_screenshot "#{path}.png"
|
101
101
|
end
|
102
102
|
puts "Screenshot saved at #{path}.png"
|
103
|
-
screen_shot = {
|
103
|
+
screen_shot = {path: path, filename: filename}
|
104
104
|
Environ.save_screen_shot(screen_shot)
|
105
105
|
end
|
106
106
|
end
|
@@ -665,9 +665,11 @@ module TestCentricity
|
|
665
665
|
when :checkbox
|
666
666
|
data_field.set_checkbox_state(data_param.to_bool)
|
667
667
|
when :selectlist
|
668
|
-
data_field.get_siebel_object_type == 'JComboBox'
|
669
|
-
|
670
|
-
|
668
|
+
if data_field.get_siebel_object_type == 'JComboBox'
|
669
|
+
data_field.set("#{data_param}\t")
|
670
|
+
else
|
671
|
+
data_field.choose_option(data_param)
|
672
|
+
end
|
671
673
|
when :radio
|
672
674
|
data_field.set_selected_state(data_param.to_bool)
|
673
675
|
when :textfield
|
@@ -26,15 +26,15 @@ module TestCentricity
|
|
26
26
|
|
27
27
|
is_xpath = XPATH_SELECTORS.any? { |selector| @locator.include?(selector) }
|
28
28
|
is_css = CSS_SELECTORS.any? { |selector| @locator.include?(selector) }
|
29
|
-
if is_xpath && !is_css
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
@locator_type = if is_xpath && !is_css
|
30
|
+
:xpath
|
31
|
+
elsif is_css && !is_xpath
|
32
|
+
:css
|
33
|
+
elsif !is_css && !is_xpath
|
34
|
+
:css
|
35
|
+
else
|
36
|
+
:css
|
37
|
+
end
|
38
38
|
end
|
39
39
|
|
40
40
|
def get_locator
|
@@ -841,9 +841,11 @@ module TestCentricity
|
|
841
841
|
when :checkbox
|
842
842
|
data_field.set_checkbox_state(data_param.to_bool)
|
843
843
|
when :selectlist
|
844
|
-
data_field.get_siebel_object_type == 'JComboBox'
|
845
|
-
|
846
|
-
|
844
|
+
if data_field.get_siebel_object_type == 'JComboBox'
|
845
|
+
data_field.set("#{data_param}\t")
|
846
|
+
else
|
847
|
+
data_field.choose_option(data_param)
|
848
|
+
end
|
847
849
|
when :radio
|
848
850
|
data_field.set_selected_state(data_param.to_bool)
|
849
851
|
when :textfield
|
@@ -873,7 +875,7 @@ module TestCentricity
|
|
873
875
|
def find_section
|
874
876
|
locator = get_locator
|
875
877
|
locator = locator.gsub('|', ' ')
|
876
|
-
obj = page.find(@locator_type, locator, :
|
878
|
+
obj = page.find(@locator_type, locator, wait: 0.1)
|
877
879
|
[obj, @locator_type]
|
878
880
|
rescue
|
879
881
|
[nil, nil]
|
@@ -1,24 +1,49 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class List < UIElement
|
3
3
|
attr_accessor :list_item
|
4
|
+
attr_accessor :selected_item
|
4
5
|
|
5
6
|
def initialize(name, parent, locator, context)
|
6
7
|
super
|
7
8
|
@type = :list
|
8
|
-
|
9
|
+
list_spec = {
|
10
|
+
list_item: 'li',
|
11
|
+
selected_item: 'li.selected'
|
12
|
+
}
|
13
|
+
define_list_elements(list_spec)
|
9
14
|
end
|
10
15
|
|
11
16
|
def define_list_elements(element_spec)
|
12
17
|
element_spec.each do |element, value|
|
13
18
|
case element
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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 list element"
|
18
25
|
end
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
29
|
+
def choose_item(item)
|
30
|
+
obj, = find_element
|
31
|
+
object_not_found_exception(obj, nil)
|
32
|
+
if item.is_a?(Integer)
|
33
|
+
obj.find(:css, "#{@list_item}:nth-of-type(#{item})").click
|
34
|
+
elsif item.is_a?(String)
|
35
|
+
items = obj.all(@list_item).collect(&:text)
|
36
|
+
sleep(2) unless items.include?(item)
|
37
|
+
obj.first(:css, @list_item, text: item).click
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Return array of strings of all items in a list object.
|
42
|
+
#
|
43
|
+
# @return [Array]
|
44
|
+
# @example
|
45
|
+
# nav_items = nav_list.get_options
|
46
|
+
#
|
22
47
|
def get_list_items(element_spec = nil)
|
23
48
|
define_list_elements(element_spec) unless element_spec.nil?
|
24
49
|
obj, = find_element
|
@@ -27,14 +52,16 @@ module TestCentricity
|
|
27
52
|
end
|
28
53
|
|
29
54
|
def get_list_item(index, visible = true)
|
30
|
-
|
31
|
-
items = get_list_items
|
32
|
-
else
|
33
|
-
items = get_all_list_items
|
34
|
-
end
|
55
|
+
items = visible ? get_list_items : get_all_list_items
|
35
56
|
items[index - 1]
|
36
57
|
end
|
37
58
|
|
59
|
+
# Return the number of items in a list object.
|
60
|
+
#
|
61
|
+
# @return [Integer]
|
62
|
+
# @example
|
63
|
+
# num_nav_items = nav_list.get_item_count
|
64
|
+
#
|
38
65
|
def get_item_count
|
39
66
|
obj, = find_element
|
40
67
|
object_not_found_exception(obj, nil)
|
@@ -45,28 +72,44 @@ module TestCentricity
|
|
45
72
|
define_list_elements(element_spec) unless element_spec.nil?
|
46
73
|
obj, = find_element
|
47
74
|
object_not_found_exception(obj, nil)
|
48
|
-
obj.all(@list_item, :
|
75
|
+
obj.all(@list_item, visible: :all).collect(&:text)
|
49
76
|
end
|
50
77
|
|
51
78
|
def get_all_items_count
|
52
79
|
obj, = find_element
|
53
80
|
object_not_found_exception(obj, nil)
|
54
|
-
obj.all(@list_item, :
|
81
|
+
obj.all(@list_item, visible: :all).count
|
55
82
|
end
|
56
83
|
|
84
|
+
# Return text of first selected item in a list object.
|
85
|
+
#
|
86
|
+
# @return [String]
|
87
|
+
# @example
|
88
|
+
# current_selection = nav_list.get_selected_item
|
89
|
+
#
|
90
|
+
def get_selected_item
|
91
|
+
obj, = find_element
|
92
|
+
object_not_found_exception(obj, nil)
|
93
|
+
obj.first(:css, @list_item, minimum: 0) ? obj.first(:css, @selected_item).text : nil
|
94
|
+
end
|
95
|
+
|
96
|
+
alias selected? get_selected_item
|
97
|
+
|
57
98
|
def verify_list_items(expected, enqueue = false)
|
58
99
|
actual = get_list_items
|
59
|
-
enqueue
|
60
|
-
|
61
|
-
|
100
|
+
if enqueue
|
101
|
+
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list #{object_ref_message}")
|
102
|
+
else
|
103
|
+
assert_equal(expected, actual, "Expected list #{object_ref_message} to be #{expected} but found #{actual}")
|
104
|
+
end
|
62
105
|
end
|
63
106
|
|
64
107
|
def get_list_row_locator(row)
|
65
108
|
case @locator_type
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
109
|
+
when :xpath
|
110
|
+
"#{@locator}/#{@list_item}[#{row}]"
|
111
|
+
when :css
|
112
|
+
"#{@locator} > #{@list_item}:nth-of-type(#{row})"
|
70
113
|
end
|
71
114
|
end
|
72
115
|
|
@@ -78,7 +121,7 @@ module TestCentricity
|
|
78
121
|
# @example
|
79
122
|
# search_results_list.wait_until_item_count_is(10, 15)
|
80
123
|
# or
|
81
|
-
# search_results_list.wait_until_item_count_is({ :
|
124
|
+
# search_results_list.wait_until_item_count_is({ greater_than_or_equal: 1 }, 5)
|
82
125
|
#
|
83
126
|
def wait_until_item_count_is(value, seconds = nil)
|
84
127
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
@@ -88,6 +131,13 @@ module TestCentricity
|
|
88
131
|
raise "Value of List #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_item_count == value
|
89
132
|
end
|
90
133
|
|
134
|
+
# Wait until the list's item count changes to a different value, or until the specified wait time has expired. If the
|
135
|
+
# wait time is nil, then the wait time will be Capybara.default_max_wait_time.
|
136
|
+
#
|
137
|
+
# @param seconds [Integer or Float] wait time in seconds
|
138
|
+
# @example
|
139
|
+
# search_results_list.wait_until_value_changes(5)
|
140
|
+
#
|
91
141
|
def wait_until_item_count_changes(seconds = nil)
|
92
142
|
value = get_item_count
|
93
143
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
@@ -3,14 +3,16 @@ module TestCentricity
|
|
3
3
|
attr_accessor :list_item
|
4
4
|
attr_accessor :selected_item
|
5
5
|
attr_accessor :list_trigger
|
6
|
+
attr_accessor :text_field
|
6
7
|
|
7
8
|
def initialize(name, parent, locator, context)
|
8
9
|
super
|
9
10
|
@type = :selectlist
|
10
11
|
list_spec = {
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
12
|
+
list_item: "li[class*='active-result']",
|
13
|
+
selected_item: "li[class*='result-selected']",
|
14
|
+
list_trigger: nil,
|
15
|
+
text_field: nil
|
14
16
|
}
|
15
17
|
define_list_elements(list_spec)
|
16
18
|
end
|
@@ -18,14 +20,16 @@ module TestCentricity
|
|
18
20
|
def define_list_elements(element_spec)
|
19
21
|
element_spec.each do |element, value|
|
20
22
|
case element
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
when :list_item
|
24
|
+
@list_item = value
|
25
|
+
when :selected_item
|
26
|
+
@selected_item = value
|
27
|
+
when :list_trigger
|
28
|
+
@list_trigger = value
|
29
|
+
when :text_field
|
30
|
+
@text_field = value
|
31
|
+
else
|
32
|
+
raise "#{element} is not a recognized selectlist element"
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
@@ -39,9 +43,9 @@ module TestCentricity
|
|
39
43
|
#
|
40
44
|
# @example
|
41
45
|
# province_select.choose_option('Alberta')
|
42
|
-
# province_select.choose_option(:
|
43
|
-
# state_select.choose_option(:
|
44
|
-
# state_select.choose_option(:
|
46
|
+
# province_select.choose_option(value: 'AB')
|
47
|
+
# state_select.choose_option(index: 24)
|
48
|
+
# state_select.choose_option(text: 'Maryland')
|
45
49
|
#
|
46
50
|
def choose_option(option)
|
47
51
|
obj, = find_element
|
@@ -59,9 +63,9 @@ module TestCentricity
|
|
59
63
|
end
|
60
64
|
else
|
61
65
|
if option.is_a?(Hash)
|
62
|
-
page.find(:css, "#{@list_item}:nth-of-type(#{option[:index]})").click if option.
|
63
|
-
page.find(:css, "#{@list_item}:nth-of-type(#{option[:value]})").click if option.
|
64
|
-
page.find(:css, "#{@list_item}:nth-of-type(#{option[:text]})").click if option.
|
66
|
+
page.find(:css, "#{@list_item}:nth-of-type(#{option[:index]})").click if option.key?(:index)
|
67
|
+
page.find(:css, "#{@list_item}:nth-of-type(#{option[:value]})").click if option.key?(:value)
|
68
|
+
page.find(:css, "#{@list_item}:nth-of-type(#{option[:text]})").click if option.key?(:text)
|
65
69
|
else
|
66
70
|
options = obj.all(@list_item).collect(&:text)
|
67
71
|
sleep(2) unless options.include?(option)
|
@@ -79,6 +83,20 @@ module TestCentricity
|
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
86
|
+
def set(text)
|
87
|
+
if @text_field.nil?
|
88
|
+
raise "A 'text_field' list element must be defined before calling the 'set' method on a selectlist object"
|
89
|
+
end
|
90
|
+
obj, = find_element
|
91
|
+
object_not_found_exception(obj, nil)
|
92
|
+
if @list_trigger.nil?
|
93
|
+
obj.click
|
94
|
+
else
|
95
|
+
page.find(:css, @list_trigger).click
|
96
|
+
end
|
97
|
+
page.find(:css, @text_field, wait: 2).set(text)
|
98
|
+
end
|
99
|
+
|
82
100
|
# Return array of strings of all options in a select box object.
|
83
101
|
# Supports standard HTML select objects and Chosen select objects.
|
84
102
|
#
|
@@ -89,10 +107,10 @@ module TestCentricity
|
|
89
107
|
def get_options
|
90
108
|
obj, = find_element
|
91
109
|
object_not_found_exception(obj, nil)
|
92
|
-
if first(:css, @list_item, minimum: 0)
|
110
|
+
if obj.first(:css, @list_item, minimum: 0)
|
93
111
|
obj.all(@list_item).collect(&:text)
|
94
112
|
else
|
95
|
-
obj.all('option').collect(&:text)
|
113
|
+
obj.all('option', visible: :all).collect(&:text)
|
96
114
|
end
|
97
115
|
end
|
98
116
|
|
@@ -108,10 +126,10 @@ module TestCentricity
|
|
108
126
|
def get_option_count
|
109
127
|
obj, = find_element
|
110
128
|
object_not_found_exception(obj, nil)
|
111
|
-
if first(:css, @list_item, minimum: 0)
|
129
|
+
if obj.first(:css, @list_item, minimum: 0)
|
112
130
|
obj.all(@list_item).count
|
113
131
|
else
|
114
|
-
obj.all('option').count
|
132
|
+
obj.all('option', visible: :all).count
|
115
133
|
end
|
116
134
|
end
|
117
135
|
|
@@ -119,9 +137,11 @@ module TestCentricity
|
|
119
137
|
|
120
138
|
def verify_options(expected, enqueue = false)
|
121
139
|
actual = get_options
|
122
|
-
enqueue
|
123
|
-
|
124
|
-
|
140
|
+
if enqueue
|
141
|
+
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}")
|
142
|
+
else
|
143
|
+
assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
|
144
|
+
end
|
125
145
|
end
|
126
146
|
|
127
147
|
# Return text of first selected option in a select box object.
|
@@ -134,10 +154,10 @@ module TestCentricity
|
|
134
154
|
def get_selected_option
|
135
155
|
obj, = find_element
|
136
156
|
object_not_found_exception(obj, nil)
|
137
|
-
if first(:css, @list_item, minimum: 0)
|
157
|
+
if obj.first(:css, @list_item, minimum: 0)
|
138
158
|
obj.first(:css, @selected_item).text
|
139
159
|
else
|
140
|
-
obj.first('option[selected]').text
|
160
|
+
obj.first('option[selected]', visible: :all).text
|
141
161
|
end
|
142
162
|
end
|
143
163
|
|
@@ -152,7 +172,7 @@ module TestCentricity
|
|
152
172
|
def choose_siebel_option(option)
|
153
173
|
Capybara.wait_on_first_by_default = true
|
154
174
|
invoke_siebel_popup
|
155
|
-
first(:xpath, "//li[@class='ui-menu-item']", :
|
175
|
+
first(:xpath, "//li[@class='ui-menu-item']", exact: true, match: :prefer_exact, text: option).click
|
156
176
|
end
|
157
177
|
|
158
178
|
# Return array of strings of all options in a Siebel OUI select box object.
|
@@ -174,9 +194,11 @@ module TestCentricity
|
|
174
194
|
invoke_siebel_popup
|
175
195
|
sleep(0.5)
|
176
196
|
actual = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
177
|
-
enqueue
|
178
|
-
|
179
|
-
|
197
|
+
if enqueue
|
198
|
+
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}")
|
199
|
+
else
|
200
|
+
assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
|
201
|
+
end
|
180
202
|
obj, = find_element
|
181
203
|
obj.native.send_keys(:escape)
|
182
204
|
end
|
@@ -197,9 +219,9 @@ module TestCentricity
|
|
197
219
|
|
198
220
|
def select_item(obj, option)
|
199
221
|
if option.is_a?(Hash)
|
200
|
-
obj.find("option[value='#{option[:value]}']").click if option.
|
222
|
+
obj.find("option[value='#{option[:value]}']").click if option.key?(:value)
|
201
223
|
|
202
|
-
if option.
|
224
|
+
if option.key?(:index)
|
203
225
|
if @locator_type == :xpath
|
204
226
|
obj.find(:xpath, "option[#{option[:index]}]").select_option
|
205
227
|
else
|
@@ -207,9 +229,9 @@ module TestCentricity
|
|
207
229
|
end
|
208
230
|
end
|
209
231
|
|
210
|
-
obj.select option[:text] if option.
|
232
|
+
obj.select option[:text] if option.key?(:text)
|
211
233
|
else
|
212
|
-
obj.select
|
234
|
+
obj.select(option, visible: :all)
|
213
235
|
end
|
214
236
|
end
|
215
237
|
end
|
@@ -14,13 +14,15 @@ module TestCentricity
|
|
14
14
|
super
|
15
15
|
@type = :table
|
16
16
|
|
17
|
-
table_spec = {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
table_spec = {
|
18
|
+
table_body: 'tbody',
|
19
|
+
table_section: nil,
|
20
|
+
table_row: 'tr',
|
21
|
+
table_column: 'td',
|
22
|
+
table_header: 'thead',
|
23
|
+
header_row: 'tr',
|
24
|
+
header_column: 'th'
|
25
|
+
}
|
24
26
|
|
25
27
|
case @locator_type
|
26
28
|
when :xpath
|
@@ -71,15 +73,15 @@ module TestCentricity
|
|
71
73
|
case @locator_type
|
72
74
|
when :xpath
|
73
75
|
if @table_section.nil?
|
74
|
-
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}", :
|
76
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}", visible: :all).count
|
75
77
|
else
|
76
|
-
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}", :
|
78
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}", visible: :all).count
|
77
79
|
end
|
78
80
|
when :css
|
79
81
|
if @table_section.nil?
|
80
|
-
page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}", :
|
82
|
+
page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}", visible: :all).count
|
81
83
|
else
|
82
|
-
page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}", :
|
84
|
+
page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}", visible: :all).count
|
83
85
|
end
|
84
86
|
end
|
85
87
|
end
|
@@ -94,31 +96,31 @@ module TestCentricity
|
|
94
96
|
row_count = get_row_count
|
95
97
|
case @locator_type
|
96
98
|
when :xpath
|
97
|
-
if row_count
|
98
|
-
page.all(:xpath, "#{@locator}/#{@table_header}/#{@header_row}/#{@header_column}", :
|
99
|
+
if row_count.zero?
|
100
|
+
page.all(:xpath, "#{@locator}/#{@table_header}/#{@header_row}/#{@header_column}", visible: :all).count
|
99
101
|
else
|
100
102
|
if @table_section.nil?
|
101
103
|
row_count == 1 ?
|
102
|
-
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}/#{@table_column}", :
|
103
|
-
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}[2]/#{@table_column}", :
|
104
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}/#{@table_column}", visible: :all).count :
|
105
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}[2]/#{@table_column}", visible: :all).count
|
104
106
|
else
|
105
107
|
row_count == 1 ?
|
106
|
-
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}/#{@table_row}/#{@table_column}", :
|
107
|
-
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}[2]/#{@table_row}/#{@table_column}", :
|
108
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}/#{@table_row}/#{@table_column}", visible: :all).count :
|
109
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}[2]/#{@table_row}/#{@table_column}", visible: :all).count
|
108
110
|
end
|
109
111
|
end
|
110
112
|
when :css
|
111
|
-
if row_count
|
112
|
-
page.all(:css, "#{@locator} > #{@table_header} > #{@header_row} > #{@header_column}", :
|
113
|
+
if row_count.zero?
|
114
|
+
page.all(:css, "#{@locator} > #{@table_header} > #{@header_row} > #{@header_column}", visible: :all).count
|
113
115
|
else
|
114
116
|
if @table_section.nil?
|
115
117
|
row_count == 1 ?
|
116
|
-
page.all(:css, "#{@locator} > #{@table_body} > #{@table_row} > #{@table_column}", :
|
117
|
-
page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}:nth-of-type(2) > #{@table_column}", :
|
118
|
+
page.all(:css, "#{@locator} > #{@table_body} > #{@table_row} > #{@table_column}", visible: :all).count :
|
119
|
+
page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}:nth-of-type(2) > #{@table_column}", visible: :all).count
|
118
120
|
else
|
119
121
|
row_count == 1 ?
|
120
|
-
page.all(:css, "#{@locator} > #{@table_body} > #{@table_section} > #{@table_row} > #{@table_column}", :
|
121
|
-
page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}:nth-of-type(2) > #{@table_row} > #{@table_column}", :
|
122
|
+
page.all(:css, "#{@locator} > #{@table_body} > #{@table_section} > #{@table_row} > #{@table_column}", visible: :all).count :
|
123
|
+
page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}:nth-of-type(2) > #{@table_row} > #{@table_column}", visible: :all).count
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|
@@ -54,15 +54,15 @@ module TestCentricity
|
|
54
54
|
locator = @locator if locator.nil?
|
55
55
|
is_xpath = XPATH_SELECTORS.any? { |selector| locator.include?(selector) }
|
56
56
|
is_css = CSS_SELECTORS.any? { |selector| locator.include?(selector) }
|
57
|
-
if is_xpath && !is_css
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
57
|
+
@locator_type = if is_xpath && !is_css
|
58
|
+
:xpath
|
59
|
+
elsif is_css && !is_xpath
|
60
|
+
:css
|
61
|
+
elsif !is_css && !is_xpath
|
62
|
+
:css
|
63
|
+
else
|
64
|
+
:css
|
65
|
+
end
|
66
66
|
end
|
67
67
|
|
68
68
|
def get_object_type
|
@@ -306,7 +306,7 @@ module TestCentricity
|
|
306
306
|
# @example
|
307
307
|
# card_authorized_label.wait_until_value_is('Card authorized', 5)
|
308
308
|
# or
|
309
|
-
# total_weight_field.wait_until_value_is({ :
|
309
|
+
# total_weight_field.wait_until_value_is({ greater_than: '250' }, 5)
|
310
310
|
#
|
311
311
|
def wait_until_value_is(value, seconds = nil)
|
312
312
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
@@ -470,9 +470,9 @@ module TestCentricity
|
|
470
470
|
parent_locator = @parent.get_locator
|
471
471
|
parent_locator = parent_locator.gsub('|', ' ')
|
472
472
|
parent_locator_type = @parent.get_locator_type
|
473
|
-
obj = page.find(parent_locator_type, parent_locator, :
|
473
|
+
obj = page.find(parent_locator_type, parent_locator, wait: 0.01).find(@locator_type, obj_locator, wait: 0.01, visible: visible)
|
474
474
|
else
|
475
|
-
obj = page.find(@locator_type, obj_locator, :
|
475
|
+
obj = page.find(@locator_type, obj_locator, wait: 0.01, visible: visible)
|
476
476
|
end
|
477
477
|
[obj, @locator_type]
|
478
478
|
rescue
|
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: 3.0.
|
4
|
+
version: 3.0.9
|
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-
|
11
|
+
date: 2018-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|