testcentricity_web 3.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/Gemfile.lock +9 -7
  4. data/README.md +44 -12
  5. data/lib/testcentricity_web.rb +0 -10
  6. data/lib/testcentricity_web/browser_helper.rb +21 -13
  7. data/lib/testcentricity_web/data_objects/data_objects_helper.rb +5 -5
  8. data/lib/testcentricity_web/version.rb +1 -1
  9. data/lib/testcentricity_web/web_core/page_object.rb +1 -93
  10. data/lib/testcentricity_web/web_core/page_objects_helper.rb +1 -7
  11. data/lib/testcentricity_web/web_core/page_section.rb +0 -91
  12. data/lib/testcentricity_web/web_core/webdriver_helper.rb +89 -31
  13. data/lib/testcentricity_web/web_elements/checkbox.rb +1 -15
  14. data/lib/testcentricity_web/web_elements/file_field.rb +1 -1
  15. data/lib/testcentricity_web/web_elements/radio.rb +1 -1
  16. data/lib/testcentricity_web/web_elements/select_list.rb +0 -52
  17. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +5 -14
  18. metadata +2 -12
  19. data/lib/testcentricity_web/web_elements/cell_button.rb +0 -8
  20. data/lib/testcentricity_web/web_elements/cell_checkbox.rb +0 -38
  21. data/lib/testcentricity_web/web_elements/cell_element.rb +0 -69
  22. data/lib/testcentricity_web/web_elements/cell_image.rb +0 -8
  23. data/lib/testcentricity_web/web_elements/cell_radio.rb +0 -31
  24. data/lib/testcentricity_web/web_elements/list_button.rb +0 -8
  25. data/lib/testcentricity_web/web_elements/list_checkbox.rb +0 -38
  26. data/lib/testcentricity_web/web_elements/list_element.rb +0 -61
  27. data/lib/testcentricity_web/web_elements/list_radio.rb +0 -31
  28. data/lib/testcentricity_web/web_elements/siebel_open_ui_helper.rb +0 -15
@@ -12,7 +12,7 @@ module TestCentricity
12
12
  end
13
13
 
14
14
  def file_upload(file_path)
15
- obj, = find_element(false)
15
+ obj, = find_element(visible = false)
16
16
  obj.send_keys(file_path)
17
17
  end
18
18
 
@@ -101,7 +101,7 @@ module TestCentricity
101
101
  # accept_terms_radio.unselect
102
102
  #
103
103
  def unselect
104
- set_selected_state(false)
104
+ set_selected_state(state = false)
105
105
  end
106
106
 
107
107
  # Highlight a radio button with a 3 pixel wide, red dashed border for the specified wait time.
@@ -258,58 +258,6 @@ module TestCentricity
258
258
 
259
259
  alias selected? get_selected_option
260
260
 
261
- # Select the specified option in a Siebel OUI select box object.
262
- #
263
- # @param option [String] text of option to select
264
- # @example
265
- # country_select.choose_siebel_option('Cayman Islands')
266
- #
267
- def choose_siebel_option(option)
268
- Capybara.wait_on_first_by_default = true
269
- invoke_siebel_popup
270
- first(:xpath, "//li[@class='ui-menu-item']", exact: true, match: :prefer_exact, text: option).click
271
- end
272
-
273
- # Return array of strings of all options in a Siebel OUI select box object.
274
- #
275
- # @return [Array]
276
- # @example
277
- # all_countries = country_select.get_siebel_options
278
- #
279
- def get_siebel_options
280
- invoke_siebel_popup
281
- sleep(0.5)
282
- options = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
283
- @base_object, = find_element
284
- @base_object.native.send_keys(:escape)
285
- options
286
- end
287
-
288
- def verify_siebel_options(expected, enqueue = false)
289
- invoke_siebel_popup
290
- sleep(0.5)
291
- actual = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
292
- if enqueue
293
- ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}")
294
- else
295
- assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
296
- end
297
- @base_object, = find_element
298
- @base_object.native.send_keys(:escape)
299
- end
300
-
301
- # Is Siebel JComboBox set to read-only?
302
- #
303
- # @return [Boolean]
304
- # @example
305
- # country_select.read_only?
306
- #
307
- def read_only?
308
- @base_object, = find_element
309
- object_not_found_exception(@base_object, nil)
310
- !@base_object.native.attribute('readonly')
311
- end
312
-
313
261
  private
314
262
 
315
263
  def select_item(obj, option)
@@ -441,7 +441,7 @@ module TestCentricity
441
441
  # button_width = my_button.width
442
442
  #
443
443
  def width
444
- obj, type = find_element(false)
444
+ obj, type = find_element(visible = false)
445
445
  object_not_found_exception(obj, type)
446
446
  obj.get_width
447
447
  end
@@ -453,7 +453,7 @@ module TestCentricity
453
453
  # button_height = my_button.height
454
454
  #
455
455
  def height
456
- obj, type = find_element(false)
456
+ obj, type = find_element(visible = false)
457
457
  object_not_found_exception(obj, type)
458
458
  obj.get_height
459
459
  end
@@ -465,7 +465,7 @@ module TestCentricity
465
465
  # button_x = my_button.x
466
466
  #
467
467
  def x
468
- obj, type = find_element(false)
468
+ obj, type = find_element(visible = false)
469
469
  object_not_found_exception(obj, type)
470
470
  obj.get_x
471
471
  end
@@ -477,7 +477,7 @@ module TestCentricity
477
477
  # button_y = my_button.y
478
478
  #
479
479
  def y
480
- obj, type = find_element(false)
480
+ obj, type = find_element(visible = false)
481
481
  object_not_found_exception(obj, type)
482
482
  obj.get_y
483
483
  end
@@ -499,7 +499,7 @@ module TestCentricity
499
499
  # basket_link.displayed??
500
500
  #
501
501
  def displayed?
502
- obj, type = find_element(false)
502
+ obj, type = find_element(visible = false)
503
503
  object_not_found_exception(obj, type)
504
504
  obj.displayed?
505
505
  end
@@ -1032,15 +1032,6 @@ module TestCentricity
1032
1032
  end
1033
1033
  end
1034
1034
 
1035
- def invoke_siebel_popup
1036
- obj, = find_element
1037
- object_not_found_exception(obj, 'Siebel object')
1038
- trigger_name = obj.native.attribute('aria-describedby').strip
1039
- trigger = "span##{trigger_name}"
1040
- trigger = "#{@parent.get_locator} #{trigger}" if @context == :section && !@parent.get_locator.nil?
1041
- first(trigger).click
1042
- end
1043
-
1044
1035
  def object_ref_message
1045
1036
  "object '#{get_name}' (#{get_locator})"
1046
1037
  end
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.3.0
4
+ version: 4.0.0
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: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -274,26 +274,16 @@ files:
274
274
  - lib/testcentricity_web/web_core/webdriver_helper.rb
275
275
  - lib/testcentricity_web/web_elements/audio.rb
276
276
  - lib/testcentricity_web/web_elements/button.rb
277
- - lib/testcentricity_web/web_elements/cell_button.rb
278
- - lib/testcentricity_web/web_elements/cell_checkbox.rb
279
- - lib/testcentricity_web/web_elements/cell_element.rb
280
- - lib/testcentricity_web/web_elements/cell_image.rb
281
- - lib/testcentricity_web/web_elements/cell_radio.rb
282
277
  - lib/testcentricity_web/web_elements/checkbox.rb
283
278
  - lib/testcentricity_web/web_elements/file_field.rb
284
279
  - lib/testcentricity_web/web_elements/image.rb
285
280
  - lib/testcentricity_web/web_elements/label.rb
286
281
  - lib/testcentricity_web/web_elements/link.rb
287
282
  - lib/testcentricity_web/web_elements/list.rb
288
- - lib/testcentricity_web/web_elements/list_button.rb
289
- - lib/testcentricity_web/web_elements/list_checkbox.rb
290
- - lib/testcentricity_web/web_elements/list_element.rb
291
- - lib/testcentricity_web/web_elements/list_radio.rb
292
283
  - lib/testcentricity_web/web_elements/media.rb
293
284
  - lib/testcentricity_web/web_elements/radio.rb
294
285
  - lib/testcentricity_web/web_elements/range.rb
295
286
  - lib/testcentricity_web/web_elements/select_list.rb
296
- - lib/testcentricity_web/web_elements/siebel_open_ui_helper.rb
297
287
  - lib/testcentricity_web/web_elements/table.rb
298
288
  - lib/testcentricity_web/web_elements/textfield.rb
299
289
  - lib/testcentricity_web/web_elements/ui_elements_helper.rb
@@ -1,8 +0,0 @@
1
- module TestCentricity
2
- class CellButton < CellElement
3
- def initialize(name, parent, locator, context, table, column, proxy = nil)
4
- super
5
- @type = :cell_button
6
- end
7
- end
8
- end
@@ -1,38 +0,0 @@
1
- module TestCentricity
2
- class CellCheckBox < CellElement
3
- attr_accessor :proxy
4
-
5
- def initialize(name, parent, locator, context, table, column, proxy = nil)
6
- super
7
- @type = :cell_checkbox
8
- @proxy = proxy
9
- end
10
-
11
- def checked?(row)
12
- obj, = find_cell_element(row)
13
- cell_object_not_found_exception(obj, 'Cell CheckBox', row)
14
- obj.checked?
15
- end
16
-
17
- def set_checkbox_state(row, state)
18
- obj, = find_cell_element(row)
19
- cell_object_not_found_exception(obj, 'Cell CheckBox', row)
20
- obj.set(state)
21
- end
22
-
23
- def check(row)
24
- set_checkbox_state(row, true)
25
- end
26
-
27
- def uncheck(row)
28
- set_checkbox_state(row, false)
29
- end
30
-
31
- def verify_check_state(row, state, enqueue = false)
32
- actual = checked?(row)
33
- enqueue ?
34
- ExceptionQueue.enqueue_assert_equal(state, actual, "Expected Row #{row}/Col #{@column} Cell Checkbox #{object_ref_message}") :
35
- assert_equal(state, actual, "Expected Row #{row}/Col #{@column} Cell Checkbox #{object_ref_message} to be #{state} but found #{actual} instead")
36
- end
37
- end
38
- end
@@ -1,69 +0,0 @@
1
- module TestCentricity
2
- class CellElement < UIElement
3
- attr_accessor :table
4
- attr_accessor :column
5
- attr_accessor :element_locator
6
-
7
- def initialize(name, parent, locator, context, table, column, proxy = nil)
8
- @name = name
9
- @parent = parent
10
- @context = context
11
- @alt_locator = nil
12
- @table = table
13
- @column = column
14
- @element_locator = locator
15
-
16
- set_locator_type(@table.get_locator)
17
- set_column(column)
18
- end
19
-
20
- def set_column(column)
21
- @column = column
22
- @locator = case @locator_type
23
- when :xpath
24
- "#{@table.get_table_cell_locator('ROW_SPEC', @column)}/#{@element_locator}"
25
- when :css
26
- "#{@table.get_table_cell_locator('ROW_SPEC', @column)} > #{@element_locator}"
27
- end
28
- end
29
-
30
- def exists?(row)
31
- obj, = find_cell_element(row)
32
- obj != nil
33
- end
34
-
35
- def click(row)
36
- obj, = find_cell_element(row)
37
- cell_object_not_found_exception(obj, @type, row)
38
- obj.click
39
- end
40
-
41
- def get_native_attribute(row, attrib)
42
- obj, = find_cell_element(row)
43
- cell_object_not_found_exception(obj, @type, row)
44
- obj.get_native_attribute(attrib)
45
- end
46
-
47
- def get_value(row, visible = true)
48
- obj, = find_cell_element(row, visible)
49
- cell_object_not_found_exception(obj, @type, row)
50
- case obj.tag_name.downcase
51
- when 'input', 'select', 'textarea'
52
- obj.value
53
- else
54
- obj.text
55
- end
56
- end
57
-
58
- alias get_caption get_value
59
-
60
- def find_cell_element(row, visible = true)
61
- set_alt_locator("#{@locator.gsub('ROW_SPEC', row.to_s)}")
62
- find_element(visible)
63
- end
64
-
65
- def cell_object_not_found_exception(obj, obj_type, row)
66
- object_not_found_exception(obj, "Row #{row}/Col #{@column} #{obj_type}")
67
- end
68
- end
69
- end
@@ -1,8 +0,0 @@
1
- module TestCentricity
2
- class CellImage < CellElement
3
- def initialize(name, parent, locator, context, table, column, proxy = nil)
4
- super
5
- @type = :cell_image
6
- end
7
- end
8
- end
@@ -1,31 +0,0 @@
1
- module TestCentricity
2
- class CellRadio < CellElement
3
- attr_accessor :proxy
4
-
5
- def initialize(name, parent, locator, context, table, column, proxy = nil)
6
- super
7
- @type = :cell_radio
8
- @proxy = proxy
9
- end
10
-
11
- def selected?(row)
12
- obj, = find_cell_element(row)
13
- cell_object_not_found_exception(obj, 'Cell Radio', row)
14
- obj.checked?
15
- end
16
-
17
- def set_selected_state(row, state)
18
- obj, = find_cell_element(row)
19
- cell_object_not_found_exception(obj, 'Cell Radio', row)
20
- obj.set(state)
21
- end
22
-
23
- def select(row)
24
- set_selected_state(row, true)
25
- end
26
-
27
- def unselect(row)
28
- set_selected_state(row, false)
29
- end
30
- end
31
- end
@@ -1,8 +0,0 @@
1
- module TestCentricity
2
- class ListButton < ListElement
3
- def initialize(name, parent, locator, context, list, proxy = nil)
4
- super
5
- @type = :list_button
6
- end
7
- end
8
- end
@@ -1,38 +0,0 @@
1
- module TestCentricity
2
- class ListCheckBox < ListElement
3
- attr_accessor :proxy
4
-
5
- def initialize(name, parent, locator, context, list, proxy = nil)
6
- super
7
- @type = :list_checkbox
8
- @proxy = proxy
9
- end
10
-
11
- def checked?(row)
12
- obj, = find_list_element(row)
13
- list_object_not_found_exception(obj, 'List CheckBox', row)
14
- obj.checked?
15
- end
16
-
17
- def set_checkbox_state(row, state)
18
- obj, = find_list_element(row)
19
- list_object_not_found_exception(obj, 'List CheckBox', row)
20
- obj.set(state)
21
- end
22
-
23
- def check(row)
24
- set_checkbox_state(row, true)
25
- end
26
-
27
- def uncheck(row)
28
- set_checkbox_state(row, false)
29
- end
30
-
31
- def verify_check_state(row, state, enqueue = false)
32
- actual = checked?(row)
33
- enqueue ?
34
- ExceptionQueue.enqueue_assert_equal(state, actual, "Expected Row #{row} List Checkbox #{object_ref_message}") :
35
- assert_equal(state, actual, "Expected Row #{row} List Checkbox #{object_ref_message} to be #{state} but found #{actual} instead")
36
- end
37
- end
38
- end
@@ -1,61 +0,0 @@
1
- module TestCentricity
2
- class ListElement < UIElement
3
- attr_accessor :list
4
- attr_accessor :element_locator
5
-
6
- def initialize(name, parent, locator, context, list, proxy = nil)
7
- @name = name
8
- @parent = parent
9
- @context = context
10
- @alt_locator = nil
11
- @list = list
12
- @element_locator = locator
13
-
14
- set_locator_type(@list.get_locator)
15
-
16
- if locator.nil?
17
- @locator = list.get_list_row_locator('ROW_SPEC')
18
- else
19
- @locator = case @locator_type
20
- when :xpath
21
- "#{list.get_list_row_locator('ROW_SPEC')}/#{@element_locator}"
22
- when :css
23
- "#{list.get_list_row_locator('ROW_SPEC')} > #{@element_locator}"
24
- end
25
- end
26
- end
27
-
28
- def exists?(row)
29
- obj, = find_list_element(row)
30
- obj != nil
31
- end
32
-
33
- def click(row)
34
- obj, = find_list_element(row)
35
- list_object_not_found_exception(obj, @type, row)
36
- obj.click
37
- end
38
-
39
- def get_value(row, visible = true)
40
- obj, = find_list_element(row, visible)
41
- list_object_not_found_exception(obj, @type, row)
42
- case obj.tag_name.downcase
43
- when 'input', 'select', 'textarea'
44
- obj.value
45
- else
46
- obj.text
47
- end
48
- end
49
-
50
- alias get_caption get_value
51
-
52
- def find_list_element(row, visible = true)
53
- set_alt_locator("#{@locator.gsub('ROW_SPEC', row.to_s)}")
54
- find_element(visible)
55
- end
56
-
57
- def list_object_not_found_exception(obj, obj_type, row)
58
- object_not_found_exception(obj, "Row #{row} #{obj_type}")
59
- end
60
- end
61
- end