testcentricity_web 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +4 -4
- data/README.md +8 -4
- data/lib/testcentricity_web.rb +2 -1
- data/lib/testcentricity_web/data_objects/environment.rb +8 -8
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +537 -0
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +269 -801
- data/lib/testcentricity_web/web_core/{page_sections_helper.rb → page_section.rb} +1 -261
- data/lib/testcentricity_web/web_elements/cell_element.rb +6 -6
- data/lib/testcentricity_web/web_elements/checkbox.rb +33 -0
- data/lib/testcentricity_web/web_elements/list_element.rb +6 -6
- data/lib/testcentricity_web/web_elements/radio.rb +33 -0
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +4 -4
- metadata +5 -4
@@ -1,11 +1,5 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
1
|
module TestCentricity
|
4
|
-
class PageSection
|
5
|
-
include Capybara::DSL
|
6
|
-
include Capybara::Node::Matchers
|
7
|
-
include Test::Unit::Assertions
|
8
|
-
|
2
|
+
class PageSection < BasePageSectionObject
|
9
3
|
attr_reader :context, :name
|
10
4
|
attr_accessor :locator
|
11
5
|
attr_accessor :parent
|
@@ -125,18 +119,6 @@ module TestCentricity
|
|
125
119
|
@parent = parent
|
126
120
|
end
|
127
121
|
|
128
|
-
# Define a trait for this page section.
|
129
|
-
#
|
130
|
-
# @param trait_name [Symbol] name of trait (as a symbol)
|
131
|
-
# @param block [&block] trait value
|
132
|
-
# @example
|
133
|
-
# trait(:section_locator) { "//div[@class='Messaging_Applet']" }
|
134
|
-
# trait(:list_table_name) { '#Messages' }
|
135
|
-
#
|
136
|
-
def self.trait(trait_name, &block)
|
137
|
-
define_method(trait_name.to_s, &block)
|
138
|
-
end
|
139
|
-
|
140
122
|
# Declare and instantiate a single generic UI Element for this page section.
|
141
123
|
#
|
142
124
|
# @param element_name [Symbol] name of UI object (as a symbol)
|
@@ -734,248 +716,6 @@ module TestCentricity
|
|
734
716
|
section.hover
|
735
717
|
end
|
736
718
|
|
737
|
-
def verify_ui_states(ui_states, fail_message = nil)
|
738
|
-
ui_states.each do |ui_object, object_states|
|
739
|
-
object_states.each do |property, state|
|
740
|
-
case property
|
741
|
-
when :class
|
742
|
-
actual = ui_object.get_attribute(:class)
|
743
|
-
when :name
|
744
|
-
actual = ui_object.get_attribute(:name)
|
745
|
-
when :title
|
746
|
-
actual = ui_object.title
|
747
|
-
when :exists
|
748
|
-
actual = ui_object.exists?
|
749
|
-
when :enabled
|
750
|
-
actual = ui_object.enabled?
|
751
|
-
when :disabled
|
752
|
-
actual = ui_object.disabled?
|
753
|
-
when :visible
|
754
|
-
actual = ui_object.visible?
|
755
|
-
when :hidden
|
756
|
-
actual = ui_object.hidden?
|
757
|
-
when :displayed
|
758
|
-
actual = ui_object.displayed?
|
759
|
-
when :width
|
760
|
-
actual = ui_object.width
|
761
|
-
when :height
|
762
|
-
actual = ui_object.height
|
763
|
-
when :x
|
764
|
-
actual = ui_object.x
|
765
|
-
when :y
|
766
|
-
actual = ui_object.y
|
767
|
-
when :readonly
|
768
|
-
actual = ui_object.read_only?
|
769
|
-
when :checked
|
770
|
-
actual = ui_object.checked?
|
771
|
-
when :selected
|
772
|
-
actual = ui_object.selected?
|
773
|
-
when :value, :caption
|
774
|
-
actual = ui_object.get_value
|
775
|
-
when :maxlength
|
776
|
-
actual = ui_object.get_max_length
|
777
|
-
when :rowcount
|
778
|
-
actual = ui_object.get_row_count
|
779
|
-
when :columncount
|
780
|
-
actual = ui_object.get_column_count
|
781
|
-
when :placeholder
|
782
|
-
actual = ui_object.get_placeholder
|
783
|
-
when :min
|
784
|
-
actual = ui_object.get_min
|
785
|
-
when :max
|
786
|
-
actual = ui_object.get_max
|
787
|
-
when :step
|
788
|
-
actual = ui_object.get_step
|
789
|
-
when :loaded
|
790
|
-
actual = ui_object.loaded?
|
791
|
-
when :broken
|
792
|
-
actual = ui_object.broken?
|
793
|
-
when :alt
|
794
|
-
actual = ui_object.alt
|
795
|
-
when :src
|
796
|
-
actual = ui_object.src
|
797
|
-
when :autoplay
|
798
|
-
actual = ui_object.autoplay?
|
799
|
-
when :ended
|
800
|
-
actual = ui_object.ended?
|
801
|
-
when :controls
|
802
|
-
actual = ui_object.controls?
|
803
|
-
when :loop
|
804
|
-
actual = ui_object.loop?
|
805
|
-
when :muted
|
806
|
-
actual = ui_object.muted?
|
807
|
-
when :default_muted
|
808
|
-
actual = ui_object.default_muted?
|
809
|
-
when :paused
|
810
|
-
actual = ui_object.paused?
|
811
|
-
when :seeking
|
812
|
-
actual = ui_object.seeking?
|
813
|
-
when :current_time
|
814
|
-
actual = ui_object.current_time
|
815
|
-
when :default_playback_rate
|
816
|
-
actual = ui_object.default_playback_rate
|
817
|
-
when :duration
|
818
|
-
actual = ui_object.duration
|
819
|
-
when :playback_rate
|
820
|
-
actual = ui_object.playback_rate
|
821
|
-
when :ready_state
|
822
|
-
actual = ui_object.ready_state
|
823
|
-
when :volume
|
824
|
-
actual = ui_object.volume
|
825
|
-
when :options, :items, :list_items
|
826
|
-
actual = ui_object.get_list_items
|
827
|
-
when :optioncount, :itemcount
|
828
|
-
actual = ui_object.get_item_count
|
829
|
-
when :groupcount
|
830
|
-
actual = ui_object.get_group_count
|
831
|
-
when :group_headings
|
832
|
-
actual = ui_object.get_group_headings
|
833
|
-
when :all_items, :all_list_items
|
834
|
-
actual = ui_object.get_all_list_items
|
835
|
-
when :all_items_count
|
836
|
-
actual = ui_object.get_all_items_count
|
837
|
-
when :column_headers
|
838
|
-
actual = ui_object.get_header_columns
|
839
|
-
when :count, :count_visible
|
840
|
-
actual = ui_object.count(visible = true)
|
841
|
-
when :count_all
|
842
|
-
actual = ui_object.count(visible = :all)
|
843
|
-
when :siebel_options
|
844
|
-
actual = ui_object.get_siebel_options
|
845
|
-
when :style
|
846
|
-
actual = ui_object.style
|
847
|
-
when :href
|
848
|
-
actual = ui_object.href
|
849
|
-
when :role
|
850
|
-
actual = ui_object.role
|
851
|
-
when :aria_label
|
852
|
-
actual = ui_object.aria_label
|
853
|
-
when :aria_disabled
|
854
|
-
actual = ui_object.aria_disabled?
|
855
|
-
when :tabindex
|
856
|
-
actual = ui_object.tabindex
|
857
|
-
when :aria_labelledby
|
858
|
-
actual = ui_object.aria_labelledby
|
859
|
-
when :aria_describedby
|
860
|
-
actual = ui_object.aria_describedby
|
861
|
-
when :aria_live
|
862
|
-
actual = ui_object.aria_live
|
863
|
-
when :aria_selected
|
864
|
-
actual = ui_object.aria_selected?
|
865
|
-
when :aria_hidden
|
866
|
-
actual = ui_object.aria_hidden?
|
867
|
-
when :aria_expanded
|
868
|
-
actual = ui_object.aria_expanded?
|
869
|
-
when :aria_required
|
870
|
-
actual = ui_object.aria_required?
|
871
|
-
when :aria_invalid
|
872
|
-
actual = ui_object.aria_invalid?
|
873
|
-
when :aria_checked
|
874
|
-
actual = ui_object.aria_checked?
|
875
|
-
when :aria_readonly
|
876
|
-
actual = ui_object.aria_readonly?
|
877
|
-
when :aria_pressed
|
878
|
-
actual = ui_object.aria_pressed?
|
879
|
-
when :aria_haspopup
|
880
|
-
actual = ui_object.aria_haspopup?
|
881
|
-
when :aria_sort
|
882
|
-
actual = ui_object.aria_sort
|
883
|
-
when :aria_rowcount
|
884
|
-
actual = ui_object.aria_rowcount
|
885
|
-
when :aria_colcount
|
886
|
-
actual = ui_object.aria_colcount
|
887
|
-
else
|
888
|
-
if property.is_a?(Hash)
|
889
|
-
property.each do |key, value|
|
890
|
-
case key
|
891
|
-
when :cell
|
892
|
-
actual = ui_object.get_table_cell(value[0].to_i, value[1].to_i)
|
893
|
-
when :row
|
894
|
-
actual = ui_object.get_table_row(value.to_i)
|
895
|
-
when :column
|
896
|
-
actual = ui_object.get_table_column(value.to_i)
|
897
|
-
when :item
|
898
|
-
actual = ui_object.get_list_item(value.to_i)
|
899
|
-
when :attribute
|
900
|
-
actual = ui_object.get_attribute(value)
|
901
|
-
when :native_attribute
|
902
|
-
actual = ui_object.get_native_attribute(value)
|
903
|
-
end
|
904
|
-
end
|
905
|
-
end
|
906
|
-
end
|
907
|
-
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
|
908
|
-
ExceptionQueue.enqueue_comparison(ui_object, state, actual, error_msg)
|
909
|
-
end
|
910
|
-
end
|
911
|
-
rescue ObjectNotFoundError => e
|
912
|
-
ExceptionQueue.enqueue_exception(e.message)
|
913
|
-
ensure
|
914
|
-
ExceptionQueue.post_exceptions(fail_message)
|
915
|
-
end
|
916
|
-
|
917
|
-
# Populate the specified UI elements in this Section object with the associated data from a Hash passed as an
|
918
|
-
# argument. Data values must be in the form of a String for textfield and select list controls. For checkbox
|
919
|
-
# and radio buttons, data must either be a Boolean or a String that evaluates to a Boolean value (Yes, No, 1,
|
920
|
-
# 0, true, false).
|
921
|
-
#
|
922
|
-
# The optional wait_time parameter is used to specify the time (in seconds) to wait for each UI element to become
|
923
|
-
# visible before entering the associated data value. This option is useful in situations where entering data, or
|
924
|
-
# setting the state of a UI element might cause other UI elements to become visible or active. Specifying a wait_time
|
925
|
-
# value ensures that the subsequent UI elements will be ready to be interacted with as states are changed. If the wait
|
926
|
-
# time is nil, then the wait time will be 5 seconds.
|
927
|
-
#
|
928
|
-
# To delete all text content in a text field, pass !DELETE as the data to be entered.
|
929
|
-
#
|
930
|
-
# @param data [Hash] UI element(s) and associated data to be entered
|
931
|
-
# @param wait_time [Integer] wait time in seconds
|
932
|
-
# @param integrity_check [Boolean] if TRUE, ensure that text entered into text fields matches what was entered
|
933
|
-
# @example
|
934
|
-
# data = { prefix_select => 'Mr.',
|
935
|
-
# first_name_field => 'Ignatious',
|
936
|
-
# last_name_field => 'Snickelfritz',
|
937
|
-
# gender_select => 'Male',
|
938
|
-
# dob_field => '12/14/1957',
|
939
|
-
# organ_donor_check => 'Yes',
|
940
|
-
# dnr_on_file_check => 'Yes'
|
941
|
-
# }
|
942
|
-
# populate_data_fields(data)
|
943
|
-
#
|
944
|
-
def populate_data_fields(data, wait_time = nil, integrity_check = false)
|
945
|
-
timeout = wait_time.nil? ? 5 : wait_time
|
946
|
-
data.each do |data_field, data_param|
|
947
|
-
unless data_param.blank?
|
948
|
-
# make sure the intended UI target element is visible before trying to set its value
|
949
|
-
data_field.wait_until_visible(timeout)
|
950
|
-
if data_param == '!DELETE'
|
951
|
-
data_field.clear
|
952
|
-
else
|
953
|
-
case data_field.get_object_type
|
954
|
-
when :checkbox
|
955
|
-
data_field.set_checkbox_state(data_param.to_bool)
|
956
|
-
when :selectlist
|
957
|
-
if data_field.get_siebel_object_type == 'JComboBox'
|
958
|
-
data_field.set("#{data_param}\t")
|
959
|
-
else
|
960
|
-
data_field.choose_option(data_param)
|
961
|
-
end
|
962
|
-
when :radio
|
963
|
-
data_field.set_selected_state(data_param.to_bool)
|
964
|
-
when :textfield
|
965
|
-
data_field.set("#{data_param}\t")
|
966
|
-
if integrity_check && data_field.get_value != data_param
|
967
|
-
data_field.set('')
|
968
|
-
data_field.send_keys(data_param)
|
969
|
-
data_field.send_keys(:tab)
|
970
|
-
end
|
971
|
-
when :section
|
972
|
-
data_field.set(data_param)
|
973
|
-
end
|
974
|
-
end
|
975
|
-
end
|
976
|
-
end
|
977
|
-
end
|
978
|
-
|
979
719
|
def get_attribute(attrib)
|
980
720
|
section, = find_section
|
981
721
|
section_not_found_exception(section)
|
@@ -19,12 +19,12 @@ module TestCentricity
|
|
19
19
|
|
20
20
|
def set_column(column)
|
21
21
|
@column = column
|
22
|
-
case @locator_type
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
28
|
end
|
29
29
|
|
30
30
|
def exists?(row)
|
@@ -36,6 +36,39 @@ module TestCentricity
|
|
36
36
|
obj.checked?
|
37
37
|
end
|
38
38
|
|
39
|
+
# Is checkbox visible?
|
40
|
+
#
|
41
|
+
# @return [Boolean]
|
42
|
+
# @example
|
43
|
+
# remember_me_checkbox.visible?
|
44
|
+
#
|
45
|
+
def visible?
|
46
|
+
@proxy.nil? ? super : @proxy.visible?
|
47
|
+
end
|
48
|
+
|
49
|
+
# Is checkbox disabled (not enabled)?
|
50
|
+
#
|
51
|
+
# @return [Boolean]
|
52
|
+
# @example
|
53
|
+
# remember_me_checkbox.disabled?
|
54
|
+
#
|
55
|
+
def disabled?
|
56
|
+
visibility = @proxy.nil? ? true : :all
|
57
|
+
obj, type = find_element(visibility)
|
58
|
+
object_not_found_exception(obj, type)
|
59
|
+
obj.disabled?
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return checkbox caption
|
63
|
+
#
|
64
|
+
# @return [Boolean]
|
65
|
+
# @example
|
66
|
+
# remember_me_checkbox.get_value
|
67
|
+
#
|
68
|
+
def get_value
|
69
|
+
@proxy.nil? ? super : @proxy.get_value
|
70
|
+
end
|
71
|
+
|
39
72
|
# Set the check state of a checkbox object.
|
40
73
|
#
|
41
74
|
# @param state [Boolean] true = checked / false = unchecked
|
@@ -16,12 +16,12 @@ module TestCentricity
|
|
16
16
|
if locator.nil?
|
17
17
|
@locator = list.get_list_row_locator('ROW_SPEC')
|
18
18
|
else
|
19
|
-
case @locator_type
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -36,6 +36,39 @@ module TestCentricity
|
|
36
36
|
obj.checked?
|
37
37
|
end
|
38
38
|
|
39
|
+
# Is radio button visible?
|
40
|
+
#
|
41
|
+
# @return [Boolean]
|
42
|
+
# @example
|
43
|
+
# accept_terms_radio.visible?
|
44
|
+
#
|
45
|
+
def visible?
|
46
|
+
@proxy.nil? ? super : @proxy.visible?
|
47
|
+
end
|
48
|
+
|
49
|
+
# Is radio button disabled (not enabled)?
|
50
|
+
#
|
51
|
+
# @return [Boolean]
|
52
|
+
# @example
|
53
|
+
# accept_terms_radio.disabled?
|
54
|
+
#
|
55
|
+
def disabled?
|
56
|
+
visibility = @proxy.nil? ? true : :all
|
57
|
+
obj, type = find_element(visibility)
|
58
|
+
object_not_found_exception(obj, type)
|
59
|
+
obj.disabled?
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return radio button caption
|
63
|
+
#
|
64
|
+
# @return [Boolean]
|
65
|
+
# @example
|
66
|
+
# accept_terms_radio.get_value
|
67
|
+
#
|
68
|
+
def get_value
|
69
|
+
@proxy.nil? ? super : @proxy.get_value
|
70
|
+
end
|
71
|
+
|
39
72
|
# Set the select state of a radio button object.
|
40
73
|
#
|
41
74
|
# @param state [Boolean] true = selected / false = unselected
|
@@ -45,8 +45,8 @@ module TestCentricity
|
|
45
45
|
attr_reader :parent, :locator, :context, :type, :name
|
46
46
|
attr_accessor :alt_locator, :locator_type, :original_style
|
47
47
|
|
48
|
-
XPATH_SELECTORS = ['//', '[@', '[contains(']
|
49
|
-
CSS_SELECTORS = ['#', ':nth-child(', ':first-child', ':last-child', ':nth-of-type(', ':first-of-type', ':last-of-type', '^=', '$=', '*=', ':contains(']
|
48
|
+
XPATH_SELECTORS = ['//', '[@', '[contains(']
|
49
|
+
CSS_SELECTORS = ['#', ':nth-child(', ':first-child', ':last-child', ':nth-of-type(', ':first-of-type', ':last-of-type', '^=', '$=', '*=', ':contains(']
|
50
50
|
|
51
51
|
def initialize(name, parent, locator, context)
|
52
52
|
@name = name
|
@@ -801,13 +801,13 @@ module TestCentricity
|
|
801
801
|
end
|
802
802
|
|
803
803
|
def get_attribute(attrib)
|
804
|
-
obj, type = find_element(false)
|
804
|
+
obj, type = find_element(visible = false)
|
805
805
|
object_not_found_exception(obj, type)
|
806
806
|
obj[attrib]
|
807
807
|
end
|
808
808
|
|
809
809
|
def get_native_attribute(attrib)
|
810
|
-
obj, type = find_element(false)
|
810
|
+
obj, type = find_element(visible = false)
|
811
811
|
object_not_found_exception(obj, type)
|
812
812
|
obj.native.attribute(attrib)
|
813
813
|
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.2.
|
4
|
+
version: 3.2.1
|
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: 2019-
|
11
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -274,8 +274,9 @@ files:
|
|
274
274
|
- lib/testcentricity_web/utility_helpers.rb
|
275
275
|
- lib/testcentricity_web/version.rb
|
276
276
|
- lib/testcentricity_web/web_core/drag_drop_helper.rb
|
277
|
+
- lib/testcentricity_web/web_core/page_object.rb
|
277
278
|
- lib/testcentricity_web/web_core/page_objects_helper.rb
|
278
|
-
- lib/testcentricity_web/web_core/
|
279
|
+
- lib/testcentricity_web/web_core/page_section.rb
|
279
280
|
- lib/testcentricity_web/web_core/webdriver_helper.rb
|
280
281
|
- lib/testcentricity_web/web_elements/audio.rb
|
281
282
|
- lib/testcentricity_web/web_elements/button.rb
|
@@ -325,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
325
326
|
requirements:
|
326
327
|
- Capybara, Selenium-WebDriver
|
327
328
|
rubyforge_project:
|
328
|
-
rubygems_version: 2.
|
329
|
+
rubygems_version: 2.6.14
|
329
330
|
signing_key:
|
330
331
|
specification_version: 4
|
331
332
|
summary: A Page Object and Data Object Model Framework for desktop and mobile web
|