testcentricity_web 0.6.6.1 → 0.6.7
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/README.md +11 -9
- data/lib/testcentricity_web.rb +10 -0
- data/lib/testcentricity_web/browser_helper.rb +1 -0
- data/lib/testcentricity_web/elements/checkbox.rb +14 -0
- data/lib/testcentricity_web/elements/select_list.rb +38 -0
- data/lib/testcentricity_web/elements/table.rb +80 -0
- data/lib/testcentricity_web/siebel_open_ui_helper.rb +0 -103
- data/lib/testcentricity_web/ui_elements_helper.rb +9 -10
- data/lib/testcentricity_web/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b35ced39b5ac4d97276a251e1a27b7ee1a9efd
|
4
|
+
data.tar.gz: 337a5c09b14e9afd16d2597ab38fea8b67ac4278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cfc198f368d3884d069786a4712fb1161af583b1003fb0c544fd8561b0ef1ef7f412508affb75a8a9a55a2f212ab972e1f637a84a9fa757f59e8eb8eb449caf
|
7
|
+
data.tar.gz: 2b91285c7b93ceea60223140e98faa4885ef7e7fdf994be924f0f8250ac41f57324f53f303c992c9668a45b0c916bdc3dca237c96b7a41d27f08f147583b0da5
|
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# TestCentricityWeb
|
2
2
|
|
3
3
|
The TestCentricity™ core generic framework for desktop and mobile web site testing implements a Page Object and Data Object Model DSL for
|
4
|
-
use with Cucumber, Capybara, and Selenium-Webdriver.
|
5
|
-
|
6
|
-
|
4
|
+
use with Cucumber, Capybara, and Selenium-Webdriver.
|
5
|
+
|
6
|
+
The TestCentricity™ web gem supports running testing against the following web test targets:
|
7
|
+
* locally hosted desktop browsers (Firefox, Chrome, Safari, IE, or Edge)
|
8
|
+
* locally hosted emulated iOS and Android mobile browsers (using Firefox)
|
9
|
+
* a "headless" browser (using Poltergeist and PhantomJS)
|
10
|
+
* cloud hosted desktop or mobile web browsers using the BrowserStack, Sauce Labs, CrossBrowserTesting, or TestingBot services.
|
7
11
|
|
8
12
|
|
9
13
|
## Installation
|
@@ -28,20 +32,18 @@ If you are using Cucumber, you need to require the following in your *env.rb* fi
|
|
28
32
|
|
29
33
|
require 'capybara'
|
30
34
|
require 'capybara/cucumber'
|
31
|
-
require 'selenium-webdriver'
|
32
35
|
require 'testcentricity_web'
|
33
|
-
|
34
|
-
|
36
|
+
|
37
|
+
|
35
38
|
###Using RSpec
|
36
39
|
|
37
40
|
If you are using RSpec instead, you need to require the following in your *env.rb* file:
|
38
41
|
|
39
42
|
require 'capybara'
|
40
43
|
require 'capybara/rspec'
|
41
|
-
require 'selenium-webdriver'
|
42
44
|
require 'testcentricity_web'
|
43
|
-
|
44
|
-
|
45
|
+
|
46
|
+
|
45
47
|
### Using Poltergeist
|
46
48
|
|
47
49
|
If you will be running your tests on a "headless" web browser using Poltergeist and PhantomJS, you must add this line to your automation
|
data/lib/testcentricity_web.rb
CHANGED
@@ -17,6 +17,16 @@ require 'testcentricity_web/environment'
|
|
17
17
|
require 'testcentricity_web/webdriver_helper'
|
18
18
|
require 'testcentricity_web/version'
|
19
19
|
|
20
|
+
require 'testcentricity_web/elements/button'
|
21
|
+
require 'testcentricity_web/elements/checkbox'
|
22
|
+
require 'testcentricity_web/elements/file_field'
|
23
|
+
require 'testcentricity_web/elements/image'
|
24
|
+
require 'testcentricity_web/elements/label'
|
25
|
+
require 'testcentricity_web/elements/link'
|
26
|
+
require 'testcentricity_web/elements/select_list'
|
27
|
+
require 'testcentricity_web/elements/table'
|
28
|
+
require 'testcentricity_web/elements/textfield'
|
29
|
+
|
20
30
|
|
21
31
|
module TestCentricity
|
22
32
|
class PageManager
|
@@ -112,6 +112,7 @@ module TestCentricity
|
|
112
112
|
:ipad_pro => "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1",
|
113
113
|
:android_phone => "Mozilla/5.0 (Linux; U; Android 4.0.1; en-us; sdk Build/ICS_MR0) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
114
114
|
:android_tablet => "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",
|
115
|
+
:windows_phone10 => "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0",
|
115
116
|
:windows_phone8 => "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
|
116
117
|
:windows_phone7 => "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)"
|
117
118
|
}
|
@@ -40,5 +40,19 @@ module TestCentricity
|
|
40
40
|
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected #{@locator}") :
|
41
41
|
assert_equal(state, actual, "Expected #{@locator} to be #{state} but found #{actual} instead")
|
42
42
|
end
|
43
|
+
|
44
|
+
# Set the check state of a Siebel OUI JCheckBox object.
|
45
|
+
#
|
46
|
+
# @param state [Boolean] true = checked / false = unchecked
|
47
|
+
# @example
|
48
|
+
# remember_me_checkbox.set_siebel_checkbox_state(true)
|
49
|
+
#
|
50
|
+
def set_siebel_checkbox_state(state)
|
51
|
+
obj, _ = find_element
|
52
|
+
object_not_found_exception(obj, 'Siebel checkbox')
|
53
|
+
raise "#{locator} is not a Siebel CheckBox object" unless get_siebel_object_type == 'JCheckBox'
|
54
|
+
expected = state.to_bool
|
55
|
+
obj.click unless expected == obj.checked?
|
56
|
+
end
|
43
57
|
end
|
44
58
|
end
|
@@ -78,5 +78,43 @@ module TestCentricity
|
|
78
78
|
obj.first('option[selected]').text
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
# Select the specified option in a Siebel OUI select box object.
|
83
|
+
#
|
84
|
+
# @param option [String] text of option to select
|
85
|
+
# @example
|
86
|
+
# country_select.choose_siebel_option('Cayman Islands')
|
87
|
+
#
|
88
|
+
def choose_siebel_option(option)
|
89
|
+
Capybara.wait_on_first_by_default = true
|
90
|
+
invoke_siebel_popup
|
91
|
+
first(:xpath, "//li[@class='ui-menu-item']", :exact => true, :match => :prefer_exact,text: option).click
|
92
|
+
end
|
93
|
+
|
94
|
+
# Return array of strings of all options in a Siebel OUI select box object.
|
95
|
+
#
|
96
|
+
# @return [Array]
|
97
|
+
# @example
|
98
|
+
# all_countries = country_select.get_siebel_options
|
99
|
+
#
|
100
|
+
def get_siebel_options
|
101
|
+
invoke_siebel_popup
|
102
|
+
sleep(0.5)
|
103
|
+
options = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
104
|
+
obj, _ = find_element
|
105
|
+
obj.native.send_keys(:escape)
|
106
|
+
options
|
107
|
+
end
|
108
|
+
|
109
|
+
def verify_siebel_options(expected, enqueue = false)
|
110
|
+
invoke_siebel_popup
|
111
|
+
sleep(0.5)
|
112
|
+
actual = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
113
|
+
enqueue ?
|
114
|
+
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{@locator}") :
|
115
|
+
assert_equal(expected, actual, "Expected list of options in list #{@locator} to be #{expected} but found #{actual}")
|
116
|
+
obj, _ = find_element
|
117
|
+
obj.native.send_keys(:escape)
|
118
|
+
end
|
81
119
|
end
|
82
120
|
end
|
@@ -191,6 +191,15 @@ module TestCentricity
|
|
191
191
|
clear_alt_locator
|
192
192
|
end
|
193
193
|
|
194
|
+
# Search for the specified text value in the specified row of the table object.
|
195
|
+
# Returns the number of the first column that contains the search value.
|
196
|
+
#
|
197
|
+
# @param row [Integer] row nummber
|
198
|
+
# @param search_value [String] value to be searched for
|
199
|
+
# @return [Integer] column number of table cell that contains search value
|
200
|
+
# @example
|
201
|
+
# list_table.find_in_table_row(4, 'High speed Framus bolts')
|
202
|
+
#
|
194
203
|
def find_in_table_row(row, search_value)
|
195
204
|
(1..get_column_count).each do |column|
|
196
205
|
return column if get_table_cell(row, column) == search_value
|
@@ -198,6 +207,15 @@ module TestCentricity
|
|
198
207
|
nil
|
199
208
|
end
|
200
209
|
|
210
|
+
# Search for the specified text value in the specified column of the table object.
|
211
|
+
# Returns the number of the first row that contains the search value.
|
212
|
+
#
|
213
|
+
# @param column [Integer] column nummber
|
214
|
+
# @param search_value [String] value to be searched for
|
215
|
+
# @return [Integer] row number of table cell that contains search value
|
216
|
+
# @example
|
217
|
+
# list_table.find_in_table_column(1, 'Ashes to Ashes')
|
218
|
+
#
|
201
219
|
def find_in_table_column(column, search_value)
|
202
220
|
(1..get_row_count).each do |row|
|
203
221
|
return row if get_table_cell(row, column) == search_value
|
@@ -205,6 +223,21 @@ module TestCentricity
|
|
205
223
|
nil
|
206
224
|
end
|
207
225
|
|
226
|
+
# Populate the specified row of this table object with the associated data from a Hash passed as an
|
227
|
+
# argument. Data values must be in the form of a String for textfield and select list controls. For checkbox
|
228
|
+
# and radio buttons, data must either be a Boolean or a String that evaluates to a Boolean value (Yes, No, 1,
|
229
|
+
# 0, true, false)
|
230
|
+
#
|
231
|
+
# @param data [Hash] column numbers and associated data to be entered
|
232
|
+
# @example
|
233
|
+
# data = { 1 => 'Dr.',
|
234
|
+
# 2 => 'Evangeline',
|
235
|
+
# 3 => 'Devereaux',
|
236
|
+
# 4 => 'MD',
|
237
|
+
# 5 => 'Family Practice'
|
238
|
+
# }
|
239
|
+
# clinician_table.populate_table_row(3, data)
|
240
|
+
#
|
208
241
|
def populate_table_row(row, data)
|
209
242
|
wait_until_exists(2)
|
210
243
|
data.each do | column, data_param |
|
@@ -218,6 +251,12 @@ module TestCentricity
|
|
218
251
|
end
|
219
252
|
end
|
220
253
|
|
254
|
+
# Click in the specified column header in a table object.
|
255
|
+
#
|
256
|
+
# @param column [Integer] column number
|
257
|
+
# @example
|
258
|
+
# list_table.click_header_column(3)
|
259
|
+
#
|
221
260
|
def click_header_column(column)
|
222
261
|
column_count = get_column_count
|
223
262
|
raise "Column #{column} exceeds number of columns (#{column_count}) in table header #{@locator}" if column > column_count
|
@@ -252,6 +291,47 @@ module TestCentricity
|
|
252
291
|
columns
|
253
292
|
end
|
254
293
|
|
294
|
+
|
295
|
+
def is_table_row_expanded?(row, column)
|
296
|
+
row_count = get_row_count
|
297
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{@locator}" if row > row_count
|
298
|
+
column_count = get_column_count
|
299
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{@locator}" if column > column_count
|
300
|
+
set_table_cell_locator(row, column)
|
301
|
+
set_alt_locator("#{@alt_locator}/div/div[contains(@class, 'tree-plus treeclick')]")
|
302
|
+
expanded = true
|
303
|
+
expanded = false if exists?
|
304
|
+
clear_alt_locator
|
305
|
+
expanded
|
306
|
+
end
|
307
|
+
|
308
|
+
def expand_table_row(row, column)
|
309
|
+
unless is_table_row_expanded?(row, column)
|
310
|
+
set_table_cell_locator(row, column)
|
311
|
+
set_alt_locator("#{@alt_locator}/div/div[contains(@class, 'tree-plus treeclick')]")
|
312
|
+
click if exists?
|
313
|
+
clear_alt_locator
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
def collapse_table_row(row, column)
|
318
|
+
if is_table_row_expanded?(row, column)
|
319
|
+
set_table_cell_locator(row, column)
|
320
|
+
set_alt_locator("#{@alt_locator}/div/div[contains(@class, 'tree-minus treeclick')]")
|
321
|
+
click if exists?
|
322
|
+
clear_alt_locator
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
def expand_all_table_rows(column)
|
327
|
+
row_count = get_row_count
|
328
|
+
column_count = get_column_count
|
329
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{@locator}" if column > column_count
|
330
|
+
row_count.downto(1) do |row|
|
331
|
+
expand_table_row(row, column)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
255
335
|
private
|
256
336
|
|
257
337
|
def set_table_cell_locator(row, column)
|
@@ -1,117 +1,14 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class UIElement
|
3
|
-
# Set the check state of a Siebel OUI JCheckBox object.
|
4
|
-
#
|
5
|
-
# @param state [Boolean] true = checked / false = unchecked
|
6
|
-
# @example
|
7
|
-
# remember_me_checkbox.set_siebel_checkbox_state(true)
|
8
|
-
#
|
9
|
-
def set_siebel_checkbox_state(state)
|
10
|
-
obj, _ = find_element
|
11
|
-
object_not_found_exception(obj, 'Siebel checkbox')
|
12
|
-
raise "#{locator} is not a Siebel CheckBox object" unless get_siebel_object_type == 'JCheckBox'
|
13
|
-
expected = state.to_bool
|
14
|
-
obj.click unless expected == obj.checked?
|
15
|
-
end
|
16
|
-
|
17
|
-
# Select the specified option in a Siebel OUI select box object.
|
18
|
-
#
|
19
|
-
# @param option [String] text of option to select
|
20
|
-
# @example
|
21
|
-
# country_select.choose_siebel_option('Cayman Islands')
|
22
|
-
#
|
23
|
-
def choose_siebel_option(option)
|
24
|
-
Capybara.wait_on_first_by_default = true
|
25
|
-
invoke_siebel_popup
|
26
|
-
first(:xpath, "//li[@class='ui-menu-item']", :exact => true, :match => :prefer_exact,text: option).click
|
27
|
-
end
|
28
|
-
|
29
|
-
# Return array of strings of all options in a Siebel OUI select box object.
|
30
|
-
#
|
31
|
-
# @return [Array]
|
32
|
-
# @example
|
33
|
-
# all_countries = country_select.get_siebel_options
|
34
|
-
#
|
35
|
-
def get_siebel_options
|
36
|
-
invoke_siebel_popup
|
37
|
-
sleep(0.5)
|
38
|
-
options = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
39
|
-
obj, _ = find_element
|
40
|
-
obj.native.send_keys(:escape)
|
41
|
-
options
|
42
|
-
end
|
43
|
-
|
44
|
-
def verify_siebel_options(expected, enqueue = false)
|
45
|
-
invoke_siebel_popup
|
46
|
-
sleep(0.5)
|
47
|
-
actual = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
48
|
-
enqueue ?
|
49
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{@locator}") :
|
50
|
-
assert_equal(expected, actual, "Expected list of options in list #{@locator} to be #{expected} but found #{actual}")
|
51
|
-
obj, _ = find_element
|
52
|
-
obj.native.send_keys(:escape)
|
53
|
-
end
|
54
|
-
|
55
3
|
def invoke_siebel_dialog(popup)
|
56
4
|
invoke_siebel_popup
|
57
5
|
popup.wait_until_exists(15)
|
58
6
|
end
|
59
7
|
|
60
|
-
def is_table_row_expanded?(row, column)
|
61
|
-
row_count = get_row_count
|
62
|
-
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{@locator}" if row > row_count
|
63
|
-
column_count = get_column_count
|
64
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{@locator}" if column > column_count
|
65
|
-
set_table_cell_locator(row, column)
|
66
|
-
set_alt_locator("#{@alt_locator}/div/div[contains(@class, 'tree-plus treeclick')]")
|
67
|
-
expanded = true
|
68
|
-
expanded = false if exists?
|
69
|
-
clear_alt_locator
|
70
|
-
expanded
|
71
|
-
end
|
72
|
-
|
73
|
-
def expand_table_row(row, column)
|
74
|
-
unless is_table_row_expanded?(row, column)
|
75
|
-
set_table_cell_locator(row, column)
|
76
|
-
set_alt_locator("#{@alt_locator}/div/div[contains(@class, 'tree-plus treeclick')]")
|
77
|
-
click if exists?
|
78
|
-
clear_alt_locator
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def collapse_table_row(row, column)
|
83
|
-
if is_table_row_expanded?(row, column)
|
84
|
-
set_table_cell_locator(row, column)
|
85
|
-
set_alt_locator("#{@alt_locator}/div/div[contains(@class, 'tree-minus treeclick')]")
|
86
|
-
click if exists?
|
87
|
-
clear_alt_locator
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def expand_all_table_rows(column)
|
92
|
-
row_count = get_row_count
|
93
|
-
column_count = get_column_count
|
94
|
-
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{@locator}" if column > column_count
|
95
|
-
row_count.downto(1) do |row|
|
96
|
-
expand_table_row(row, column)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
8
|
def get_siebel_object_type
|
101
9
|
obj, _ = find_element
|
102
10
|
object_not_found_exception(obj, 'Siebel object')
|
103
11
|
obj.native.attribute('ot')
|
104
12
|
end
|
105
|
-
|
106
|
-
private
|
107
|
-
|
108
|
-
def invoke_siebel_popup
|
109
|
-
obj, _ = find_element
|
110
|
-
object_not_found_exception(obj, 'Siebel object')
|
111
|
-
trigger_name = obj.native.attribute('aria-describedby').strip
|
112
|
-
trigger = "//span[@id='#{trigger_name}']"
|
113
|
-
trigger = "#{@parent.get_locator}#{trigger}" if @context == :section && !@parent.get_locator.nil?
|
114
|
-
first(:xpath, trigger).click
|
115
|
-
end
|
116
13
|
end
|
117
14
|
end
|
@@ -313,15 +313,14 @@ module TestCentricity
|
|
313
313
|
raise "#{locator} is not a #{obj_type} element"
|
314
314
|
end
|
315
315
|
end
|
316
|
+
|
317
|
+
def invoke_siebel_popup
|
318
|
+
obj, _ = find_element
|
319
|
+
object_not_found_exception(obj, 'Siebel object')
|
320
|
+
trigger_name = obj.native.attribute('aria-describedby').strip
|
321
|
+
trigger = "//span[@id='#{trigger_name}']"
|
322
|
+
trigger = "#{@parent.get_locator}#{trigger}" if @context == :section && !@parent.get_locator.nil?
|
323
|
+
first(:xpath, trigger).click
|
324
|
+
end
|
316
325
|
end
|
317
326
|
end
|
318
|
-
|
319
|
-
require 'testcentricity_web/elements/button'
|
320
|
-
require 'testcentricity_web/elements/checkbox'
|
321
|
-
require 'testcentricity_web/elements/file_field'
|
322
|
-
require 'testcentricity_web/elements/image'
|
323
|
-
require 'testcentricity_web/elements/label'
|
324
|
-
require 'testcentricity_web/elements/link'
|
325
|
-
require 'testcentricity_web/elements/select_list'
|
326
|
-
require 'testcentricity_web/elements/table'
|
327
|
-
require 'testcentricity_web/elements/textfield'
|
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: 0.6.
|
4
|
+
version: 0.6.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: 2016-04-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|