testcentricity_web 1.0.10 → 1.0.11
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 +1 -1
- data/lib/testcentricity_web/elements/button.rb +3 -6
- data/lib/testcentricity_web/elements/checkbox.rb +6 -5
- data/lib/testcentricity_web/elements/file_field.rb +15 -6
- data/lib/testcentricity_web/elements/image.rb +4 -7
- data/lib/testcentricity_web/elements/label.rb +3 -6
- data/lib/testcentricity_web/elements/link.rb +3 -6
- data/lib/testcentricity_web/elements/list.rb +6 -10
- data/lib/testcentricity_web/elements/radio.rb +3 -2
- data/lib/testcentricity_web/elements/select_list.rb +5 -8
- data/lib/testcentricity_web/elements/table.rb +27 -30
- data/lib/testcentricity_web/elements/textfield.rb +3 -6
- data/lib/testcentricity_web/page_objects_helper.rb +15 -15
- data/lib/testcentricity_web/page_sections_helper.rb +30 -25
- data/lib/testcentricity_web/ui_elements_helper.rb +21 -16
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/webdriver_helper.rb +5 -1
- 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: 6aa70185a02180a4bb0c3e5f2fa3eee415b6c274
|
4
|
+
data.tar.gz: d7ee5fecdef3e4c33322ad9791b6fc3023da7189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ef24f00291c38c9267e61168db063c48d312f3a4ba5708c20b5d9e20332eec47935870b3cf247c9712ce96bdfaebc8c245916ca11da6ad3d6cab2f0b8e1dd50
|
7
|
+
data.tar.gz: 94b477206bc4004212eec3d0e8b0819256d361f45c8a0daaf9146e9eb846289e39d1c11c8c663aba9915549677789a4cc1c07f1f0afa7a202f0ae07d5b372581
|
data/README.md
CHANGED
@@ -1091,7 +1091,7 @@ in landscape orientation:
|
|
1091
1091
|
|
1092
1092
|
$ cucumber -p ipad_pro_93_sim -p landscape
|
1093
1093
|
|
1094
|
-
NOTE: Appium must
|
1094
|
+
NOTE: Appium must be running prior to executing this command
|
1095
1095
|
|
1096
1096
|
|
1097
1097
|
The following command specifies that Cucumber will run tests against a remotely hosted Safari web browser running on an OS X Yosemite
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class Button < UIElement
|
3
|
-
def initialize(parent, locator, context)
|
4
|
-
|
5
|
-
@
|
6
|
-
@context = context
|
7
|
-
@type = :button
|
8
|
-
@alt_locator = nil
|
3
|
+
def initialize(name, parent, locator, context)
|
4
|
+
super
|
5
|
+
@type = :button
|
9
6
|
end
|
10
7
|
end
|
11
8
|
end
|
@@ -2,13 +2,14 @@ module TestCentricity
|
|
2
2
|
class CheckBox < UIElement
|
3
3
|
attr_accessor :proxy
|
4
4
|
|
5
|
-
def initialize(parent, locator, context, proxy = nil)
|
5
|
+
def initialize(name, parent, locator, context, proxy = nil)
|
6
|
+
@name = name
|
6
7
|
@parent = parent
|
7
8
|
@locator = locator
|
8
9
|
@context = context
|
10
|
+
@alt_locator = nil
|
9
11
|
@proxy = proxy
|
10
12
|
@type = :checkbox
|
11
|
-
@alt_locator = nil
|
12
13
|
end
|
13
14
|
|
14
15
|
# Does checkbox object exists?
|
@@ -77,8 +78,8 @@ module TestCentricity
|
|
77
78
|
def verify_check_state(state, enqueue = false)
|
78
79
|
actual = checked?
|
79
80
|
enqueue ?
|
80
|
-
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected #{
|
81
|
-
assert_equal(state, actual, "Expected #{
|
81
|
+
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected checkbox object '#{get_name}' (#{get_locator})") :
|
82
|
+
assert_equal(state, actual, "Expected checkbox object '#{get_name}' (#{get_locator}) to be #{state} but found #{actual} instead")
|
82
83
|
end
|
83
84
|
|
84
85
|
# Set the check state of a Siebel OUI JCheckBox object.
|
@@ -90,7 +91,7 @@ module TestCentricity
|
|
90
91
|
def set_siebel_checkbox_state(state)
|
91
92
|
obj, _ = find_element
|
92
93
|
object_not_found_exception(obj, 'Siebel checkbox')
|
93
|
-
raise "#{
|
94
|
+
raise "UI object '#{get_name}' (#{get_locator}) is not a Siebel CheckBox object" unless get_siebel_object_type == 'JCheckBox'
|
94
95
|
expected = state.to_bool
|
95
96
|
obj.click unless expected == obj.checked?
|
96
97
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class FileField < UIElement
|
3
|
-
def initialize(parent, locator, context)
|
4
|
-
|
5
|
-
@
|
6
|
-
@context = context
|
7
|
-
@type = :filefield
|
8
|
-
@alt_locator = nil
|
3
|
+
def initialize(name, parent, locator, context)
|
4
|
+
super
|
5
|
+
@type = :filefield
|
9
6
|
end
|
10
7
|
|
11
8
|
def file_attach(file_path)
|
@@ -27,5 +24,17 @@ module TestCentricity
|
|
27
24
|
# trigger the fake drop event
|
28
25
|
page.execute_script("#{js_script} e = $.Event('drop'); e.originalEvent = {dataTransfer : { files : fileList } }; $('#{@locator}').trigger(e);")
|
29
26
|
end
|
27
|
+
|
28
|
+
def ng_drop_file(file_path)
|
29
|
+
# generate a fake input selector
|
30
|
+
page.execute_script("fakeFileInput = window.$('<input/>').attr({ id: 'fileFileInput', type: 'file' }).appendTo('body');")
|
31
|
+
# attach file to the fake input selector through Capybara
|
32
|
+
page.attach_file('fakeFileInput', file_path)
|
33
|
+
# create the fake js event
|
34
|
+
js_script = "var scope = angular.element('#{@locator}').scope();"
|
35
|
+
js_script = "#{js_script} scope.files = [fakeFileInput.get(0).files[0]];"
|
36
|
+
# trigger the fake drop event
|
37
|
+
page.execute_script(js_script)
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class Image < UIElement
|
3
|
-
def initialize(parent, locator, context)
|
4
|
-
|
5
|
-
@
|
6
|
-
@context = context
|
7
|
-
@type = :image
|
8
|
-
@alt_locator = nil
|
3
|
+
def initialize(name, parent, locator, context)
|
4
|
+
super
|
5
|
+
@type = :image
|
9
6
|
end
|
10
7
|
|
11
8
|
# Is image loaded?
|
@@ -31,7 +28,7 @@ module TestCentricity
|
|
31
28
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
32
29
|
wait.until { is_loaded? }
|
33
30
|
rescue
|
34
|
-
raise "Image #{
|
31
|
+
raise "Image object '#{get_name}' (#{get_locator}) failed to load within #{timeout} seconds" unless is_loaded?
|
35
32
|
end
|
36
33
|
end
|
37
34
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class Label < UIElement
|
3
|
-
def initialize(parent, locator, context)
|
4
|
-
|
5
|
-
@
|
6
|
-
@context = context
|
7
|
-
@type = :label
|
8
|
-
@alt_locator = nil
|
3
|
+
def initialize(name, parent, locator, context)
|
4
|
+
super
|
5
|
+
@type = :label
|
9
6
|
end
|
10
7
|
end
|
11
8
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class Link < UIElement
|
3
|
-
def initialize(parent, locator, context)
|
4
|
-
|
5
|
-
@
|
6
|
-
@context = context
|
7
|
-
@type = :link
|
8
|
-
@alt_locator = nil
|
3
|
+
def initialize(name, parent, locator, context)
|
4
|
+
super
|
5
|
+
@type = :link
|
9
6
|
end
|
10
7
|
end
|
11
8
|
end
|
@@ -2,14 +2,10 @@ module TestCentricity
|
|
2
2
|
class List < UIElement
|
3
3
|
attr_accessor :list_item
|
4
4
|
|
5
|
-
def initialize(parent, locator, context)
|
6
|
-
|
7
|
-
@
|
8
|
-
|
9
|
-
@type = :list
|
10
|
-
@alt_locator = nil
|
11
|
-
list_spec = { :list_item => 'li' }
|
12
|
-
define_list_elements(list_spec)
|
5
|
+
def initialize(name, parent, locator, context)
|
6
|
+
super
|
7
|
+
@type = :list
|
8
|
+
define_list_elements({ :list_item => 'li' })
|
13
9
|
end
|
14
10
|
|
15
11
|
def define_list_elements(element_spec)
|
@@ -37,8 +33,8 @@ module TestCentricity
|
|
37
33
|
def verify_list_items(expected, enqueue = false)
|
38
34
|
actual = get_list_items
|
39
35
|
enqueue ?
|
40
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list
|
41
|
-
assert_equal(expected, actual, "Expected list #{
|
36
|
+
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list object '#{get_name}' (#{get_locator})") :
|
37
|
+
assert_equal(expected, actual, "Expected list object '#{get_name}' (#{get_locator}) to be #{expected} but found #{actual}")
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
@@ -2,13 +2,14 @@ module TestCentricity
|
|
2
2
|
class Radio < UIElement
|
3
3
|
attr_accessor :proxy
|
4
4
|
|
5
|
-
def initialize(parent, locator, context, proxy = nil)
|
5
|
+
def initialize(name, parent, locator, context, proxy = nil)
|
6
|
+
@name = name
|
6
7
|
@parent = parent
|
7
8
|
@locator = locator
|
8
9
|
@context = context
|
10
|
+
@alt_locator = nil
|
9
11
|
@proxy = proxy
|
10
12
|
@type = :radio
|
11
|
-
@alt_locator = nil
|
12
13
|
end
|
13
14
|
|
14
15
|
# Does radio button object exists?
|
@@ -3,12 +3,9 @@ module TestCentricity
|
|
3
3
|
attr_accessor :list_item
|
4
4
|
attr_accessor :selected_item
|
5
5
|
|
6
|
-
def initialize(parent, locator, context)
|
7
|
-
|
8
|
-
@
|
9
|
-
@context = context
|
10
|
-
@type = :selectlist
|
11
|
-
@alt_locator = nil
|
6
|
+
def initialize(name, parent, locator, context)
|
7
|
+
super
|
8
|
+
@type = :selectlist
|
12
9
|
list_spec = {
|
13
10
|
:list_item => 'option',
|
14
11
|
:selected_item => 'option[selected]'
|
@@ -104,8 +101,8 @@ module TestCentricity
|
|
104
101
|
def verify_options(expected, enqueue = false)
|
105
102
|
actual = get_options
|
106
103
|
enqueue ?
|
107
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{
|
108
|
-
assert_equal(expected, actual, "Expected list of options in list #{
|
104
|
+
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list object '#{get_name}' (#{get_locator})") :
|
105
|
+
assert_equal(expected, actual, "Expected list of options in list object '#{get_name}' (#{get_locator}) to be #{expected} but found #{actual}")
|
109
106
|
end
|
110
107
|
|
111
108
|
# Return text of first selected option in a select box object.
|
@@ -10,12 +10,9 @@ module TestCentricity
|
|
10
10
|
attr_accessor :tree_expand
|
11
11
|
attr_accessor :tree_collapse
|
12
12
|
|
13
|
-
def initialize(parent, locator, context)
|
14
|
-
|
15
|
-
@
|
16
|
-
@context = context
|
17
|
-
@type = :table
|
18
|
-
@alt_locator = nil
|
13
|
+
def initialize(name, parent, locator, context)
|
14
|
+
super
|
15
|
+
@type = :table
|
19
16
|
|
20
17
|
table_spec = { :table_body => 'tbody',
|
21
18
|
:table_section => nil,
|
@@ -102,9 +99,9 @@ module TestCentricity
|
|
102
99
|
#
|
103
100
|
def hover_table_cell(row, column)
|
104
101
|
row_count = get_row_count
|
105
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
102
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
106
103
|
column_count = get_column_count
|
107
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
104
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
108
105
|
set_table_cell_locator(row, column)
|
109
106
|
hover
|
110
107
|
clear_alt_locator
|
@@ -119,9 +116,9 @@ module TestCentricity
|
|
119
116
|
#
|
120
117
|
def click_table_cell(row, column)
|
121
118
|
row_count = get_row_count
|
122
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
119
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
123
120
|
column_count = get_column_count
|
124
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
121
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
125
122
|
set_table_cell_locator(row, column)
|
126
123
|
click
|
127
124
|
clear_alt_locator
|
@@ -136,9 +133,9 @@ module TestCentricity
|
|
136
133
|
#
|
137
134
|
def double_click_table_cell(row, column)
|
138
135
|
row_count = get_row_count
|
139
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
136
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
140
137
|
column_count = get_column_count
|
141
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
138
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
142
139
|
set_table_cell_locator(row, column)
|
143
140
|
double_click
|
144
141
|
clear_alt_locator
|
@@ -153,9 +150,9 @@ module TestCentricity
|
|
153
150
|
#
|
154
151
|
def click_table_cell_link(row, column)
|
155
152
|
row_count = get_row_count
|
156
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
153
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
157
154
|
column_count = get_column_count
|
158
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
155
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
159
156
|
set_table_cell_locator(row, column)
|
160
157
|
saved_locator = @alt_locator
|
161
158
|
set_alt_locator("#{@alt_locator}/a")
|
@@ -177,7 +174,7 @@ module TestCentricity
|
|
177
174
|
def get_table_row(row)
|
178
175
|
columns = []
|
179
176
|
row_count = get_row_count
|
180
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
177
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
181
178
|
column_count = get_column_count
|
182
179
|
(1..column_count).each do |column|
|
183
180
|
value = ''
|
@@ -197,7 +194,7 @@ module TestCentricity
|
|
197
194
|
|
198
195
|
def get_row_data(row)
|
199
196
|
row_count = get_row_count
|
200
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
197
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
201
198
|
(row > 1) ?
|
202
199
|
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}[#{row}]") :
|
203
200
|
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}")
|
@@ -209,7 +206,7 @@ module TestCentricity
|
|
209
206
|
def get_table_column(column)
|
210
207
|
rows = []
|
211
208
|
column_count = get_column_count
|
212
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
209
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
213
210
|
row_count = get_row_count
|
214
211
|
(1..row_count).each do |row|
|
215
212
|
value = ''
|
@@ -237,9 +234,9 @@ module TestCentricity
|
|
237
234
|
#
|
238
235
|
def get_table_cell(row, column)
|
239
236
|
row_count = get_row_count
|
240
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
237
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
241
238
|
column_count = get_column_count
|
242
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
239
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
243
240
|
set_table_cell_locator(row, column)
|
244
241
|
saved_locator = @alt_locator
|
245
242
|
set_alt_locator("#{saved_locator}/input")
|
@@ -260,8 +257,8 @@ module TestCentricity
|
|
260
257
|
def verify_table_cell(row, column, expected, enqueue = false)
|
261
258
|
actual = get_table_cell(row, column)
|
262
259
|
enqueue ?
|
263
|
-
ExceptionQueue.enqueue_assert_equal(expected.strip, actual.strip, "Expected #{
|
264
|
-
assert_equal(expected.strip, actual.strip, "Expected #{
|
260
|
+
ExceptionQueue.enqueue_assert_equal(expected.strip, actual.strip, "Expected table object '#{get_name}' (#{get_locator}) row #{row}/column #{column}") :
|
261
|
+
assert_equal(expected.strip, actual.strip, "Expected table object '#{get_name}' (#{get_locator}) row #{row}/column #{column} to display '#{expected}' but found '#{actual}'")
|
265
262
|
end
|
266
263
|
|
267
264
|
# Set the value of the specified cell in a table object.
|
@@ -274,7 +271,7 @@ module TestCentricity
|
|
274
271
|
#
|
275
272
|
def set_table_cell(row, column, value)
|
276
273
|
row_count = get_row_count
|
277
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
274
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
278
275
|
find_table_cell(row, column)
|
279
276
|
find_table_cell(row, column) unless exists?
|
280
277
|
set(value)
|
@@ -283,9 +280,9 @@ module TestCentricity
|
|
283
280
|
|
284
281
|
def get_cell_attribute(row, column, attrib)
|
285
282
|
row_count = get_row_count
|
286
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
283
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
287
284
|
column_count = get_column_count
|
288
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
285
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
289
286
|
set_table_cell_locator(row, column)
|
290
287
|
result = get_native_attribute(attrib)
|
291
288
|
clear_alt_locator
|
@@ -294,7 +291,7 @@ module TestCentricity
|
|
294
291
|
|
295
292
|
def get_row_attribute(row, attrib)
|
296
293
|
row_count = get_row_count
|
297
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
294
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
298
295
|
(row > 1) ?
|
299
296
|
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}[#{row}]") :
|
300
297
|
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}")
|
@@ -378,7 +375,7 @@ module TestCentricity
|
|
378
375
|
#
|
379
376
|
def click_header_column(column)
|
380
377
|
column_count = get_column_count
|
381
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table header #{
|
378
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table header object '#{get_name}' (#{get_locator})" if column > column_count
|
382
379
|
set_alt_locator("#{@locator}//#{@table_header}/#{@header_row}/#{@header_column}[#{column}]")
|
383
380
|
click if exists?
|
384
381
|
clear_alt_locator
|
@@ -386,7 +383,7 @@ module TestCentricity
|
|
386
383
|
|
387
384
|
def get_header_column(column)
|
388
385
|
column_count = get_column_count
|
389
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table header #{
|
386
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table header object '#{get_name}' (#{get_locator})" if column > column_count
|
390
387
|
set_alt_locator("#{@locator}//#{@table_header}/#{@header_row}/#{@header_column}[#{column}]")
|
391
388
|
value = get_value(:all) if exists?(:all)
|
392
389
|
clear_alt_locator
|
@@ -406,9 +403,9 @@ module TestCentricity
|
|
406
403
|
|
407
404
|
def is_table_row_expanded?(row, column)
|
408
405
|
row_count = get_row_count
|
409
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{
|
406
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table object '#{get_name}' (#{get_locator})" if row > row_count
|
410
407
|
column_count = get_column_count
|
411
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
408
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
412
409
|
set_table_cell_locator(row, column)
|
413
410
|
set_alt_locator("#{@alt_locator}/#{@tree_expand}")
|
414
411
|
expanded = true
|
@@ -438,7 +435,7 @@ module TestCentricity
|
|
438
435
|
def expand_all_table_rows(column)
|
439
436
|
row_count = get_row_count
|
440
437
|
column_count = get_column_count
|
441
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{
|
438
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table object '#{get_name}' (#{get_locator})" if column > column_count
|
442
439
|
row_count.downto(1) do |row|
|
443
440
|
expand_table_row(row, column)
|
444
441
|
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class TextField < UIElement
|
3
|
-
def initialize(parent, locator, context)
|
4
|
-
|
5
|
-
@
|
6
|
-
@context = context
|
7
|
-
@type = :textfield
|
8
|
-
@alt_locator = nil
|
3
|
+
def initialize(name, parent, locator, context)
|
4
|
+
super
|
5
|
+
@type = :textfield
|
9
6
|
end
|
10
7
|
|
11
8
|
# Is text field set to read-only?
|
@@ -28,7 +28,7 @@ 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(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page);end))
|
31
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new("#{element_name}", self, "#{locator}", :page);end))
|
32
32
|
end
|
33
33
|
|
34
34
|
# Declare and instantiate a collection of generic UI Elements for this page object.
|
@@ -54,7 +54,7 @@ module TestCentricity
|
|
54
54
|
# button :login_button, "//input[@id='submit_button']"
|
55
55
|
#
|
56
56
|
def self.button(element_name, locator)
|
57
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Button.new(self, "#{locator}", :page);end))
|
57
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Button.new("#{element_name}", self, "#{locator}", :page);end))
|
58
58
|
end
|
59
59
|
|
60
60
|
# Declare and instantiate a collection of buttons for this page object.
|
@@ -80,7 +80,7 @@ module TestCentricity
|
|
80
80
|
# textfield :password_field, 'consumer_password'
|
81
81
|
#
|
82
82
|
def self.textfield(element_name, locator)
|
83
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new(self, "#{locator}", :page);end))
|
83
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new("#{element_name}", self, "#{locator}", :page);end))
|
84
84
|
end
|
85
85
|
|
86
86
|
# Declare and instantiate a collection of text fields for this page object.
|
@@ -109,7 +109,7 @@ module TestCentricity
|
|
109
109
|
# checkbox :accept_terms_checkbox, 'input#accept_terms_conditions', :accept_terms_label
|
110
110
|
#
|
111
111
|
def self.checkbox(element_name, locator, proxy = nil)
|
112
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :page, #{proxy});end))
|
112
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new("#{element_name}", self, "#{locator}", :page, #{proxy});end))
|
113
113
|
end
|
114
114
|
|
115
115
|
# Declare and instantiate a collection of checkboxes for this page object.
|
@@ -137,7 +137,7 @@ module TestCentricity
|
|
137
137
|
# radio :decline_terms_radio, '#decline_terms_conditions', :decline_terms_label
|
138
138
|
#
|
139
139
|
def self.radio(element_name, locator, proxy = nil)
|
140
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new(self, "#{locator}", :page, #{proxy});end))
|
140
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new("#{element_name}", self, "#{locator}", :page, #{proxy});end))
|
141
141
|
end
|
142
142
|
|
143
143
|
# Declare and instantiate a collection of radio buttons for this page object.
|
@@ -164,7 +164,7 @@ module TestCentricity
|
|
164
164
|
# label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
|
165
165
|
#
|
166
166
|
def self.label(element_name, locator)
|
167
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Label.new(self, "#{locator}", :page);end))
|
167
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Label.new("#{element_name}", self, "#{locator}", :page);end))
|
168
168
|
end
|
169
169
|
|
170
170
|
def self.labels(element_hash)
|
@@ -182,7 +182,7 @@ module TestCentricity
|
|
182
182
|
# link :shopping_basket_link, "//a[@href='shopping_basket']"
|
183
183
|
#
|
184
184
|
def self.link(element_name, locator)
|
185
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Link.new(self, "#{locator}", :page);end))
|
185
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Link.new("#{element_name}", self, "#{locator}", :page);end))
|
186
186
|
end
|
187
187
|
|
188
188
|
def self.links(element_hash)
|
@@ -199,7 +199,7 @@ module TestCentricity
|
|
199
199
|
# table :payments_table, "//table[@class='payments_table']"
|
200
200
|
#
|
201
201
|
def self.table(element_name, locator)
|
202
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Table.new(self, "#{locator}", :page);end))
|
202
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Table.new("#{element_name}", self, "#{locator}", :page);end))
|
203
203
|
end
|
204
204
|
|
205
205
|
def self.tables(element_hash)
|
@@ -217,7 +217,7 @@ module TestCentricity
|
|
217
217
|
# selectlist :gender_select, "//select[@id='customer_gender']"
|
218
218
|
#
|
219
219
|
def self.selectlist(element_name, locator)
|
220
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::SelectList.new(self, "#{locator}", :page);end))
|
220
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::SelectList.new("#{element_name}", self, "#{locator}", :page);end))
|
221
221
|
end
|
222
222
|
|
223
223
|
def self.selectlists(element_hash)
|
@@ -234,7 +234,7 @@ module TestCentricity
|
|
234
234
|
# list :x_axis_list, 'g.x-axis'
|
235
235
|
#
|
236
236
|
def self.list(element_name, locator)
|
237
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::List.new(self, "#{locator}", :page);end))
|
237
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::List.new("#{element_name}", self, "#{locator}", :page);end))
|
238
238
|
end
|
239
239
|
|
240
240
|
def self.lists(element_hash)
|
@@ -252,7 +252,7 @@ module TestCentricity
|
|
252
252
|
# image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
|
253
253
|
#
|
254
254
|
def self.image(element_name, locator)
|
255
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new(self, "#{locator}", :page);end))
|
255
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new("#{element_name}", self, "#{locator}", :page);end))
|
256
256
|
end
|
257
257
|
|
258
258
|
def self.images(element_hash)
|
@@ -269,7 +269,7 @@ module TestCentricity
|
|
269
269
|
# filefield :attach_file, 's_SweFileName'
|
270
270
|
#
|
271
271
|
def self.filefield(element_name, locator)
|
272
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::FileField.new(self, "#{locator}", :page);end))
|
272
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :page);end))
|
273
273
|
end
|
274
274
|
|
275
275
|
# Instantiate a single PageSection object for this page object.
|
@@ -280,7 +280,7 @@ module TestCentricity
|
|
280
280
|
# section :search_form, SearchForm
|
281
281
|
#
|
282
282
|
def self.section(section_name, class_name, locator = nil)
|
283
|
-
class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new(self, "#{locator}", :page);end))
|
283
|
+
class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new("#{section_name}", self, "#{locator}", :page);end))
|
284
284
|
end
|
285
285
|
|
286
286
|
def self.sections(section_hash)
|
@@ -424,7 +424,7 @@ module TestCentricity
|
|
424
424
|
end
|
425
425
|
|
426
426
|
if state.is_a?(Hash) && state.length == 1
|
427
|
-
error_msg = "Expected #{ui_object.get_locator} #{property.to_s} property to"
|
427
|
+
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property.to_s} property to"
|
428
428
|
state.each do |key, value|
|
429
429
|
case key
|
430
430
|
when :lt, :less_than
|
@@ -456,7 +456,7 @@ module TestCentricity
|
|
456
456
|
end
|
457
457
|
end
|
458
458
|
else
|
459
|
-
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected #{ui_object.get_locator} #{property.to_s} property")
|
459
|
+
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property.to_s} property")
|
460
460
|
end
|
461
461
|
end
|
462
462
|
end
|
@@ -6,11 +6,12 @@ module TestCentricity
|
|
6
6
|
include Capybara::Node::Matchers
|
7
7
|
include Test::Unit::Assertions
|
8
8
|
|
9
|
-
attr_reader :locator, :context
|
9
|
+
attr_reader :locator, :context, :name
|
10
10
|
attr_accessor :parent
|
11
11
|
|
12
|
-
def initialize(parent, locator, context)
|
13
|
-
@
|
12
|
+
def initialize(name, parent, locator, context)
|
13
|
+
@name = name
|
14
|
+
@parent = parent
|
14
15
|
@locator = locator
|
15
16
|
@context = context
|
16
17
|
end
|
@@ -36,7 +37,7 @@ module TestCentricity
|
|
36
37
|
# element :basket_header, 'div.basket_header'
|
37
38
|
#
|
38
39
|
def self.element(element_name, locator)
|
39
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section);end))
|
40
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new("#{element_name}", self, "#{locator}", :section);end))
|
40
41
|
end
|
41
42
|
|
42
43
|
# Declare and instantiate a collection of generic UI Elements for this page section.
|
@@ -62,7 +63,7 @@ module TestCentricity
|
|
62
63
|
# button :login_button, "//input[@id='submit_button']"
|
63
64
|
#
|
64
65
|
def self.button(element_name, locator)
|
65
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Button.new(self, "#{locator}", :section);end))
|
66
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Button.new("#{element_name}", self, "#{locator}", :section);end))
|
66
67
|
end
|
67
68
|
|
68
69
|
# Declare and instantiate a collection of buttons for this page section.
|
@@ -88,7 +89,7 @@ module TestCentricity
|
|
88
89
|
# textfield :password_field, 'input#consumer_password'
|
89
90
|
#
|
90
91
|
def self.textfield(element_name, locator)
|
91
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new(self, "#{locator}", :section);end))
|
92
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new("#{element_name}", self, "#{locator}", :section);end))
|
92
93
|
end
|
93
94
|
|
94
95
|
# Declare and instantiate a collection of text fields for this page section.
|
@@ -117,7 +118,7 @@ module TestCentricity
|
|
117
118
|
# checkbox :accept_terms_checkbox, 'input#accept_terms_conditions', :accept_terms_label
|
118
119
|
#
|
119
120
|
def self.checkbox(element_name, locator, proxy = nil)
|
120
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :section, #{proxy});end))
|
121
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
|
121
122
|
end
|
122
123
|
|
123
124
|
# Declare and instantiate a collection of checkboxes for this page section.
|
@@ -145,7 +146,7 @@ module TestCentricity
|
|
145
146
|
# radio :decline_terms_radio, 'input#decline_terms_conditions', :decline_terms_label
|
146
147
|
#
|
147
148
|
def self.radio(element_name, locator, proxy = nil)
|
148
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new(self, "#{locator}", :section, #{proxy});end))
|
149
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
|
149
150
|
end
|
150
151
|
|
151
152
|
# Declare and instantiate a collection of radio buttons for this page section.
|
@@ -172,7 +173,7 @@ module TestCentricity
|
|
172
173
|
# label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
|
173
174
|
#
|
174
175
|
def self.label(element_name, locator)
|
175
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Label.new(self, "#{locator}", :section);end))
|
176
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Label.new("#{element_name}", self, "#{locator}", :section);end))
|
176
177
|
end
|
177
178
|
|
178
179
|
def self.labels(element_hash)
|
@@ -190,7 +191,7 @@ module TestCentricity
|
|
190
191
|
# link :shopping_basket_link, "//a[@href='shopping_basket']"
|
191
192
|
#
|
192
193
|
def self.link(element_name, locator)
|
193
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Link.new(self, "#{locator}", :section);end))
|
194
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Link.new("#{element_name}", self, "#{locator}", :section);end))
|
194
195
|
end
|
195
196
|
|
196
197
|
def self.links(element_hash)
|
@@ -207,7 +208,7 @@ module TestCentricity
|
|
207
208
|
# table :payments_table, "//table[@class='payments_table']"
|
208
209
|
#
|
209
210
|
def self.table(element_name, locator)
|
210
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Table.new(self, "#{locator}", :section);end))
|
211
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Table.new("#{element_name}", self, "#{locator}", :section);end))
|
211
212
|
end
|
212
213
|
|
213
214
|
def self.tables(element_hash)
|
@@ -225,7 +226,7 @@ module TestCentricity
|
|
225
226
|
# selectlist :gender_select, "//select[@id='customer_gender']"
|
226
227
|
#
|
227
228
|
def self.selectlist(element_name, locator)
|
228
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::SelectList.new(self, "#{locator}", :section);end))
|
229
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::SelectList.new("#{element_name}", self, "#{locator}", :section);end))
|
229
230
|
end
|
230
231
|
|
231
232
|
def self.selectlists(element_hash)
|
@@ -242,7 +243,7 @@ module TestCentricity
|
|
242
243
|
# list :y_axis_list, 'g.y_axis'
|
243
244
|
#
|
244
245
|
def self.list(element_name, locator)
|
245
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::List.new(self, "#{locator}", :section);end))
|
246
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::List.new("#{element_name}", self, "#{locator}", :section);end))
|
246
247
|
end
|
247
248
|
|
248
249
|
def self.lists(element_hash)
|
@@ -260,7 +261,7 @@ module TestCentricity
|
|
260
261
|
# image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
|
261
262
|
#
|
262
263
|
def self.image(element_name, locator)
|
263
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new(self, "#{locator}", :section);end))
|
264
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new("#{element_name}", self, "#{locator}", :section);end))
|
264
265
|
end
|
265
266
|
|
266
267
|
def self.images(element_hash)
|
@@ -277,7 +278,7 @@ module TestCentricity
|
|
277
278
|
# filefield :attach_file, 's_SweFileName'
|
278
279
|
#
|
279
280
|
def self.filefield(element_name, locator)
|
280
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::FileField.new(self, "#{locator}", :section);end))
|
281
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :section);end))
|
281
282
|
end
|
282
283
|
|
283
284
|
# Instantiate a single PageSection object within this PageSection object.
|
@@ -288,7 +289,7 @@ module TestCentricity
|
|
288
289
|
# section :search_form, SearchForm
|
289
290
|
#
|
290
291
|
def self.section(section_name, class_name, locator = nil)
|
291
|
-
class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new(self, "#{locator}", :section);end))
|
292
|
+
class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new("#{section_name}", self, "#{locator}", :section);end))
|
292
293
|
end
|
293
294
|
|
294
295
|
def self.sections(section_hash)
|
@@ -302,6 +303,10 @@ module TestCentricity
|
|
302
303
|
(@context == :section && !@parent.nil? && !@parent.get_locator.nil?) ? "#{@parent.get_locator}|#{locator}" : locator
|
303
304
|
end
|
304
305
|
|
306
|
+
def get_name
|
307
|
+
@name
|
308
|
+
end
|
309
|
+
|
305
310
|
def set_parent(parent)
|
306
311
|
@parent = parent
|
307
312
|
end
|
@@ -375,7 +380,7 @@ module TestCentricity
|
|
375
380
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
376
381
|
wait.until { exists? }
|
377
382
|
rescue
|
378
|
-
raise "Could not find
|
383
|
+
raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless exists?
|
379
384
|
end
|
380
385
|
|
381
386
|
# Wait until the Section object no longer exists, or until the specified wait time has expired.
|
@@ -389,7 +394,7 @@ module TestCentricity
|
|
389
394
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
390
395
|
wait.until { !exists? }
|
391
396
|
rescue
|
392
|
-
raise "Section #{get_locator} remained visible after #{timeout} seconds" if exists?
|
397
|
+
raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if exists?
|
393
398
|
end
|
394
399
|
|
395
400
|
# Wait until the Section object is visible, or until the specified wait time has expired.
|
@@ -403,7 +408,7 @@ module TestCentricity
|
|
403
408
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
404
409
|
wait.until { visible? }
|
405
410
|
rescue
|
406
|
-
raise "Could not find
|
411
|
+
raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless visible?
|
407
412
|
end
|
408
413
|
|
409
414
|
# Wait until the Section object is hidden, or until the specified wait time has expired.
|
@@ -417,7 +422,7 @@ module TestCentricity
|
|
417
422
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
418
423
|
wait.until { hidden? }
|
419
424
|
rescue
|
420
|
-
raise "
|
425
|
+
raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if visible?
|
421
426
|
end
|
422
427
|
|
423
428
|
# Click at a specific location within a Section object
|
@@ -429,7 +434,7 @@ module TestCentricity
|
|
429
434
|
#
|
430
435
|
def click_at(x, y)
|
431
436
|
section, _ = find_section
|
432
|
-
raise "Section #{get_locator} not found" unless section
|
437
|
+
raise "Section object '#{get_name}' (#{get_locator}) not found" unless section
|
433
438
|
section.click_at(x, y)
|
434
439
|
end
|
435
440
|
|
@@ -490,7 +495,7 @@ module TestCentricity
|
|
490
495
|
end
|
491
496
|
|
492
497
|
if state.is_a?(Hash) && state.length == 1
|
493
|
-
error_msg = "Expected #{ui_object.get_locator} #{property.to_s} property to"
|
498
|
+
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property.to_s} property to"
|
494
499
|
state.each do |key, value|
|
495
500
|
case key
|
496
501
|
when :lt, :less_than
|
@@ -522,7 +527,7 @@ module TestCentricity
|
|
522
527
|
end
|
523
528
|
end
|
524
529
|
else
|
525
|
-
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected #{ui_object.get_locator} #{property.to_s} property")
|
530
|
+
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property.to_s} property")
|
526
531
|
end
|
527
532
|
end
|
528
533
|
end
|
@@ -573,13 +578,13 @@ module TestCentricity
|
|
573
578
|
|
574
579
|
def get_attribute(attrib)
|
575
580
|
section, _ = find_section
|
576
|
-
raise "Section #{
|
581
|
+
raise "Section object '#{get_name}' (#{get_locator}) not found" unless section
|
577
582
|
section[attrib]
|
578
583
|
end
|
579
584
|
|
580
585
|
def get_native_attribute(attrib)
|
581
586
|
section, _ = find_section
|
582
|
-
raise "Section #{
|
587
|
+
raise "Section object '#{get_name}' (#{get_locator}) not found" unless section
|
583
588
|
section.native.attribute(attrib)
|
584
589
|
end
|
585
590
|
|
@@ -22,14 +22,15 @@ module TestCentricity
|
|
22
22
|
include Capybara::DSL
|
23
23
|
include Test::Unit::Assertions
|
24
24
|
|
25
|
-
attr_reader
|
25
|
+
attr_reader :parent, :locator, :context, :type, :name
|
26
26
|
attr_accessor :alt_locator
|
27
27
|
|
28
|
-
def initialize(parent, locator, context)
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@
|
28
|
+
def initialize(name, parent, locator, context)
|
29
|
+
@name = name
|
30
|
+
@parent = parent
|
31
|
+
@locator = locator
|
32
|
+
@context = context
|
33
|
+
@type = nil
|
33
34
|
@alt_locator = nil
|
34
35
|
end
|
35
36
|
|
@@ -47,6 +48,10 @@ module TestCentricity
|
|
47
48
|
@locator
|
48
49
|
end
|
49
50
|
|
51
|
+
def get_name
|
52
|
+
@name
|
53
|
+
end
|
54
|
+
|
50
55
|
def set_alt_locator(temp_locator)
|
51
56
|
@alt_locator = temp_locator
|
52
57
|
end
|
@@ -101,7 +106,7 @@ module TestCentricity
|
|
101
106
|
#
|
102
107
|
def click_at(x, y)
|
103
108
|
obj, _ = find_element
|
104
|
-
raise "
|
109
|
+
raise "UI object '#{get_name}' (#{get_locator}) not found" unless obj
|
105
110
|
obj.click_at(x, y)
|
106
111
|
end
|
107
112
|
|
@@ -205,7 +210,7 @@ module TestCentricity
|
|
205
210
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
206
211
|
wait.until { exists? }
|
207
212
|
rescue
|
208
|
-
raise "Could not find
|
213
|
+
raise "Could not find UI object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless exists?
|
209
214
|
end
|
210
215
|
|
211
216
|
# Wait until the object no longer exists, or until the specified wait time has expired.
|
@@ -219,7 +224,7 @@ module TestCentricity
|
|
219
224
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
220
225
|
wait.until { !exists? }
|
221
226
|
rescue
|
222
|
-
raise "
|
227
|
+
raise "UI object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if exists?
|
223
228
|
end
|
224
229
|
|
225
230
|
# Wait until the object is visible, or until the specified wait time has expired.
|
@@ -233,7 +238,7 @@ module TestCentricity
|
|
233
238
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
234
239
|
wait.until { visible? }
|
235
240
|
rescue
|
236
|
-
raise "Could not find
|
241
|
+
raise "Could not find UI object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless visible?
|
237
242
|
end
|
238
243
|
|
239
244
|
# Wait until the object is hidden, or until the specified wait time has expired.
|
@@ -247,7 +252,7 @@ module TestCentricity
|
|
247
252
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
248
253
|
wait.until { hidden? }
|
249
254
|
rescue
|
250
|
-
raise "
|
255
|
+
raise "UI object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if visible?
|
251
256
|
end
|
252
257
|
|
253
258
|
# Wait until the object's value equals the specified value, or until the specified wait time has expired.
|
@@ -261,7 +266,7 @@ module TestCentricity
|
|
261
266
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
262
267
|
wait.until { get_value == value }
|
263
268
|
rescue
|
264
|
-
raise "Value of UI
|
269
|
+
raise "Value of UI object '#{get_name}' (#{get_locator}) failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
|
265
270
|
end
|
266
271
|
|
267
272
|
# Wait until the object's value changes to a different value, or until the specified wait time has expired.
|
@@ -276,7 +281,7 @@ module TestCentricity
|
|
276
281
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
277
282
|
wait.until { get_value != value }
|
278
283
|
rescue
|
279
|
-
raise "Value of UI
|
284
|
+
raise "Value of UI object '#{get_name}' (#{get_locator}) failed to change from '#{value}' after #{timeout} seconds" if get_value == value
|
280
285
|
end
|
281
286
|
|
282
287
|
def get_value(visible = true)
|
@@ -295,8 +300,8 @@ module TestCentricity
|
|
295
300
|
def verify_value(expected, enqueue = false)
|
296
301
|
actual = get_value
|
297
302
|
enqueue ?
|
298
|
-
ExceptionQueue.enqueue_assert_equal(expected.strip, actual.strip, "Expected #{
|
299
|
-
assert_equal(expected.strip, actual.strip, "Expected #{
|
303
|
+
ExceptionQueue.enqueue_assert_equal(expected.strip, actual.strip, "Expected UI object '#{get_name}' (#{get_locator})") :
|
304
|
+
assert_equal(expected.strip, actual.strip, "Expected UI object '#{get_name}' (#{get_locator}) to display '#{expected}' but found '#{actual}'")
|
300
305
|
end
|
301
306
|
|
302
307
|
alias :verify_caption :verify_value
|
@@ -387,7 +392,7 @@ module TestCentricity
|
|
387
392
|
def object_not_found_exception(obj, obj_type)
|
388
393
|
@alt_locator.nil? ? locator = @locator : locator = @alt_locator
|
389
394
|
obj_type.nil? ? object_type = "Object" : object_type = obj_type
|
390
|
-
raise "#{object_type} #{locator} not found" unless obj
|
395
|
+
raise "#{object_type} named '#{@name}' (#{locator}) not found" unless obj
|
391
396
|
end
|
392
397
|
|
393
398
|
def invalid_object_type_exception(obj, obj_type)
|
@@ -45,7 +45,9 @@ module TestCentricity
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# set browser window size only if testing with a desktop web browser
|
48
|
-
|
48
|
+
unless Environ.is_device? || Capybara.current_driver == :poltergeist
|
49
|
+
initialize_browser_size
|
50
|
+
end
|
49
51
|
|
50
52
|
puts "Using #{Environ.browser.to_s} browser via #{context}"
|
51
53
|
end
|
@@ -185,6 +187,7 @@ module TestCentricity
|
|
185
187
|
elsif ENV['CB_PLATFORM']
|
186
188
|
capabilities['os_api_name'] = ENV['CB_PLATFORM']
|
187
189
|
Environ.set_device_type(ENV['CB_PLATFORM'])
|
190
|
+
Environ.set_device(true)
|
188
191
|
Environ.set_platform(:mobile)
|
189
192
|
end
|
190
193
|
Capybara::Selenium::Driver.new(app, :browser => :remote, :url => endpoint, :desired_capabilities => capabilities)
|
@@ -284,6 +287,7 @@ module TestCentricity
|
|
284
287
|
capabilities['platformName'] = ENV['TB_PLATFORM']
|
285
288
|
capabilities['deviceName'] = ENV['TB_DEVICE']
|
286
289
|
Environ.set_device_type(ENV['TB_DEVICE'])
|
290
|
+
Environ.set_device(true)
|
287
291
|
Environ.set_platform(:mobile)
|
288
292
|
else
|
289
293
|
Environ.set_platform(:desktop)
|
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: 1.0.
|
4
|
+
version: 1.0.11
|
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: 2016-10-
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|