testcentricity_web 0.5.4 → 0.5.5
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/lib/testcentricity_web/page_objects_helper.rb +26 -19
- data/lib/testcentricity_web/page_sections_helper.rb +28 -21
- data/lib/testcentricity_web/ui_elements_helper.rb +4 -4
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/webdriver_helper.rb +2 -4
- data/lib/testcentricity_web/world_extensions.rb +26 -0
- data/lib/testcentricity_web.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd47e4f7d10641c98afe707dbe294f97b6038cc
|
4
|
+
data.tar.gz: 0125169d38b9d3f04b919428f0bb478a810bf3ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31814f76f6369edf6c82c8c38bd5041ee29c96d4fe758baa0f629311639723833a4d0a1ddbcae9e5203bd0bc0d1dcea7622278bb70acd4b00838a20e05e8d861
|
7
|
+
data.tar.gz: 92ee7504492cf6d61a1038799f629ec31687cbcaf4fd24f13297d43487eaeefdf1964a4be112933f40cfa5a5337b1fe51b7df4992f0883fd84fc67ddd453e65f
|
@@ -9,7 +9,7 @@ module TestCentricity
|
|
9
9
|
|
10
10
|
# Define a trait for this page object.
|
11
11
|
#
|
12
|
-
# @param trait_name [
|
12
|
+
# @param trait_name [Symbol] name of trait (as a symbol)
|
13
13
|
# @param block [&block] trait value
|
14
14
|
# @example
|
15
15
|
# trait(:page_name) { 'Shopping Basket' }
|
@@ -20,9 +20,9 @@ module TestCentricity
|
|
20
20
|
define_method(trait_name.to_s, &block)
|
21
21
|
end
|
22
22
|
|
23
|
-
#
|
23
|
+
# Declare and instantiate a generic UI Element for this page object.
|
24
24
|
#
|
25
|
-
# @param element_name [
|
25
|
+
# @param element_name [Symbol] name of UI object (as a symbol)
|
26
26
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
27
27
|
# @example
|
28
28
|
# element :siebel_view, 'div#_sweview'
|
@@ -32,9 +32,9 @@ module TestCentricity
|
|
32
32
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, nil);end))
|
33
33
|
end
|
34
34
|
|
35
|
-
#
|
35
|
+
# Declare and instantiate a button UI Element for this page object.
|
36
36
|
#
|
37
|
-
# @param element_name [
|
37
|
+
# @param element_name [Symbol] name of button object (as a symbol)
|
38
38
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
39
39
|
# @example
|
40
40
|
# button :checkout_button, "button.checkout_button"
|
@@ -44,9 +44,9 @@ module TestCentricity
|
|
44
44
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :button);end))
|
45
45
|
end
|
46
46
|
|
47
|
-
#
|
47
|
+
# Declare and instantiate a text field UI Element for this page object.
|
48
48
|
#
|
49
|
-
# @param element_name [
|
49
|
+
# @param element_name [Symbol] name of text field object (as a symbol)
|
50
50
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
51
51
|
# @example
|
52
52
|
# textfield :user_id_field, "//input[@id='UserName']"
|
@@ -56,9 +56,9 @@ module TestCentricity
|
|
56
56
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :textfield);end))
|
57
57
|
end
|
58
58
|
|
59
|
-
#
|
59
|
+
# Declare and instantiate a checkbox UI Element for this page object.
|
60
60
|
#
|
61
|
-
# @param element_name [
|
61
|
+
# @param element_name [Symbol] name of checkbox object (as a symbol)
|
62
62
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
63
63
|
# @example
|
64
64
|
# checkbox :remember_checkbox, "//input[@id='RememberUser']"
|
@@ -68,9 +68,9 @@ module TestCentricity
|
|
68
68
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :checkbox);end))
|
69
69
|
end
|
70
70
|
|
71
|
-
#
|
71
|
+
# Declare and instantiate a label UI Element for this page object.
|
72
72
|
#
|
73
|
-
# @param element_name [
|
73
|
+
# @param element_name [Symbol] name of label object (as a symbol)
|
74
74
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
75
75
|
# @example
|
76
76
|
# label :welcome_label, 'div.Welcome'
|
@@ -80,9 +80,9 @@ module TestCentricity
|
|
80
80
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :label);end))
|
81
81
|
end
|
82
82
|
|
83
|
-
#
|
83
|
+
# Declare and instantiate a link UI Element for this page object.
|
84
84
|
#
|
85
|
-
# @param element_name [
|
85
|
+
# @param element_name [Symbol] name of link object (as a symbol)
|
86
86
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
87
87
|
# @example
|
88
88
|
# link :registration_link, "a.account-nav__link.register"
|
@@ -92,9 +92,9 @@ module TestCentricity
|
|
92
92
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :link);end))
|
93
93
|
end
|
94
94
|
|
95
|
-
#
|
95
|
+
# Declare and instantiate a table UI Element for this page object.
|
96
96
|
#
|
97
|
-
# @param element_name [
|
97
|
+
# @param element_name [Symbol] name of table object (as a symbol)
|
98
98
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
99
99
|
# @example
|
100
100
|
# table :payments_table, "//table[@class='payments_table']"
|
@@ -103,9 +103,9 @@ module TestCentricity
|
|
103
103
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :table);end))
|
104
104
|
end
|
105
105
|
|
106
|
-
#
|
106
|
+
# Declare and instantiate a select list UI Element for this page object.
|
107
107
|
#
|
108
|
-
# @param element_name [
|
108
|
+
# @param element_name [Symbol] name of select list object (as a symbol)
|
109
109
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
110
110
|
# @example
|
111
111
|
# selectlist :category_selector, "search_form_category_chosen"
|
@@ -115,9 +115,9 @@ module TestCentricity
|
|
115
115
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :selectlist);end))
|
116
116
|
end
|
117
117
|
|
118
|
-
#
|
118
|
+
# Declare and instantiate an image UI Element for this page object.
|
119
119
|
#
|
120
|
-
# @param element_name [
|
120
|
+
# @param element_name [Symbol] name of image object (as a symbol)
|
121
121
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
122
122
|
# @example
|
123
123
|
# image :basket_item_image, "div.product_image"
|
@@ -127,6 +127,13 @@ module TestCentricity
|
|
127
127
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :image);end))
|
128
128
|
end
|
129
129
|
|
130
|
+
# Instantiate a PageSection object for this page object.
|
131
|
+
#
|
132
|
+
# @param section_name [Symbol] name of PageSection object (as a symbol)
|
133
|
+
# @param class_name [String] Class name of PageSection object
|
134
|
+
# @example
|
135
|
+
# section :search_form, SearchForm
|
136
|
+
#
|
130
137
|
def self.section(section_name, class_name, locator = nil)
|
131
138
|
class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new(self, "#{locator}", :page);end))
|
132
139
|
end
|
@@ -18,7 +18,7 @@ module TestCentricity
|
|
18
18
|
|
19
19
|
# Define a trait for this page section.
|
20
20
|
#
|
21
|
-
# @param trait_name [
|
21
|
+
# @param trait_name [Symbol] name of trait (as a symbol)
|
22
22
|
# @param block [&block] trait value
|
23
23
|
# @example
|
24
24
|
# trait(:section_locator) { "//div[@class='Messaging_Applet']" }
|
@@ -28,9 +28,9 @@ module TestCentricity
|
|
28
28
|
define_method(trait_name.to_s, &block)
|
29
29
|
end
|
30
30
|
|
31
|
-
#
|
31
|
+
# Declare and instantiate a generic UI Element for this page section.
|
32
32
|
#
|
33
|
-
# @param element_name [
|
33
|
+
# @param element_name [Symbol] name of UI object (as a symbol)
|
34
34
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
35
35
|
# @example
|
36
36
|
# element :undo_record_item, "//li[@rn='Undo Record']/a"
|
@@ -40,9 +40,9 @@ module TestCentricity
|
|
40
40
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, nil);end))
|
41
41
|
end
|
42
42
|
|
43
|
-
#
|
43
|
+
# Declare and instantiate a button UI Element for this page section.
|
44
44
|
#
|
45
|
-
# @param element_name [
|
45
|
+
# @param element_name [Symbol] name of button object (as a symbol)
|
46
46
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
47
47
|
# @example
|
48
48
|
# button :checkout_button, "button.checkout_button"
|
@@ -52,9 +52,9 @@ module TestCentricity
|
|
52
52
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :button);end))
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
# Declare and instantiate a text field UI Element for this page section.
|
56
56
|
#
|
57
|
-
# @param element_name [
|
57
|
+
# @param element_name [Symbol] name of text field object (as a symbol)
|
58
58
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
59
59
|
# @example
|
60
60
|
# textfield :user_id_field, "//input[@id='UserName']"
|
@@ -64,9 +64,9 @@ module TestCentricity
|
|
64
64
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :textfield);end))
|
65
65
|
end
|
66
66
|
|
67
|
-
#
|
67
|
+
# Declare and instantiate a checkbox UI Element for this page section.
|
68
68
|
#
|
69
|
-
# @param element_name [
|
69
|
+
# @param element_name [Symbol] name of checkbox object (as a symbol)
|
70
70
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
71
71
|
# @example
|
72
72
|
# checkbox :remember_checkbox, "//input[@id='RememberUser']"
|
@@ -76,9 +76,9 @@ module TestCentricity
|
|
76
76
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :checkbox);end))
|
77
77
|
end
|
78
78
|
|
79
|
-
#
|
79
|
+
# Declare and instantiate a label UI Element for this page section.
|
80
80
|
#
|
81
|
-
# @param element_name [
|
81
|
+
# @param element_name [Symbol] name of label object (as a symbol)
|
82
82
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
83
83
|
# @example
|
84
84
|
# label :welcome_label, 'div.Welcome'
|
@@ -88,9 +88,9 @@ module TestCentricity
|
|
88
88
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :label);end))
|
89
89
|
end
|
90
90
|
|
91
|
-
#
|
91
|
+
# Declare and instantiate a link UI Element for this page section.
|
92
92
|
#
|
93
|
-
# @param element_name [
|
93
|
+
# @param element_name [Symbol] name of link object (as a symbol)
|
94
94
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
95
95
|
# @example
|
96
96
|
# link :registration_link, "a.account-nav__link.register"
|
@@ -100,9 +100,9 @@ module TestCentricity
|
|
100
100
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :link);end))
|
101
101
|
end
|
102
102
|
|
103
|
-
#
|
103
|
+
# Declare and instantiate a table UI Element for this page section.
|
104
104
|
#
|
105
|
-
# @param element_name [
|
105
|
+
# @param element_name [Symbol] name of table object (as a symbol)
|
106
106
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
107
107
|
# @example
|
108
108
|
# table :payments_table, "//table[@class='payments_table']"
|
@@ -111,9 +111,9 @@ module TestCentricity
|
|
111
111
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :table);end))
|
112
112
|
end
|
113
113
|
|
114
|
-
#
|
114
|
+
# Declare and instantiate a select list UI Element for this page section.
|
115
115
|
#
|
116
|
-
# @param element_name [
|
116
|
+
# @param element_name [Symbol] name of select list object (as a symbol)
|
117
117
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
118
118
|
# @example
|
119
119
|
# selectlist :category_selector, "search_form_category_chosen"
|
@@ -123,9 +123,9 @@ module TestCentricity
|
|
123
123
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :selectlist);end))
|
124
124
|
end
|
125
125
|
|
126
|
-
#
|
126
|
+
# Declare and instantiate an image UI Element for this page section.
|
127
127
|
#
|
128
|
-
# @param element_name [
|
128
|
+
# @param element_name [Symbol] name of image object (as a symbol)
|
129
129
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
130
130
|
# @example
|
131
131
|
# image :basket_item_image, "div.product_image"
|
@@ -135,6 +135,13 @@ module TestCentricity
|
|
135
135
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :image);end))
|
136
136
|
end
|
137
137
|
|
138
|
+
# Instantiate a PageSection object within this PageSection object.
|
139
|
+
#
|
140
|
+
# @param section_name [Symbol] name of PageSection object (as a symbol)
|
141
|
+
# @param class_name [String] Class name of PageSection object
|
142
|
+
# @example
|
143
|
+
# section :search_form, SearchForm
|
144
|
+
#
|
138
145
|
def self.section(section_name, class_name, locator = nil)
|
139
146
|
class_eval(%Q(def #{section_name.to_s};@#{section_name.to_s} ||= #{class_name.to_s}.new(self, "#{locator}", :section);end))
|
140
147
|
end
|
@@ -197,7 +204,7 @@ module TestCentricity
|
|
197
204
|
|
198
205
|
# Wait until the Section object exists, or until the specified wait time has expired.
|
199
206
|
#
|
200
|
-
# @param seconds [Integer
|
207
|
+
# @param seconds [Integer or Float] wait time in seconds
|
201
208
|
# @example
|
202
209
|
# navigation_toolbar.wait_until_exists(0.5)
|
203
210
|
#
|
@@ -211,7 +218,7 @@ module TestCentricity
|
|
211
218
|
|
212
219
|
# Wait until the Section object no longer exists, or until the specified wait time has expired.
|
213
220
|
#
|
214
|
-
# @param seconds [Integer
|
221
|
+
# @param seconds [Integer or Float] wait time in seconds
|
215
222
|
# @example
|
216
223
|
# navigation_toolbar.wait_until_gone(5)
|
217
224
|
#
|
@@ -225,7 +225,7 @@ module TestCentricity
|
|
225
225
|
|
226
226
|
# Wait until the object exists, or until the specified wait time has expired.
|
227
227
|
#
|
228
|
-
# @param seconds [Integer
|
228
|
+
# @param seconds [Integer or Float] wait time in seconds
|
229
229
|
# @example
|
230
230
|
# run_button.wait_until_exists(0.5)
|
231
231
|
#
|
@@ -239,7 +239,7 @@ module TestCentricity
|
|
239
239
|
|
240
240
|
# Wait until the object no longer exists, or until the specified wait time has expired.
|
241
241
|
#
|
242
|
-
# @param seconds [Integer
|
242
|
+
# @param seconds [Integer or Float] wait time in seconds
|
243
243
|
# @example
|
244
244
|
# logout_button.wait_until_gone(5)
|
245
245
|
#
|
@@ -253,7 +253,7 @@ module TestCentricity
|
|
253
253
|
|
254
254
|
# Wait until the object's value equals the specified value, or until the specified wait time has expired.
|
255
255
|
#
|
256
|
-
# @param seconds [Integer
|
256
|
+
# @param seconds [Integer or Float] wait time in seconds
|
257
257
|
# @example
|
258
258
|
# card_authorized_label.wait_until_value_is(5, 'Card authorized')
|
259
259
|
#
|
@@ -267,7 +267,7 @@ module TestCentricity
|
|
267
267
|
|
268
268
|
# Wait until the object's value changes to a different value, or until the specified wait time has expired.
|
269
269
|
#
|
270
|
-
# @param seconds [Integer
|
270
|
+
# @param seconds [Integer or Float] wait time in seconds
|
271
271
|
# @example
|
272
272
|
# basket_grand_total_label.wait_until_value_changes(5)
|
273
273
|
#
|
@@ -2,7 +2,7 @@ module TestCentricity
|
|
2
2
|
class WebDriverConnect
|
3
3
|
include Capybara::DSL
|
4
4
|
|
5
|
-
def self.initialize_web_driver(
|
5
|
+
def self.initialize_web_driver(app_host)
|
6
6
|
browser = ENV['WEB_BROWSER']
|
7
7
|
|
8
8
|
# assume that we're testing within a local desktop web browser
|
@@ -22,9 +22,7 @@ module TestCentricity
|
|
22
22
|
initialize_local_browser(browser)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
Capybara.app_host = "#{environment.protocol}://#{environment.hostname}/#{environment.base_url}" :
|
27
|
-
Capybara.app_host = "#{environment.protocol}://#{environment.base_url}"
|
25
|
+
Capybara.app_host = app_host
|
28
26
|
|
29
27
|
# set browser window size only if testing with a desktop web browser
|
30
28
|
if Environ.is_desktop?
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module WorldData
|
2
|
+
def environs
|
3
|
+
@environs ||= TestCentricity::EnvironData.new
|
4
|
+
end
|
5
|
+
|
6
|
+
def instantiate_data_objects
|
7
|
+
return if TestCentricity::DataManager.loaded?
|
8
|
+
|
9
|
+
data_objects.each do | data_type, data_class |
|
10
|
+
eval("def #{data_type.to_s};@#{data_type.to_s} ||= #{data_class}.new;end")
|
11
|
+
TestCentricity::DataManager.register_data_object(data_type, data_class.new)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
module WorldPages
|
18
|
+
def instantiate_page_objects
|
19
|
+
return if TestCentricity::PageManager.loaded?
|
20
|
+
|
21
|
+
page_objects.each do | page_object, page_class |
|
22
|
+
eval("def #{page_object.to_s};@#{page_object.to_s} ||= #{page_class}.new;end")
|
23
|
+
TestCentricity::PageManager.register_page_object(page_object, page_class.new)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/testcentricity_web.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'capybara/cucumber'
|
2
2
|
require 'rspec/expectations'
|
3
3
|
require 'test/unit'
|
4
|
+
require 'testcentricity_web/world_extensions'
|
4
5
|
require 'testcentricity_web/browser_helper'
|
5
6
|
require 'testcentricity_web/data_objects_helper'
|
6
7
|
require 'testcentricity_web/drag_drop_helper'
|
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.5.
|
4
|
+
version: 0.5.5
|
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-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- lib/testcentricity_web/utility_helpers.rb
|
195
195
|
- lib/testcentricity_web/version.rb
|
196
196
|
- lib/testcentricity_web/webdriver_helper.rb
|
197
|
+
- lib/testcentricity_web/world_extensions.rb
|
197
198
|
- testcentricity_web.gemspec
|
198
199
|
homepage: ''
|
199
200
|
licenses:
|