testcentricity_web 4.0.3 → 4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +64 -0
- data/Gemfile.lock +23 -21
- data/LICENSE.md +1 -1
- data/README.md +557 -611
- data/lib/devices/devices.yml +0 -16
- data/lib/testcentricity_web/appium_server.rb +1 -1
- data/lib/testcentricity_web/data_objects/environment.rb +27 -9
- data/lib/testcentricity_web/exception_queue_helper.rb +5 -5
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +18 -20
- data/lib/testcentricity_web/web_core/page_section.rb +19 -21
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +348 -372
- data/lib/testcentricity_web/web_elements/checkbox.rb +33 -32
- data/lib/testcentricity_web/web_elements/radio.rb +33 -32
- data/lib/testcentricity_web/web_elements/select_list.rb +0 -14
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +17 -1
- data/test_site/test_page.html +11 -0
- data/testcentricity_web.gemspec +7 -8
- metadata +22 -17
- data/my_templates/default/method_details/setup.rb +0 -3
data/lib/devices/devices.yml
CHANGED
@@ -134,14 +134,6 @@
|
|
134
134
|
:css_height: 869
|
135
135
|
:default_orientation: portrait
|
136
136
|
:user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Mobile/15E148 Safari/604.1"
|
137
|
-
:android_phone:
|
138
|
-
:name: "Generic Android phone"
|
139
|
-
:os: android
|
140
|
-
:type: phone
|
141
|
-
:css_width: 360
|
142
|
-
:css_height: 640
|
143
|
-
:default_orientation: portrait
|
144
|
-
:user_agent: "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"
|
145
137
|
nexus6:
|
146
138
|
:name: "Nexus 6 or 6P phone"
|
147
139
|
:os: android
|
@@ -302,14 +294,6 @@ nexus6:
|
|
302
294
|
:css_height: 768
|
303
295
|
:default_orientation: landscape
|
304
296
|
:user_agent: "Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 EdgiOS/44.2.1 Mobile/15E148 Safari/605.1.15"
|
305
|
-
:android_tablet:
|
306
|
-
:name: "Generic Android tablet"
|
307
|
-
:os: android
|
308
|
-
:type: tablet
|
309
|
-
:css_width: 1024
|
310
|
-
:css_height: 768
|
311
|
-
:default_orientation: landscape
|
312
|
-
:user_agent: "Mozilla/5.0 (Linux; U; Android 3.0; en-us; GT-P7100 Build/HRI83) AppleWebkit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13"
|
313
297
|
:kindle_fire:
|
314
298
|
:name: "Kindle Fire"
|
315
299
|
:os: kindle
|
@@ -26,7 +26,7 @@ module TestCentricity
|
|
26
26
|
puts 'Appium Server is starting'
|
27
27
|
end
|
28
28
|
# start new Appium Server
|
29
|
-
@process = ChildProcess.build
|
29
|
+
@process = ChildProcess.build
|
30
30
|
process.start
|
31
31
|
# wait until confirmation that Appium Server is running
|
32
32
|
wait = Selenium::WebDriver::Wait.new(timeout: 30)
|
@@ -5,6 +5,8 @@ module TestCentricity
|
|
5
5
|
attr_accessor :environ_specific_data
|
6
6
|
|
7
7
|
def self.find_environ(environ_name, source_type = :excel)
|
8
|
+
raise 'No environment specified' if environ_name.nil?
|
9
|
+
|
8
10
|
data = case source_type
|
9
11
|
when :excel
|
10
12
|
ExcelData.read_row_data(XL_PRIMARY_DATA_FILE, 'Environments', environ_name)
|
@@ -13,11 +15,27 @@ module TestCentricity
|
|
13
15
|
@generic_data ||= YAML.load_file(YML_PRIMARY_DATA_FILE)
|
14
16
|
# read environment specific test data
|
15
17
|
data_file = "#{PRIMARY_DATA_PATH}#{environ_name}_data.yml"
|
16
|
-
@environ_specific_data
|
18
|
+
@environ_specific_data = if File.exist?(data_file)
|
19
|
+
YAML.load_file(data_file)
|
20
|
+
else
|
21
|
+
{}
|
22
|
+
end
|
17
23
|
|
18
24
|
read('Environments', environ_name)
|
19
25
|
when :json
|
20
|
-
|
26
|
+
# read generic test data from data.json file
|
27
|
+
raw_data = File.read(JSON_PRIMARY_DATA_FILE)
|
28
|
+
@generic_data = JSON.parse(raw_data)
|
29
|
+
# read environment specific test data
|
30
|
+
data_file = "#{PRIMARY_DATA_PATH}#{environ_name}_data.json"
|
31
|
+
@environ_specific_data = if File.exist?(data_file)
|
32
|
+
raw_data = File.read(data_file)
|
33
|
+
JSON.parse(raw_data)
|
34
|
+
else
|
35
|
+
{}
|
36
|
+
end
|
37
|
+
|
38
|
+
read('Environments', environ_name)
|
21
39
|
end
|
22
40
|
@current = Environ.new(data)
|
23
41
|
Environ.current = @current
|
@@ -47,6 +65,9 @@ module TestCentricity
|
|
47
65
|
@session_id = Time.now.strftime('%d%H%M%S%L')
|
48
66
|
@session_time_stamp = Time.now.strftime('%Y%m%d%H%M%S')
|
49
67
|
@test_environment = ENV['TEST_ENVIRONMENT']
|
68
|
+
@a11y_standard = ENV['ACCESSIBILITY_STANDARD'] || 'best-practice'
|
69
|
+
@locale = ENV['LOCALE'] || 'en'
|
70
|
+
@language = ENV['LANGUAGE'] || 'English'
|
50
71
|
@screen_shots = []
|
51
72
|
|
52
73
|
attr_accessor :test_environment
|
@@ -111,9 +132,6 @@ module TestCentricity
|
|
111
132
|
@dns = data['DNS']
|
112
133
|
@db_username = data['DB_USERNAME']
|
113
134
|
@db_password = data['DB_PASSWORD']
|
114
|
-
@a11y_standard = ENV['ACCESSIBILITY_STANDARD'] || 'best-practice'
|
115
|
-
@locale = ENV['LOCALE'] || 'en'
|
116
|
-
@language = ENV['LANGUAGE'] || 'English'
|
117
135
|
|
118
136
|
super
|
119
137
|
end
|
@@ -365,13 +383,13 @@ module TestCentricity
|
|
365
383
|
def self.report_header
|
366
384
|
report_header = "\n<b><u>TEST ENVIRONMENT</u>:</b> #{ENV['TEST_ENVIRONMENT']}\n"\
|
367
385
|
" <b>Browser:</b>\t #{Environ.browser.capitalize}\n"
|
368
|
-
report_header = "#{report_header} <b>Device:</b>\t
|
386
|
+
report_header = "#{report_header} <b>Device:</b>\t #{Environ.device_name}\n" if Environ.device_name
|
369
387
|
report_header = "#{report_header} <b>Device OS:</b>\t #{Environ.device_os} #{Environ.device_os_version}\n" if Environ.device_os
|
370
388
|
report_header = "#{report_header} <b>Device type:</b>\t #{Environ.device_type}\n" if Environ.device_type
|
371
|
-
report_header = "#{report_header} <b>Driver:</b>\t
|
389
|
+
report_header = "#{report_header} <b>Driver:</b>\t #{Environ.driver}\n" if Environ.driver
|
372
390
|
report_header = "#{report_header} <b>Grid:</b>\t\t #{Environ.grid}\n" if Environ.grid
|
373
|
-
report_header = "#{report_header} <b>OS:</b>\t\t
|
374
|
-
report_header = "#{report_header} <b>Locale:</b>\t
|
391
|
+
report_header = "#{report_header} <b>OS:</b>\t\t #{Environ.os}\n" if Environ.os
|
392
|
+
report_header = "#{report_header} <b>Locale:</b>\t #{Environ.locale}\n" if Environ.locale
|
375
393
|
report_header = "#{report_header} <b>Language:</b>\t #{Environ.language}\n" if Environ.language
|
376
394
|
report_header = "#{report_header} <b>Country:</b>\t #{ENV['COUNTRY']}\n" if ENV['COUNTRY']
|
377
395
|
report_header = "#{report_header} <b>WCAG Accessibility Standard:</b>\t #{ENV['ACCESSIBILITY_STANDARD']}\n" if ENV['ACCESSIBILITY_STANDARD']
|
@@ -116,8 +116,8 @@ module TestCentricity
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def self.enqueue_screenshot
|
119
|
-
timestamp = Time.now.strftime('%Y%m%d%H%M%S')
|
120
|
-
filename = "Screenshot-#{timestamp}"
|
119
|
+
timestamp = Time.now.strftime('%Y%m%d%H%M%S%L')
|
120
|
+
filename = "Screenshot-#{timestamp}.png"
|
121
121
|
path = File.join Dir.pwd, 'reports/screenshots/', filename
|
122
122
|
# highlight the active UI element prior to taking a screenshot
|
123
123
|
unless @active_ui_element.nil? || @mru_ui_element == @active_ui_element
|
@@ -126,14 +126,14 @@ module TestCentricity
|
|
126
126
|
end
|
127
127
|
# take screenshot
|
128
128
|
if Environ.driver == :appium
|
129
|
-
AppiumConnect.take_screenshot(
|
129
|
+
AppiumConnect.take_screenshot(path)
|
130
130
|
else
|
131
|
-
Capybara.save_screenshot
|
131
|
+
Capybara.save_screenshot path
|
132
132
|
end
|
133
133
|
# unhighlight the active UI element
|
134
134
|
@mru_ui_element.unhighlight unless @mru_ui_element.blank?
|
135
135
|
# add screenshot to queue
|
136
|
-
puts "Screenshot saved at #{path}
|
136
|
+
puts "Screenshot saved at #{path}"
|
137
137
|
screen_shot = {path: path, filename: filename}
|
138
138
|
Environ.save_screen_shot(screen_shot)
|
139
139
|
end
|
@@ -39,9 +39,9 @@ module TestCentricity
|
|
39
39
|
#
|
40
40
|
# @param element_hash [Hash] names of buttons (as a symbol) and CSS selectors or XPath expressions that uniquely identifies buttons
|
41
41
|
# @example
|
42
|
-
# buttons new_account_button:
|
43
|
-
# save_button:
|
44
|
-
# cancel_button:
|
42
|
+
# buttons new_account_button: 'button#new-account',
|
43
|
+
# save_button: 'button#save',
|
44
|
+
# cancel_button: 'button#cancel'
|
45
45
|
#
|
46
46
|
def self.buttons(element_hash)
|
47
47
|
element_hash.each(&method(:button))
|
@@ -63,11 +63,11 @@ module TestCentricity
|
|
63
63
|
#
|
64
64
|
# @param element_hash [Hash] names of text fields (as a symbol) and CSS selectors or XPath expressions that uniquely identifies text fields
|
65
65
|
# @example
|
66
|
-
# textfields name_field:
|
67
|
-
# title_field:
|
68
|
-
# phone_field:
|
69
|
-
# fax_field:
|
70
|
-
# email_field:
|
66
|
+
# textfields name_field: 'input#Name',
|
67
|
+
# title_field: 'input#Title',
|
68
|
+
# phone_field: 'input#PhoneNumber',
|
69
|
+
# fax_field: 'input#FaxNumber',
|
70
|
+
# email_field: 'input#Email'
|
71
71
|
#
|
72
72
|
def self.textfields(element_hash)
|
73
73
|
element_hash.each(&method(:textfield))
|
@@ -100,23 +100,22 @@ module TestCentricity
|
|
100
100
|
#
|
101
101
|
# @param element_name [Symbol] name of checkbox object (as a symbol)
|
102
102
|
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
103
|
-
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
104
103
|
# @example
|
105
104
|
# checkbox :remember_checkbox, "//input[@id='RememberUser']"
|
106
|
-
# checkbox :accept_terms_checkbox, 'input#accept_terms_conditions'
|
105
|
+
# checkbox :accept_terms_checkbox, 'input#accept_terms_conditions'
|
107
106
|
#
|
108
|
-
def self.checkbox(element_name, locator
|
109
|
-
|
107
|
+
def self.checkbox(element_name, locator)
|
108
|
+
define_page_element(element_name, TestCentricity::CheckBox, locator)
|
110
109
|
end
|
111
110
|
|
112
111
|
# Declare and instantiate a collection of checkboxes for this page object.
|
113
112
|
#
|
114
113
|
# @param element_hash [Hash] names of checkboxes (as a symbol) and CSS selectors or XPath expressions that uniquely identifies checkboxes
|
115
114
|
# @example
|
116
|
-
# checkboxes hazmat_certified_check:
|
117
|
-
# epa_certified_check:
|
118
|
-
# dhs_certified_check:
|
119
|
-
# carb_compliant_check:
|
115
|
+
# checkboxes hazmat_certified_check: 'input#hazmatCertified',
|
116
|
+
# epa_certified_check: 'input#epaCertified',
|
117
|
+
# dhs_certified_check: 'input#homelandSecurityCertified',
|
118
|
+
# carb_compliant_check: 'input#carbCompliant'
|
120
119
|
#
|
121
120
|
def self.checkboxes(element_hash)
|
122
121
|
element_hash.each(&method(:checkbox))
|
@@ -126,13 +125,12 @@ module TestCentricity
|
|
126
125
|
#
|
127
126
|
# @param element_name [Symbol] name of radio object (as a symbol)
|
128
127
|
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
129
|
-
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
130
128
|
# @example
|
131
129
|
# radio :accept_terms_radio, "//input[@id='Accept_Terms']"
|
132
|
-
# radio :decline_terms_radio, '#decline_terms_conditions'
|
130
|
+
# radio :decline_terms_radio, '#decline_terms_conditions'
|
133
131
|
#
|
134
|
-
def self.radio(element_name, locator
|
135
|
-
|
132
|
+
def self.radio(element_name, locator)
|
133
|
+
define_page_element(element_name, TestCentricity::Radio, locator)
|
136
134
|
end
|
137
135
|
|
138
136
|
# Declare and instantiate a collection of radio buttons for this page object.
|
@@ -124,8 +124,8 @@ module TestCentricity
|
|
124
124
|
# @param element_name [Symbol] name of UI object (as a symbol)
|
125
125
|
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
126
126
|
# @example
|
127
|
-
# element :undo_record_item,
|
128
|
-
# element :basket_header,
|
127
|
+
# element :undo_record_item, "//li[@rn='Undo Record']/a"
|
128
|
+
# element :basket_header, 'div.basket_header'
|
129
129
|
#
|
130
130
|
def self.element(element_name, locator)
|
131
131
|
define_element(element_name, TestCentricity::UIElement, locator)
|
@@ -159,9 +159,9 @@ module TestCentricity
|
|
159
159
|
#
|
160
160
|
# @param element_hash [Hash] names of buttons (as a symbol) and CSS selectors or XPath expressions that uniquely identifies buttons
|
161
161
|
# @example
|
162
|
-
# buttons new_account_button:
|
163
|
-
# save_button:
|
164
|
-
# cancel_button:
|
162
|
+
# buttons new_account_button: 'button#new-account',
|
163
|
+
# save_button: 'button#save',
|
164
|
+
# cancel_button: 'button#cancel'
|
165
165
|
#
|
166
166
|
def self.buttons(element_hash)
|
167
167
|
element_hash.each(&method(:button))
|
@@ -183,11 +183,11 @@ module TestCentricity
|
|
183
183
|
#
|
184
184
|
# @param element_hash [Hash] names of text fields (as a symbol) and CSS selectors or XPath expressions that uniquely identifies text fields
|
185
185
|
# @example
|
186
|
-
# textfields name_field:
|
187
|
-
# title_field:
|
188
|
-
# phone_field:
|
189
|
-
# fax_field:
|
190
|
-
# email_field:
|
186
|
+
# textfields name_field: 'input#Name',
|
187
|
+
# title_field: 'input#Title',
|
188
|
+
# phone_field: 'input#PhoneNumber',
|
189
|
+
# fax_field: 'input#FaxNumber',
|
190
|
+
# email_field: 'input#Email'
|
191
191
|
#
|
192
192
|
def self.textfields(element_hash)
|
193
193
|
element_hash.each(&method(:textfield))
|
@@ -220,23 +220,22 @@ module TestCentricity
|
|
220
220
|
#
|
221
221
|
# @param element_name [Symbol] name of checkbox object (as a symbol)
|
222
222
|
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
223
|
-
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
224
223
|
# @example
|
225
224
|
# checkbox :remember_checkbox, "//input[@id='RememberUser']"
|
226
|
-
# checkbox :accept_terms_checkbox, 'input#accept_terms_conditions'
|
225
|
+
# checkbox :accept_terms_checkbox, 'input#accept_terms_conditions'
|
227
226
|
#
|
228
|
-
def self.checkbox(element_name, locator
|
229
|
-
|
227
|
+
def self.checkbox(element_name, locator)
|
228
|
+
define_element(element_name, TestCentricity::CheckBox, locator)
|
230
229
|
end
|
231
230
|
|
232
231
|
# Declare and instantiate a collection of checkboxes for this page section.
|
233
232
|
#
|
234
233
|
# @param element_hash [Hash] names of checkboxes (as a symbol) and CSS selectors or XPath expressions that uniquely identifies checkboxes
|
235
234
|
# @example
|
236
|
-
# checkboxes hazmat_certified_check:
|
237
|
-
# epa_certified_check:
|
238
|
-
# dhs_certified_check:
|
239
|
-
# carb_compliant_check:
|
235
|
+
# checkboxes hazmat_certified_check: 'input#hazmatCertified',
|
236
|
+
# epa_certified_check: 'input#epaCertified',
|
237
|
+
# dhs_certified_check: 'input#homelandSecurityCertified',
|
238
|
+
# carb_compliant_check: 'input#carbCompliant'
|
240
239
|
#
|
241
240
|
def self.checkboxes(element_hash)
|
242
241
|
element_hash.each(&method(:checkbox))
|
@@ -246,13 +245,12 @@ module TestCentricity
|
|
246
245
|
#
|
247
246
|
# @param element_name [Symbol] name of radio object (as a symbol)
|
248
247
|
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
249
|
-
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
250
248
|
# @example
|
251
249
|
# radio :accept_terms_radio, "//input[@id='Accept_Terms']"
|
252
|
-
# radio :decline_terms_radio, 'input#decline_terms_conditions'
|
250
|
+
# radio :decline_terms_radio, 'input#decline_terms_conditions'
|
253
251
|
#
|
254
252
|
def self.radio(element_name, locator, proxy = nil)
|
255
|
-
|
253
|
+
define_element(element_name, TestCentricity::Radio, locator)
|
256
254
|
end
|
257
255
|
|
258
256
|
# Declare and instantiate a collection of radio buttons for this page section.
|