testcentricity 2.4.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +29 -0
- data/.rspec +2 -1
- data/.rubocop.yml +38 -0
- data/.ruby-version +1 -1
- data/.simplecov +9 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +275 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/{LICENSE.txt → LICENSE.md} +3 -4
- data/README.md +938 -1384
- data/Rakefile +63 -1
- data/config/cucumber.yml +145 -0
- data/config/locales/en-US.yml +56 -0
- data/config/test_data/LOCAL_data.yml +11 -0
- data/config/test_data/data.yml +10 -0
- data/features/deep_links.feature +26 -0
- data/features/login.feature +30 -0
- data/features/navigation.feature +31 -0
- data/features/step_definitions/generic_steps.rb +72 -0
- data/features/support/android/screens/about_screen.rb +11 -0
- data/features/support/android/screens/base_app_screen.rb +29 -0
- data/features/support/android/screens/checkout_address_screen.rb +17 -0
- data/features/support/android/screens/checkout_payment_screen.rb +22 -0
- data/features/support/android/screens/login_screen.rb +18 -0
- data/features/support/android/screens/products_screen.rb +13 -0
- data/features/support/android/screens/saucebot_screen.rb +16 -0
- data/features/support/android/screens/webview_screen.rb +13 -0
- data/features/support/android/sections/nav_widgets/nav_menu.rb +39 -0
- data/features/support/env.rb +61 -0
- data/features/support/hooks.rb +135 -0
- data/features/support/ios/screens/about_screen.rb +11 -0
- data/features/support/ios/screens/base_app_screen.rb +19 -0
- data/features/support/ios/screens/checkout_address_screen.rb +17 -0
- data/features/support/ios/screens/checkout_payment_screen.rb +22 -0
- data/features/support/ios/screens/login_screen.rb +18 -0
- data/features/support/ios/screens/products_screen.rb +13 -0
- data/features/support/ios/screens/saucebot_screen.rb +16 -0
- data/features/support/ios/screens/webview_screen.rb +13 -0
- data/features/support/ios/sections/list_items/product_cell_item.rb +13 -0
- data/features/support/ios/sections/modals/base_modal.rb +23 -0
- data/features/support/ios/sections/modals/logout_modal.rb +6 -0
- data/features/support/ios/sections/modals/reset_app_state_modal.rb +6 -0
- data/features/support/ios/sections/nav_widgets/nav_bar.rb +31 -0
- data/features/support/ios/sections/nav_widgets/nav_menu.rb +41 -0
- data/features/support/shared_components/screens/base_app_screen.rb +31 -0
- data/features/support/shared_components/screens/checkout_address_screen.rb +17 -0
- data/features/support/shared_components/screens/checkout_payment_screen.rb +22 -0
- data/features/support/shared_components/screens/login_screen.rb +39 -0
- data/features/support/shared_components/screens/saucebot_screen.rb +17 -0
- data/features/support/shared_components/screens/webview_screen.rb +12 -0
- data/features/support/shared_components/sections/nav_menu.rb +58 -0
- data/features/support/world_data.rb +12 -0
- data/features/support/world_pages.rb +26 -0
- data/lib/testcentricity/app_core/appium_connect_helper.rb +343 -111
- data/lib/testcentricity/app_core/screen_object.rb +252 -0
- data/lib/testcentricity/app_core/screen_objects_helper.rb +29 -201
- data/lib/testcentricity/app_core/{screen_sections_helper.rb → screen_section.rb} +40 -105
- data/lib/testcentricity/app_elements/app_element_helper.rb +17 -8
- data/lib/testcentricity/app_elements/checkbox.rb +3 -3
- data/lib/testcentricity/data_objects/environment.rb +133 -39
- data/lib/testcentricity/version.rb +1 -1
- data/lib/testcentricity.rb +4 -129
- data/reports/.keep +1 -0
- data/spec/fixtures/page_object.rb +22 -0
- data/spec/fixtures/page_section_object.rb +21 -0
- data/spec/fixtures/screen_object.rb +16 -0
- data/spec/fixtures/screen_section_object.rb +16 -0
- data/spec/spec_helper.rb +28 -9
- data/spec/testcentricity/elements/button_spec.rb +18 -0
- data/spec/testcentricity/elements/checkbox_spec.rb +28 -0
- data/spec/testcentricity/elements/image_spec.rb +13 -0
- data/spec/testcentricity/elements/label_spec.rb +18 -0
- data/spec/testcentricity/elements/list_spec.rb +13 -0
- data/spec/testcentricity/elements/ui_element_spec.rb +72 -0
- data/spec/testcentricity/mobile/appium_connect_spec.rb +117 -0
- data/spec/testcentricity/mobile/screen_object_spec.rb +63 -0
- data/spec/testcentricity/mobile/screen_section_object_spec.rb +56 -0
- data/spec/testcentricity/version_spec.rb +7 -0
- data/spec/testcentricity/web/browser_spec.rb +41 -0
- data/spec/testcentricity/web/local_webdriver_spec.rb +86 -0
- data/spec/testcentricity/web/mobile_webdriver_spec.rb +123 -0
- data/spec/testcentricity/web/page_object_spec.rb +85 -0
- data/spec/testcentricity/web/page_section_object_spec.rb +72 -0
- data/testcentricity.gemspec +28 -27
- metadata +196 -127
- data/.ruby-gemset +0 -1
- data/Gemfile.lock +0 -93
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/devices/devices.yml +0 -352
- data/lib/testcentricity/app_core/appium_server.rb +0 -69
- data/lib/testcentricity/browser_helper.rb +0 -174
- data/lib/testcentricity/data_objects/data_objects_helper.rb +0 -78
- data/lib/testcentricity/data_objects/excel_helper.rb +0 -242
- data/lib/testcentricity/exception_queue_helper.rb +0 -111
- data/lib/testcentricity/utility_helpers.rb +0 -32
- data/lib/testcentricity/web_core/drag_drop_helper.rb +0 -15
- data/lib/testcentricity/web_core/page_objects_helper.rb +0 -677
- data/lib/testcentricity/web_core/page_sections_helper.rb +0 -895
- data/lib/testcentricity/web_core/webdriver_helper.rb +0 -588
- data/lib/testcentricity/web_elements/button.rb +0 -8
- data/lib/testcentricity/web_elements/cell_button.rb +0 -8
- data/lib/testcentricity/web_elements/cell_checkbox.rb +0 -38
- data/lib/testcentricity/web_elements/cell_element.rb +0 -69
- data/lib/testcentricity/web_elements/cell_image.rb +0 -8
- data/lib/testcentricity/web_elements/cell_radio.rb +0 -31
- data/lib/testcentricity/web_elements/checkbox.rb +0 -100
- data/lib/testcentricity/web_elements/file_field.rb +0 -45
- data/lib/testcentricity/web_elements/image.rb +0 -34
- data/lib/testcentricity/web_elements/label.rb +0 -8
- data/lib/testcentricity/web_elements/link.rb +0 -8
- data/lib/testcentricity/web_elements/list.rb +0 -100
- data/lib/testcentricity/web_elements/list_button.rb +0 -8
- data/lib/testcentricity/web_elements/list_checkbox.rb +0 -38
- data/lib/testcentricity/web_elements/list_element.rb +0 -61
- data/lib/testcentricity/web_elements/list_radio.rb +0 -31
- data/lib/testcentricity/web_elements/radio.rb +0 -74
- data/lib/testcentricity/web_elements/select_list.rb +0 -208
- data/lib/testcentricity/web_elements/siebel_open_ui_helper.rb +0 -15
- data/lib/testcentricity/web_elements/table.rb +0 -612
- data/lib/testcentricity/web_elements/textfield.rb +0 -114
- data/lib/testcentricity/web_elements/ui_elements_helper.rb +0 -532
- data/lib/testcentricity/world_extensions.rb +0 -26
- data/my_templates/default/method_details/setup.rb +0 -3
- data/spec/testcentricity_spec.rb +0 -9
@@ -1,208 +0,0 @@
|
|
1
|
-
module TestCentricity
|
2
|
-
class SelectList < UIElement
|
3
|
-
attr_accessor :list_item
|
4
|
-
attr_accessor :selected_item
|
5
|
-
attr_accessor :list_trigger
|
6
|
-
|
7
|
-
def initialize(name, parent, locator, context)
|
8
|
-
super
|
9
|
-
@type = :selectlist
|
10
|
-
list_spec = {
|
11
|
-
:list_item => "li[class*='active-result']",
|
12
|
-
:selected_item => "li[class*='result-selected']",
|
13
|
-
:list_trigger => nil
|
14
|
-
}
|
15
|
-
define_list_elements(list_spec)
|
16
|
-
end
|
17
|
-
|
18
|
-
def define_list_elements(element_spec)
|
19
|
-
element_spec.each do |element, value|
|
20
|
-
case element
|
21
|
-
when :list_item
|
22
|
-
@list_item = value
|
23
|
-
when :selected_item
|
24
|
-
@selected_item = value
|
25
|
-
when :list_trigger
|
26
|
-
@list_trigger = value
|
27
|
-
else
|
28
|
-
raise "#{element} is not a recognized selectlist element"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Select the specified option in a select box object. Accepts a String or Hash.
|
34
|
-
# Supports standard HTML select objects and Chosen select objects.
|
35
|
-
#
|
36
|
-
# @param option [String] text of option to select
|
37
|
-
# OR
|
38
|
-
# @param option [Hash] :value, :index, or :text of option to select
|
39
|
-
#
|
40
|
-
# @example
|
41
|
-
# province_select.choose_option('Alberta')
|
42
|
-
# province_select.choose_option(:value => 'AB')
|
43
|
-
# state_select.choose_option(:index => 24)
|
44
|
-
# state_select.choose_option(:text => 'Maryland')
|
45
|
-
#
|
46
|
-
def choose_option(option)
|
47
|
-
obj, = find_element
|
48
|
-
object_not_found_exception(obj, nil)
|
49
|
-
if @list_trigger.nil?
|
50
|
-
obj.click
|
51
|
-
else
|
52
|
-
page.find(:css, @list_trigger).click
|
53
|
-
sleep(1)
|
54
|
-
end
|
55
|
-
if first(:css, @list_item)
|
56
|
-
if option.is_a?(Array)
|
57
|
-
option.each do |item|
|
58
|
-
page.find(:css, @list_item, text: item.strip).click
|
59
|
-
end
|
60
|
-
else
|
61
|
-
if option.is_a?(Hash)
|
62
|
-
page.find(:css, "#{@list_item}:nth-of-type(#{option[:index]})").click if option.has_key?(:index)
|
63
|
-
page.find(:css, "#{@list_item}:nth-of-type(#{option[:value]})").click if option.has_key?(:value)
|
64
|
-
page.find(:css, "#{@list_item}:nth-of-type(#{option[:text]})").click if option.has_key?(:text)
|
65
|
-
else
|
66
|
-
options = obj.all(@list_item).collect(&:text)
|
67
|
-
sleep(2) unless options.include?(option)
|
68
|
-
first(:css, @list_item, text: option).click
|
69
|
-
end
|
70
|
-
end
|
71
|
-
else
|
72
|
-
if option.is_a?(Array)
|
73
|
-
option.each do |item|
|
74
|
-
select_item(obj, item)
|
75
|
-
end
|
76
|
-
else
|
77
|
-
select_item(obj, option)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# Return array of strings of all options in a select box object.
|
83
|
-
# Supports standard HTML select objects and Chosen select objects.
|
84
|
-
#
|
85
|
-
# @return [Array]
|
86
|
-
# @example
|
87
|
-
# all_colors = color_select.get_options
|
88
|
-
#
|
89
|
-
def get_options
|
90
|
-
obj, = find_element
|
91
|
-
object_not_found_exception(obj, nil)
|
92
|
-
if first(:css, @list_item)
|
93
|
-
obj.all(@list_item).collect(&:text)
|
94
|
-
else
|
95
|
-
obj.all('option').collect(&:text)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
alias get_list_items get_options
|
100
|
-
|
101
|
-
# Return the number of options in a select box object.
|
102
|
-
# Supports standard HTML select objects and Chosen select objects.
|
103
|
-
#
|
104
|
-
# @return [Integer]
|
105
|
-
# @example
|
106
|
-
# num_colors = color_select.get_option_count
|
107
|
-
#
|
108
|
-
def get_option_count
|
109
|
-
obj, = find_element
|
110
|
-
object_not_found_exception(obj, nil)
|
111
|
-
if first(:css, @list_item)
|
112
|
-
obj.all(@list_item).count
|
113
|
-
else
|
114
|
-
obj.all('option').count
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
alias get_item_count get_option_count
|
119
|
-
|
120
|
-
def verify_options(expected, enqueue = false)
|
121
|
-
actual = get_options
|
122
|
-
enqueue ?
|
123
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}") :
|
124
|
-
assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
|
125
|
-
end
|
126
|
-
|
127
|
-
# Return text of first selected option in a select box object.
|
128
|
-
# Supports standard HTML select objects and Chosen select objects.
|
129
|
-
#
|
130
|
-
# @return [String]
|
131
|
-
# @example
|
132
|
-
# current_color = color_select.get_selected_option
|
133
|
-
#
|
134
|
-
def get_selected_option
|
135
|
-
obj, = find_element
|
136
|
-
object_not_found_exception(obj, nil)
|
137
|
-
if first(:css, @list_item)
|
138
|
-
obj.first(:css, @selected_item).text
|
139
|
-
else
|
140
|
-
obj.first('option[selected]').text
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
alias selected? get_selected_option
|
145
|
-
|
146
|
-
# Select the specified option in a Siebel OUI select box object.
|
147
|
-
#
|
148
|
-
# @param option [String] text of option to select
|
149
|
-
# @example
|
150
|
-
# country_select.choose_siebel_option('Cayman Islands')
|
151
|
-
#
|
152
|
-
def choose_siebel_option(option)
|
153
|
-
Capybara.wait_on_first_by_default = true
|
154
|
-
invoke_siebel_popup
|
155
|
-
first(:xpath, "//li[@class='ui-menu-item']", :exact => true, :match => :prefer_exact, text: option).click
|
156
|
-
end
|
157
|
-
|
158
|
-
# Return array of strings of all options in a Siebel OUI select box object.
|
159
|
-
#
|
160
|
-
# @return [Array]
|
161
|
-
# @example
|
162
|
-
# all_countries = country_select.get_siebel_options
|
163
|
-
#
|
164
|
-
def get_siebel_options
|
165
|
-
invoke_siebel_popup
|
166
|
-
sleep(0.5)
|
167
|
-
options = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
168
|
-
obj, = find_element
|
169
|
-
obj.native.send_keys(:escape)
|
170
|
-
options
|
171
|
-
end
|
172
|
-
|
173
|
-
def verify_siebel_options(expected, enqueue = false)
|
174
|
-
invoke_siebel_popup
|
175
|
-
sleep(0.5)
|
176
|
-
actual = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
177
|
-
enqueue ?
|
178
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}") :
|
179
|
-
assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
|
180
|
-
obj, = find_element
|
181
|
-
obj.native.send_keys(:escape)
|
182
|
-
end
|
183
|
-
|
184
|
-
# Is Siebel JComboBox set to read-only?
|
185
|
-
#
|
186
|
-
# @return [Boolean]
|
187
|
-
# @example
|
188
|
-
# country_select.read_only?
|
189
|
-
#
|
190
|
-
def read_only?
|
191
|
-
obj, = find_element
|
192
|
-
object_not_found_exception(obj, nil)
|
193
|
-
!obj.native.attribute('readonly')
|
194
|
-
end
|
195
|
-
|
196
|
-
private
|
197
|
-
|
198
|
-
def select_item(obj, option)
|
199
|
-
if option.is_a?(Hash)
|
200
|
-
obj.find("option[value='#{option[:value]}']").click if option.has_key?(:value)
|
201
|
-
obj.find(:xpath, "option[#{option[:index]}]").select_option if option.has_key?(:index)
|
202
|
-
obj.select option[:text] if option.has_key?(:text)
|
203
|
-
else
|
204
|
-
obj.select option
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module TestCentricity
|
2
|
-
class UIElement
|
3
|
-
def invoke_siebel_dialog(popup, seconds = nil)
|
4
|
-
invoke_siebel_popup
|
5
|
-
timeout = seconds.nil? ? 15 : seconds
|
6
|
-
popup.wait_until_exists(timeout)
|
7
|
-
end
|
8
|
-
|
9
|
-
def get_siebel_object_type
|
10
|
-
obj, = find_element
|
11
|
-
object_not_found_exception(obj, 'Siebel object')
|
12
|
-
obj.native.attribute('ot')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|