testcentricity_mobile 4.0.5 → 4.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e8fb5fe845b780a179f42b55ae5b46af2e82f38e1a722df9510a3662de8dca5
4
- data.tar.gz: 9bd6ba84e65f19b11daccf044d805f23a969ab17efbb6a40827a780ab127a96c
3
+ metadata.gz: fa7ae2f538647efddd759d3958b2def1c3dd73cb68772a23310397c49e23b556
4
+ data.tar.gz: 15a31c256250cbaa3670a467469e3386c0467883facb23026b662a383ac81722
5
5
  SHA512:
6
- metadata.gz: 5cfa08ef930ec88fa2f5de32ef296e77107abeb153efad4660dea4564022a341a52c8e6d6c7a5136d5ec82432e705a635f3542ec05b46ccd50b344b7e7d6157f
7
- data.tar.gz: 6ee2af57ed34c56f4240b98d9e680c1fbf32e98692a5664664ac8cad6161dede0be7eea9ee67401928efbf1a4fdf46cfa05313fd39ff38ff8373ec8da577d444
6
+ metadata.gz: 1b1b5323763138cce0d95a8b0b2dc142dfce8f39c4d45cacc13bfc5a7420d49d0b16a766108421dbc25d9c9043c22131257434347f7a44cac3839569337fcd3c
7
+ data.tar.gz: e1004a41f10e1983e94d2dd659aa0abd3543227ac6e831b931f20eafd21133fc456ee7bff85eddf869cddad92a58a2d3e2f85fbbb58bf1a956191d1ef6b12cdd
data/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
4
 
5
+ ## [4.0.7] - 05-MAY-2024
6
+
7
+ ### Added
8
+ * Added support for radio buttons via the `AppRadio` UI element class and the following methods:
9
+ * `ScreenObject.radio`
10
+ * `ScreenObject.radios`
11
+ * `ScreenSection.radio`
12
+ * `ScreenSection.radios`
13
+ * `ScreenObject.populate_data_fields` and `ScreenSection.populate_data_fields` methods now support radio buttons.
14
+
15
+ ### Changed
16
+
17
+ * Updated `selenium-webdriver` gem to version 4.20.1.
18
+ * Updated `appium_lib_core` gem to version 8.0.2.
19
+
20
+
21
+ ## [4.0.6] - 02-MAY-2024
22
+
23
+ ### Fixed
24
+
25
+ * `ScreenSection.find_section` is now able to find `ScreenSection` objects embedded within other `ScreenSections`.
26
+
27
+
5
28
  ## [4.0.5] - 29-APR-2024
6
29
 
7
30
  ### Fixed
data/README.md CHANGED
@@ -508,15 +508,16 @@ Supported `AppUIElement` elementTypes and their declarations have the following
508
508
  *Single element declarations:*
509
509
  ```ruby
510
510
  class SampleScreen < TestCentricity::ScreenObject
511
- button :button_name, { locator_strategy: locator_identifier }
512
- textfield :field_name, { locator_strategy: locator_identifier }
513
- checkbox :checkbox_name, { locator_strategy: locator_identifier }
514
- label :label_name, { locator_strategy: locator_identifier }
515
- list :list_name, { locator_strategy: locator_identifier }
516
- image :image_name, { locator_strategy: locator_identifier }
517
- switch :switch_name, { locator_strategy: locator_identifier }
518
- element :element_name, { locator_strategy: locator_identifier }
519
- alert :alert_name, { locator_strategy: locator_identifier }
511
+ button :button_name, { locator_strategy: locator_identifier }
512
+ textfield :field_name, { locator_strategy: locator_identifier }
513
+ checkbox :checkbox_name, { locator_strategy: locator_identifier }
514
+ radio :radio_name, { locator_strategy: locator_identifier }
515
+ label :label_name, { locator_strategy: locator_identifier }
516
+ list :list_name, { locator_strategy: locator_identifier }
517
+ image :image_name, { locator_strategy: locator_identifier }
518
+ switch :switch_name, { locator_strategy: locator_identifier }
519
+ element :element_name, { locator_strategy: locator_identifier }
520
+ alert :alert_name, { locator_strategy: locator_identifier }
520
521
  end
521
522
  ```
522
523
  *Multiple element declarations:*
@@ -531,6 +532,8 @@ Supported `AppUIElement` elementTypes and their declarations have the following
531
532
  checkboxes check_1_name: { locator_strategy: locator_identifier },
532
533
  check_2_name: { locator_strategy: locator_identifier },
533
534
  check_X_name: { locator_strategy: locator_identifier }
535
+ radios radio_1_name: { locator_strategy: locator_identifier },
536
+ radio_X_name: { locator_strategy: locator_identifier }
534
537
  labels label_1_name: { locator_strategy: locator_identifier },
535
538
  label_X_name: { locator_strategy: locator_identifier }
536
539
  images image_1_name: { locator_strategy: locator_identifier },
@@ -593,8 +596,8 @@ above) for each `AppUIElement` that needs to be interacted with.
593
596
  The `ScreenObject.populate_data_fields` and `ScreenSection.populate_data_fields` methods support the entry of test data
594
597
  into a collection of `AppUIElements`. The `populate_data_fields` method accepts a hash containing key/hash pairs of
595
598
  `AppUIElements` and their associated data to be entered. Data values must be in the form of a `String` for `textfield`
596
- controls. For `checkbox` controls, data must either be a `Boolean` or a `String` that evaluates to a `Boolean` value (Yes,
597
- No, 1, 0, true, false).
599
+ controls. For `checkbox`, `radio`, and `switch` controls, data must either be a `Boolean` or a `String` that evaluates to
600
+ a `Boolean` value ('Yes', 'No', '1', '0', 'true', 'false').
598
601
 
599
602
  The `populate_data_fields` method verifies that data attributes associated with each `AppUIElement` is not `nil` or `empty`
600
603
  before attempting to enter data into the `AppUIElement`.
@@ -140,6 +140,30 @@ module TestCentricity
140
140
  end
141
141
  end
142
142
 
143
+ # Declare and instantiate a single radio button UI Element for this screen object.
144
+ #
145
+ # @param element_name [Symbol] name of radio button object (as a symbol)
146
+ # @param locator [Hash] { locator_strategy: locator_identifier }
147
+ # @example
148
+ # radio :unicode_radio, { xpath: '//XCUIElementTypeRadioButton[@label="Unicode"]'}
149
+ #
150
+ def self.radio(element_name, locator)
151
+ define_screen_element(element_name, TestCentricity::AppElements::AppRadio, locator)
152
+ end
153
+
154
+ # Declare and instantiate a collection of radio buttons for this screen object.
155
+ #
156
+ # @param element_hash [Hash] names of radio buttons (as symbol) and locator Hash
157
+ # @example
158
+ # radios unicode_radio: { xpath: '//XCUIElementTypeRadioButton[@label="Unicode"]'},
159
+ # ascii_radio: { xpath: '//XCUIElementTypeRadioButton[@label="ASCII"] }
160
+ #
161
+ def self.radios(element_hash)
162
+ element_hash.each do |element_name, locator|
163
+ radio(element_name, locator)
164
+ end
165
+ end
166
+
143
167
  # Declare and instantiate a single label UI Element for this screen object.
144
168
  #
145
169
  # @param element_name [Symbol] name of label object (as a symbol)
@@ -21,9 +21,9 @@ module TestCentricity
21
21
  end
22
22
 
23
23
  # Populate the specified UI elements on this screen or section object with the associated data from a Hash passed as
24
- # an argument. Data values must be in the form of a String for textfield controls. For checkboxes and switches, data
25
- # must either be a Boolean or a String that evaluates to a Boolean value (Yes, No, 1, 0, true, false). For screen section
26
- # objects, data values must be a String, and the screen section object must have a set method defined.
24
+ # an argument. Data values must be in the form of a String for textfield controls. For checkboxes,radios, and switches,
25
+ # data must either be a Boolean or a String that evaluates to a Boolean value (Yes, No, 1, 0, true, false). For screen
26
+ # section objects, data values must be a String, and the screen section object must have a set method defined.
27
27
  #
28
28
  # The optional wait_time parameter is used to specify the time (in seconds) to wait for each UI element to become
29
29
  # visible before entering the associated data value. This option is useful in situations where entering data, or
@@ -59,6 +59,8 @@ module TestCentricity
59
59
  case data_field.get_object_type
60
60
  when :checkbox
61
61
  data_field.set_checkbox_state(data_param.to_bool)
62
+ when :radio
63
+ data_field.set_selected_state(data_param.to_bool)
62
64
  when :textfield
63
65
  data_field.clear
64
66
  data_field.set(data_param)
@@ -20,14 +20,14 @@ module TestCentricity
20
20
  end
21
21
 
22
22
  def get_locator
23
- if @locator.zero? && defined?(section_locator)
24
- my_locator = section_locator
25
- else
26
- my_locator = @locator
27
- end
23
+ my_locator = if @locator.zero? && defined?(section_locator)
24
+ section_locator
25
+ else
26
+ @locator
27
+ end
28
28
  locators = []
29
29
  if @context == :section && !@parent.nil?
30
- locators.push(@parent.get_locator)
30
+ locators = @parent.get_locator
31
31
  end
32
32
 
33
33
  if @parent_list.nil?
@@ -206,6 +206,28 @@ module TestCentricity
206
206
  element_hash.each_pair { |element_name, locator| checkbox(element_name, locator) }
207
207
  end
208
208
 
209
+ # Declare and instantiate a single radio button UI Element for this screen section object.
210
+ #
211
+ # @param element_name [Symbol] name of radio button object (as a symbol)
212
+ # @param locator [Hash] { locator_strategy: locator_identifier }
213
+ # @example
214
+ # radio :unicode_radio, { xpath: '//XCUIElementTypeRadioButton[@label="Unicode"]'}
215
+ #
216
+ def self.radio(element_name, locator)
217
+ define_section_element(element_name, TestCentricity::AppElements::AppRadio, locator)
218
+ end
219
+
220
+ # Declare and instantiate a collection of radio buttons for this screen section object.
221
+ #
222
+ # @param element_hash [Hash] names of radio buttons (as symbol) and locator Hash
223
+ # @example
224
+ # radios unicode_radio: { xpath: '//XCUIElementTypeRadioButton[@label="Unicode"]'},
225
+ # ascii_radio: { xpath: '//XCUIElementTypeRadioButton[@label="ASCII"] }
226
+ #
227
+ def self.radios(element_hash)
228
+ element_hash.each_pair { |element_name, locator| radio(element_name, locator) }
229
+ end
230
+
209
231
  # Declare and instantiate a single label UI Element for this screen section object.
210
232
  #
211
233
  # @param element_name [Symbol] name of label object (as a symbol)
@@ -578,11 +600,10 @@ module TestCentricity
578
600
  locators.each do |loc|
579
601
  if obj.nil?
580
602
  obj = find_element(loc.keys[0], loc.values[0])
581
- puts "Found object #{loc}" if ENV['DEBUG']
582
603
  else
583
604
  obj = obj.find_element(loc.keys[0], loc.values[0])
584
- puts "Found object #{loc}" if ENV['DEBUG']
585
605
  end
606
+ puts "Found section object #{loc}" if ENV['DEBUG']
586
607
  end
587
608
  obj
588
609
  rescue
@@ -0,0 +1,56 @@
1
+ module TestCentricity
2
+ module AppElements
3
+ class AppRadio < AppUIElement
4
+ def initialize(name, parent, locator, context)
5
+ super
6
+ @type = :radio
7
+ end
8
+
9
+ # Is radio selected?
10
+ #
11
+ # @return [Boolean]
12
+ # @example
13
+ # unicode_radio.selected?
14
+ #
15
+ def selected?
16
+ obj = element
17
+ object_not_found_exception(obj)
18
+ obj.selected?
19
+ end
20
+
21
+ # Set the selected state of a radio button object.
22
+ #
23
+ # @example
24
+ # unicode_radio.select
25
+ #
26
+ def select
27
+ set_selected_state(true)
28
+ end
29
+
30
+ # Unselect a radio button object.
31
+ #
32
+ # @example
33
+ # unicode_radio.unselect
34
+ #
35
+ def unselect
36
+ set_selected_state(false)
37
+ end
38
+
39
+ # Set the selected state of a radio button object.
40
+ #
41
+ # @param state [Boolean] true = selected / false = unselected
42
+ # @example
43
+ # ascii_radio.set_selected_state(true)
44
+ #
45
+ def set_selected_state(state)
46
+ obj = element
47
+ object_not_found_exception(obj)
48
+ if state
49
+ obj.click unless obj.selected?
50
+ else
51
+ obj.click if obj.selected?
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityMobile
2
- VERSION = '4.0.5'
2
+ VERSION = '4.0.7'
3
3
  end
@@ -19,6 +19,7 @@ require 'testcentricity_mobile/app_elements/app_element'
19
19
  require 'testcentricity_mobile/app_elements/button'
20
20
  require 'testcentricity_mobile/app_elements/checkbox'
21
21
  require 'testcentricity_mobile/app_elements/label'
22
+ require 'testcentricity_mobile/app_elements/radio'
22
23
  require 'testcentricity_mobile/app_elements/switch'
23
24
  require 'testcentricity_mobile/app_elements/textfield'
24
25
  require 'testcentricity_mobile/app_elements/list'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_mobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 4.0.7
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: 2024-04-28 00:00:00.000000000 Z
11
+ date: 2024-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 4.20.0
215
+ version: 4.20.1
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 4.20.0
222
+ version: 4.20.1
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: test-unit
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,7 @@ files:
276
276
  - lib/testcentricity_mobile/app_elements/image.rb
277
277
  - lib/testcentricity_mobile/app_elements/label.rb
278
278
  - lib/testcentricity_mobile/app_elements/list.rb
279
+ - lib/testcentricity_mobile/app_elements/radio.rb
279
280
  - lib/testcentricity_mobile/app_elements/switch.rb
280
281
  - lib/testcentricity_mobile/app_elements/textfield.rb
281
282
  - lib/testcentricity_mobile/appium_server.rb