testcentricity_web 3.0.8 → 3.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09f6bbb5fd6d45a4e0783ce4a2eedcb8d81f58a5'
4
- data.tar.gz: 144f6b80f4d26187a4d6890561b6da2af28435b3
3
+ metadata.gz: ce7b9d33fb084f3a6eb181258cf9eb01b50c5125
4
+ data.tar.gz: 470a8250a74ffd814ecf135e75ad471193b77605
5
5
  SHA512:
6
- metadata.gz: bc1cd2e1cafa3546b9d155ede4f3d5143464eb61d6708981c725484d2935252347a3ed59d45c0670691ecfdfda7cae01e454957af88a63cb7c2b5fe4c95751d7
7
- data.tar.gz: 47b00fcb5176454ddf83b4e1276802eae6fae3ec773ce1a074198e68369a959bc1b5893a7f52f813ad2288413fcc76ec08f6c73f99c4d274fc10a63a6e128fca
6
+ metadata.gz: 14d71fdfd37f86ebfbe036752486c2f91a0a81a9e7bcb227a4cdf12ad200e2ad9ed2234403e29880445c77daf049f1dba98e40d14f2068822530883c9b0d5e4d
7
+ data.tar.gz: 466a446c09b02791360e5f56d99a0ba78dfff67eba04c479cd3e1d8a62353b0d368ffeb4bfb389d442e12327ed702d5a06b8c4f780b56352585a9f2f116c5311
data/HISTORY.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # HISTORY
2
2
 
3
+ ###Version 3.0.9
4
+
5
+ * Added `List.choose_item` and `List.get_selected_item` methods.
6
+ * Added `SelectList.set` method.
7
+
3
8
  ###Version 3.0.8
4
9
 
5
10
  * Added `PageObject.wait_for_ajax` method.
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.
@@ -6,10 +6,9 @@ require 'childprocess'
6
6
  #
7
7
  module TestCentricity
8
8
  class AppiumServer
9
-
10
9
  attr_accessor :process
11
10
 
12
- def initialize(params={})
11
+ def initialize(params = {})
13
12
  @params = params
14
13
  end
15
14
 
@@ -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
- size = [width, height] :
157
- size = [height, width]
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
- :start_row => row_start,
85
- :num_rows => row_end,
86
- :used_rows => mru_rows
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
- :start_row => found[0],
117
- :num_rows => found.size,
118
- :used_rows => [new_row]
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 = { :path => path, :filename => filename }
103
+ screen_shot = {path: path, filename: filename}
104
104
  Environ.save_screen_shot(screen_shot)
105
105
  end
106
106
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '3.0.8'
2
+ VERSION = '3.0.9'
3
3
  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
- data_field.set("#{data_param}\t") :
670
- data_field.choose_option(data_param)
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
- @locator_type = :xpath
31
- elsif is_css && !is_xpath
32
- @locator_type = :css
33
- elsif !is_css && !is_xpath
34
- @locator_type = :css
35
- else
36
- raise "Cannot determine type of locator for PageSection '#{@name}' - locator = #{@locator}"
37
- end
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
- data_field.set("#{data_param}\t") :
846
- data_field.choose_option(data_param)
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, :wait => 0.1)
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
- define_list_elements({ :list_item => 'li' })
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
- when :list_item
15
- @list_item = value
16
- else
17
- raise "#{element} is not a recognized list 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 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
- if visible
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, :visible => :all).collect(&:text)
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, :visible => :all).count
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
- ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list #{object_ref_message}") :
61
- assert_equal(expected, actual, "Expected list #{object_ref_message} to be #{expected} but found #{actual}")
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
- when :xpath
67
- "#{@locator}/#{@list_item}[#{row}]"
68
- when :css
69
- "#{@locator} > #{@list_item}:nth-of-type(#{row})"
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({ :greater_than_or_equal => 1 }, 5)
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
- :list_item => "li[class*='active-result']",
12
- :selected_item => "li[class*='result-selected']",
13
- :list_trigger => nil
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
- 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"
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(:value => 'AB')
43
- # state_select.choose_option(:index => 24)
44
- # state_select.choose_option(:text => 'Maryland')
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.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)
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
- ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}") :
124
- assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
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']", :exact => true, :match => :prefer_exact, text: option).click
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
- ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}") :
179
- assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
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.has_key?(:value)
222
+ obj.find("option[value='#{option[:value]}']").click if option.key?(:value)
201
223
 
202
- if option.has_key?(:index)
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.has_key?(:text)
232
+ obj.select option[:text] if option.key?(:text)
211
233
  else
212
- obj.select option
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 = { :table_body => 'tbody',
18
- :table_section => nil,
19
- :table_row => 'tr',
20
- :table_column => 'td',
21
- :table_header => 'thead',
22
- :header_row => 'tr',
23
- :header_column => 'th' }
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}", :visible => :all).count
76
+ page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}", visible: :all).count
75
77
  else
76
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}", :visible => :all).count
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}", :visible => :all).count
82
+ page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}", visible: :all).count
81
83
  else
82
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}", :visible => :all).count
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 == 0
98
- page.all(:xpath, "#{@locator}/#{@table_header}/#{@header_row}/#{@header_column}", :visible => :all).count
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}", :visible => :all).count :
103
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}[2]/#{@table_column}", :visible => :all).count
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}", :visible => :all).count :
107
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}[2]/#{@table_row}/#{@table_column}", :visible => :all).count
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 == 0
112
- page.all(:css, "#{@locator} > #{@table_header} > #{@header_row} > #{@header_column}", :visible => :all).count
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}", :visible => :all).count :
117
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}:nth-of-type(2) > #{@table_column}", :visible => :all).count
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}", :visible => :all).count :
121
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}:nth-of-type(2) > #{@table_row} > #{@table_column}", :visible => :all).count
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
- @locator_type = :xpath
59
- elsif is_css && !is_xpath
60
- @locator_type = :css
61
- elsif !is_css && !is_xpath
62
- @locator_type = :css
63
- else
64
- raise "Cannot determine type of locator for UIElement '#{@name}' - locator = #{locator}"
65
- end
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({ :greater_than => '250' }, 5)
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, :wait => 0.01).find(@locator_type, obj_locator, :wait => 0.01, :visible => visible)
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, :wait => 0.01, :visible => visible)
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.8
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-06-28 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler