testcentricity_web 1.0.16 → 1.0.17
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/.gitignore +0 -0
- data/.rubocop.yml +41 -0
- data/.yardopts +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +9 -3
- data/Rakefile +0 -0
- data/lib/devices/devices.yml +0 -0
- data/lib/testcentricity_web.rb +16 -6
- data/lib/testcentricity_web/browser_helper.rb +6 -6
- data/lib/testcentricity_web/elements/button.rb +0 -0
- data/lib/testcentricity_web/elements/checkbox.rb +4 -4
- data/lib/testcentricity_web/elements/file_field.rb +1 -1
- data/lib/testcentricity_web/elements/image.rb +1 -1
- data/lib/testcentricity_web/elements/label.rb +0 -0
- data/lib/testcentricity_web/elements/link.rb +0 -0
- data/lib/testcentricity_web/elements/list.rb +5 -5
- data/lib/testcentricity_web/elements/radio.rb +3 -3
- data/lib/testcentricity_web/elements/select_list.rb +16 -16
- data/lib/testcentricity_web/elements/table.rb +3 -4
- data/lib/testcentricity_web/elements/textfield.rb +4 -4
- data/lib/testcentricity_web/environment.rb +30 -2
- data/lib/testcentricity_web/excel_helper.rb +12 -12
- data/lib/testcentricity_web/exception_queue_helper.rb +1 -1
- data/lib/testcentricity_web/page_objects_helper.rb +102 -102
- data/lib/testcentricity_web/page_sections_helper.rb +112 -112
- data/lib/testcentricity_web/siebel_open_ui_helper.rb +1 -1
- data/lib/testcentricity_web/ui_elements_helper.rb +45 -45
- data/lib/testcentricity_web/utility_helpers.rb +0 -0
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/webdriver_helper.rb +79 -70
- data/lib/testcentricity_web/world_extensions.rb +0 -0
- data/testcentricity_web.gemspec +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96822ca8dbde37ff287240b75b43b772718a1234
|
4
|
+
data.tar.gz: c6280b47bb8bcabdd341c4e1b4ca7c4e2d51ff10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f85fadd19e3fdb2ece83f9258dc2436cfe7d329e6f70ad103657403e3dda2a209b7cf12e61272340c4f0d5b0c5d8e0a42df019f7c459f98904cb7a22bc55ec3
|
7
|
+
data.tar.gz: 7c3ed7f24c11c96c87ef8bc9d362493bcf29d6b9fcd15bf488f00faccf7c0d036ba1ceadfbe2afb8f5c7eb9bfb6af1af4fc392a81ddf52d838e51503129a7b23
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# See full list of defaults here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
# To see all cops used see here: https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
|
3
|
+
|
4
|
+
Documentation:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
AccessorMethodName:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
TrivialAccessors:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
RedundantReturn:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/ModuleLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/ClassLength:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Encoding:
|
23
|
+
EnforcedStyle: when_needed
|
24
|
+
|
25
|
+
Metrics/LineLength:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Metrics/MethodLength:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/RegexpLiteral:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/HashSyntax:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Metrics/CyclomaticComplexity:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/EmptyLines:
|
41
|
+
Enabled: false
|
data/.yardopts
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -18,7 +18,8 @@ The TestCentricity™ Web gem supports running automated tests against the follo
|
|
18
18
|
|
19
19
|
|
20
20
|
**Note:** Test execution against local instances of Firefox version 48 or greater is currently not supported by the TestCentricity™ Web gem. Testing with
|
21
|
-
Firefox 48 or greater requires Marionette (aka geckodriver) and selenium-webdriver version 3.x, both of which are currently
|
21
|
+
locally hosted instances of Firefox 48 or greater requires Marionette (aka geckodriver) and selenium-webdriver version 3.x, both of which are currently
|
22
|
+
feature incomplete and potentially unstable. More information can be found [here](https://github.com/teamcapybara/capybara/issues/1710).
|
22
23
|
|
23
24
|
|
24
25
|
## Installation
|
@@ -233,11 +234,11 @@ the UI to hide implementation details, as shown below:
|
|
233
234
|
# verify Login page default UI state
|
234
235
|
def verify_page_ui
|
235
236
|
ui = {
|
236
|
-
login_button => { :visible => true, :
|
237
|
+
login_button => { :visible => true, :caption => 'LOGIN' },
|
237
238
|
user_id_field => { :visible => true, :enabled => true },
|
238
239
|
password_field => { :visible => true, :enabled => true, :value => '', :placeholder => 'Password' },
|
239
240
|
remember_checkbox => { :exists => true, :enabled => true, :checked => false },
|
240
|
-
forgot_password_link => { :visible => true, :
|
241
|
+
forgot_password_link => { :visible => true, :caption => 'Forgot your password?' },
|
241
242
|
error_message_label => { :visible => false }
|
242
243
|
}
|
243
244
|
verify_ui_states(ui)
|
@@ -838,6 +839,11 @@ service(s) that you intend to connect with.
|
|
838
839
|
bs_mobile: --profile browserstack <%= mobile %>
|
839
840
|
|
840
841
|
# BrowserStack OS X desktop browser profiles
|
842
|
+
bs_macos_sierra: --profile bs_desktop BS_OS="OS X" BS_OS_VERSION="Sierra"
|
843
|
+
bs_ff_sierra: --profile bs_macos_sierra BS_BROWSER="Firefox"
|
844
|
+
bs_chrome_sierra: --profile bs_macos_sierra BS_BROWSER="Chrome"
|
845
|
+
bs_safari_sierra: --profile bs_macos_sierra BS_BROWSER="Safari"
|
846
|
+
|
841
847
|
bs_osx_el_capitan: --profile bs_desktop BS_OS="OS X" BS_OS_VERSION="El Capitan"
|
842
848
|
bs_ff_el_cap: --profile bs_osx_el_capitan BS_BROWSER="Firefox"
|
843
849
|
bs_chrome_el_cap: --profile bs_osx_el_capitan BS_BROWSER="Chrome"
|
data/Rakefile
CHANGED
File without changes
|
data/lib/devices/devices.yml
CHANGED
File without changes
|
data/lib/testcentricity_web.rb
CHANGED
@@ -38,10 +38,10 @@ module TestCentricity
|
|
38
38
|
|
39
39
|
def self.register_page_objects(pages)
|
40
40
|
result = ''
|
41
|
-
pages.each do |
|
41
|
+
pages.each do |page_object, page_class|
|
42
42
|
obj = page_class.new
|
43
43
|
@page_objects[page_object] = obj unless @page_objects.has_key?(page_object)
|
44
|
-
page_key = obj.page_name.gsub(/\s+/,
|
44
|
+
page_key = obj.page_name.gsub(/\s+/, '').downcase.to_sym
|
45
45
|
if page_key != page_object
|
46
46
|
@page_objects[page_key] = obj unless @page_objects.has_key?(page_key)
|
47
47
|
end
|
@@ -57,11 +57,11 @@ module TestCentricity
|
|
57
57
|
# TestCentricity::PageManager.loaded?
|
58
58
|
#
|
59
59
|
def self.loaded?
|
60
|
-
|
60
|
+
!@page_objects.empty?
|
61
61
|
end
|
62
62
|
|
63
63
|
def self.find_page(page_name)
|
64
|
-
(page_name.is_a? String) ? page_id = page_name.gsub(/\s+/,
|
64
|
+
(page_name.is_a? String) ? page_id = page_name.gsub(/\s+/, '').downcase.to_sym : page_id = page_name
|
65
65
|
@page_objects[page_id]
|
66
66
|
end
|
67
67
|
|
@@ -75,6 +75,16 @@ module TestCentricity
|
|
75
75
|
@current_page
|
76
76
|
end
|
77
77
|
|
78
|
+
# Sets the currently active PageObject
|
79
|
+
#
|
80
|
+
# @param page [PageObject] Reference to the active PageObject
|
81
|
+
# @example
|
82
|
+
# TestCentricity::PageManager.current_page = product_search_page
|
83
|
+
#
|
84
|
+
def self.current_page=(page)
|
85
|
+
@current_page = page
|
86
|
+
end
|
87
|
+
|
78
88
|
# Sets the currently active PageObject
|
79
89
|
#
|
80
90
|
# @param page [PageObject] Reference to the active PageObject
|
@@ -92,7 +102,7 @@ module TestCentricity
|
|
92
102
|
|
93
103
|
def self.register_data_objects(data)
|
94
104
|
result = ''
|
95
|
-
data.each do |
|
105
|
+
data.each do |data_type, data_class|
|
96
106
|
@data_objects[data_type] = data_class.new unless @data_objects.has_key?(data_type)
|
97
107
|
result = "#{result}def #{data_type.to_s};@#{data_type.to_s} ||= TestCentricity::DataManager.find_data_object(:#{data_type.to_s});end;"
|
98
108
|
end
|
@@ -110,7 +120,7 @@ module TestCentricity
|
|
110
120
|
# TestCentricity::DataManager.loaded?
|
111
121
|
#
|
112
122
|
def self.loaded?
|
113
|
-
|
123
|
+
!@data_objects.empty?
|
114
124
|
end
|
115
125
|
end
|
116
126
|
end
|
@@ -65,7 +65,7 @@ module TestCentricity
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def self.suppress_js_alerts
|
68
|
-
Capybara.page.execute_script(
|
68
|
+
Capybara.page.execute_script('window.alert = function() {}')
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.suppress_js_leave_page_modal
|
@@ -75,7 +75,7 @@ module TestCentricity
|
|
75
75
|
def self.delete_all_cookies
|
76
76
|
if Capybara.current_driver == :selenium
|
77
77
|
browser = Capybara.current_session.driver.browser
|
78
|
-
if browser.respond_to?(:manage)
|
78
|
+
if browser.respond_to?(:manage) && browser.manage.respond_to?(:delete_all_cookies)
|
79
79
|
browser.manage.delete_all_cookies
|
80
80
|
else
|
81
81
|
raise 'Could not clear cookies.'
|
@@ -92,7 +92,7 @@ module TestCentricity
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def self.mobile_device_agent(device)
|
95
|
-
device_name = device.gsub(/\s+/,
|
95
|
+
device_name = device.gsub(/\s+/, '').downcase.to_sym
|
96
96
|
device = get_devices[device_name]
|
97
97
|
agent_string = device[:user_agent]
|
98
98
|
raise "Device '#{device}' is not defined" unless agent_string
|
@@ -100,7 +100,7 @@ module TestCentricity
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def self.mobile_device_name(device)
|
103
|
-
device_name = device.gsub(/\s+/,
|
103
|
+
device_name = device.gsub(/\s+/, '').downcase.to_sym
|
104
104
|
device = get_devices[device_name]
|
105
105
|
name = device[:name]
|
106
106
|
raise "Device '#{device}' is not defined" unless name
|
@@ -108,7 +108,7 @@ module TestCentricity
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def self.browser_size(browser, orientation)
|
111
|
-
device_name = browser.gsub(/\s+/,
|
111
|
+
device_name = browser.gsub(/\s+/, '').downcase.to_sym
|
112
112
|
device = get_devices[device_name]
|
113
113
|
if device
|
114
114
|
width = device[:css_width]
|
@@ -130,7 +130,7 @@ module TestCentricity
|
|
130
130
|
private
|
131
131
|
|
132
132
|
def self.get_devices
|
133
|
-
YAML.load_file File.expand_path(
|
133
|
+
YAML.load_file File.expand_path('../../devices/devices.yml', __FILE__)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
File without changes
|
@@ -19,7 +19,7 @@ module TestCentricity
|
|
19
19
|
# remember_me_checkbox.exists?
|
20
20
|
#
|
21
21
|
def exists?
|
22
|
-
obj,
|
22
|
+
obj, = find_object(:all)
|
23
23
|
obj != nil
|
24
24
|
end
|
25
25
|
|
@@ -30,7 +30,7 @@ module TestCentricity
|
|
30
30
|
# remember_me_checkbox.checked?
|
31
31
|
#
|
32
32
|
def checked?
|
33
|
-
obj,
|
33
|
+
obj, = find_element(:all)
|
34
34
|
object_not_found_exception(obj, 'Checkbox')
|
35
35
|
obj.checked?
|
36
36
|
end
|
@@ -42,7 +42,7 @@ module TestCentricity
|
|
42
42
|
# remember_me_checkbox.set_checkbox_state(true)
|
43
43
|
#
|
44
44
|
def set_checkbox_state(state)
|
45
|
-
obj,
|
45
|
+
obj, = find_element(:all)
|
46
46
|
object_not_found_exception(obj, 'Checkbox')
|
47
47
|
invalid_object_type_exception(obj, 'checkbox')
|
48
48
|
if @proxy.nil?
|
@@ -89,7 +89,7 @@ module TestCentricity
|
|
89
89
|
# remember_me_checkbox.set_siebel_checkbox_state(true)
|
90
90
|
#
|
91
91
|
def set_siebel_checkbox_state(state)
|
92
|
-
obj,
|
92
|
+
obj, = find_element
|
93
93
|
object_not_found_exception(obj, 'Siebel checkbox')
|
94
94
|
raise "UI #{object_ref_message} is not a Siebel CheckBox object" unless get_siebel_object_type == 'JCheckBox'
|
95
95
|
expected = state.to_bool
|
@@ -12,7 +12,7 @@ module TestCentricity
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def drop_files(files)
|
15
|
-
js_script =
|
15
|
+
js_script = 'fileList = Array();'
|
16
16
|
files.count.times do |i|
|
17
17
|
# generate a fake input selector
|
18
18
|
page.execute_script("if ($('#seleniumUpload#{i}').length == 0) { seleniumUpload#{i} = window.$('<input/>').attr({id: 'seleniumUpload#{i}', type:'file'}).appendTo('body'); }")
|
File without changes
|
File without changes
|
@@ -9,23 +9,23 @@ module TestCentricity
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def define_list_elements(element_spec)
|
12
|
-
element_spec.each do |
|
12
|
+
element_spec.each do |element, value|
|
13
13
|
case element
|
14
|
-
|
15
|
-
|
14
|
+
when :list_item
|
15
|
+
@list_item = value
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_list_items(element_spec = nil)
|
21
21
|
define_list_elements(element_spec) unless element_spec.nil?
|
22
|
-
obj,
|
22
|
+
obj, = find_element
|
23
23
|
object_not_found_exception(obj, nil)
|
24
24
|
obj.all(@list_item).collect(&:text)
|
25
25
|
end
|
26
26
|
|
27
27
|
def get_item_count
|
28
|
-
obj,
|
28
|
+
obj, = find_element
|
29
29
|
object_not_found_exception(obj, nil)
|
30
30
|
obj.all(@list_item).count
|
31
31
|
end
|
@@ -19,7 +19,7 @@ module TestCentricity
|
|
19
19
|
# accept_terms_radio.exists?
|
20
20
|
#
|
21
21
|
def exists?
|
22
|
-
obj,
|
22
|
+
obj, = find_object(:all)
|
23
23
|
obj != nil
|
24
24
|
end
|
25
25
|
|
@@ -30,7 +30,7 @@ module TestCentricity
|
|
30
30
|
# accept_terms_radio.selected?
|
31
31
|
#
|
32
32
|
def selected?
|
33
|
-
obj,
|
33
|
+
obj, = find_element(:all)
|
34
34
|
object_not_found_exception(obj, 'Radio')
|
35
35
|
obj.checked?
|
36
36
|
end
|
@@ -42,7 +42,7 @@ module TestCentricity
|
|
42
42
|
# accept_terms_radio.set_selected_state(true)
|
43
43
|
#
|
44
44
|
def set_selected_state(state)
|
45
|
-
obj,
|
45
|
+
obj, = find_element(:all)
|
46
46
|
object_not_found_exception(obj, 'Radio')
|
47
47
|
invalid_object_type_exception(obj, 'radio')
|
48
48
|
if @proxy.nil?
|
@@ -14,12 +14,12 @@ module TestCentricity
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def define_list_elements(element_spec)
|
17
|
-
element_spec.each do |
|
17
|
+
element_spec.each do |element, value|
|
18
18
|
case element
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
when :list_item
|
20
|
+
@list_item = value
|
21
|
+
when :selected_item
|
22
|
+
@selected_item = value
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -38,7 +38,7 @@ module TestCentricity
|
|
38
38
|
# state_select.choose_option(:text => 'Maryland')
|
39
39
|
#
|
40
40
|
def choose_option(option)
|
41
|
-
obj,
|
41
|
+
obj, = find_element
|
42
42
|
object_not_found_exception(obj, nil)
|
43
43
|
obj.click
|
44
44
|
if first(:css, 'li.active-result')
|
@@ -68,7 +68,7 @@ module TestCentricity
|
|
68
68
|
# all_colors = color_select.get_options
|
69
69
|
#
|
70
70
|
def get_options
|
71
|
-
obj,
|
71
|
+
obj, = find_element
|
72
72
|
object_not_found_exception(obj, nil)
|
73
73
|
if first(:css, 'li.active-result')
|
74
74
|
obj.all('li.active-result').collect(&:text)
|
@@ -77,7 +77,7 @@ module TestCentricity
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
alias
|
80
|
+
alias get_list_items get_options
|
81
81
|
|
82
82
|
# Return the number of options in a select box object.
|
83
83
|
# Supports standard HTML select objects and Chosen select objects.
|
@@ -87,7 +87,7 @@ module TestCentricity
|
|
87
87
|
# num_colors = color_select.get_option_count
|
88
88
|
#
|
89
89
|
def get_option_count
|
90
|
-
obj,
|
90
|
+
obj, = find_element
|
91
91
|
object_not_found_exception(obj, nil)
|
92
92
|
if first(:css, 'li.active-result')
|
93
93
|
obj.all('li.active-result').count
|
@@ -96,7 +96,7 @@ module TestCentricity
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
alias
|
99
|
+
alias get_item_count get_option_count
|
100
100
|
|
101
101
|
def verify_options(expected, enqueue = false)
|
102
102
|
actual = get_options
|
@@ -113,7 +113,7 @@ module TestCentricity
|
|
113
113
|
# current_color = color_select.get_selected_option
|
114
114
|
#
|
115
115
|
def get_selected_option
|
116
|
-
obj,
|
116
|
+
obj, = find_element
|
117
117
|
object_not_found_exception(obj, nil)
|
118
118
|
if first(:css, 'li.active-result')
|
119
119
|
obj.first("//li[contains(@class, 'result-selected')]").text
|
@@ -122,7 +122,7 @@ module TestCentricity
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
alias
|
125
|
+
alias selected? get_selected_option
|
126
126
|
|
127
127
|
# Select the specified option in a Siebel OUI select box object.
|
128
128
|
#
|
@@ -146,7 +146,7 @@ module TestCentricity
|
|
146
146
|
invoke_siebel_popup
|
147
147
|
sleep(0.5)
|
148
148
|
options = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
149
|
-
obj,
|
149
|
+
obj, = find_element
|
150
150
|
obj.native.send_keys(:escape)
|
151
151
|
options
|
152
152
|
end
|
@@ -158,7 +158,7 @@ module TestCentricity
|
|
158
158
|
enqueue ?
|
159
159
|
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}") :
|
160
160
|
assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
|
161
|
-
obj,
|
161
|
+
obj, = find_element
|
162
162
|
obj.native.send_keys(:escape)
|
163
163
|
end
|
164
164
|
|
@@ -169,9 +169,9 @@ module TestCentricity
|
|
169
169
|
# country_select.read_only?
|
170
170
|
#
|
171
171
|
def read_only?
|
172
|
-
obj,
|
172
|
+
obj, = find_element
|
173
173
|
object_not_found_exception(obj, nil)
|
174
|
-
|
174
|
+
!obj.native.attribute('readonly')
|
175
175
|
end
|
176
176
|
|
177
177
|
private
|
@@ -22,13 +22,12 @@ module TestCentricity
|
|
22
22
|
:header_row => 'tr',
|
23
23
|
:header_column => 'th',
|
24
24
|
:tree_expand => "div/div[contains(@class, 'tree-plus treeclick')]",
|
25
|
-
:tree_collapse => "div/div[contains(@class, 'tree-minus treeclick')]"
|
26
|
-
}
|
25
|
+
:tree_collapse => "div/div[contains(@class, 'tree-minus treeclick')]" }
|
27
26
|
define_table_elements(table_spec)
|
28
27
|
end
|
29
28
|
|
30
29
|
def define_table_elements(element_spec)
|
31
|
-
element_spec.each do |
|
30
|
+
element_spec.each do |element, value|
|
32
31
|
case element
|
33
32
|
when :table_body
|
34
33
|
@table_body = value
|
@@ -356,7 +355,7 @@ module TestCentricity
|
|
356
355
|
#
|
357
356
|
def populate_table_row(row, data)
|
358
357
|
wait_until_exists(2)
|
359
|
-
data.each do |
|
358
|
+
data.each do |column, data_param|
|
360
359
|
unless data_param.blank?
|
361
360
|
if data_param == '!DELETE'
|
362
361
|
set_table_cell(row, column, '')
|