testcentricity_web 0.9.1.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/testcentricity_web/elements/checkbox.rb +18 -12
- data/lib/testcentricity_web/elements/radio.rb +18 -12
- data/lib/testcentricity_web/page_objects_helper.rb +20 -18
- data/lib/testcentricity_web/page_sections_helper.rb +22 -20
- data/lib/testcentricity_web/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78784c531cb446f5986d569b91b84bdb6002ed19
|
4
|
+
data.tar.gz: 42aa00f2944127038d56240d3555eb9b667b7a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d409b2e5595588f2c1749373c757388887762ffb8c994cf8267e5a0a2408384c2f5d4bd5761a640a831cc641ad8293b9e66d4f39730b4449eff3bafe03fd05
|
7
|
+
data.tar.gz: 275d81ea900ca24848da1adf48cb6c052ee8486b8cdfe8e9ddbd2094b1f6d70efdb1ac086c1a5f26ec238a4eb00c7ef3df19106de33502386323204ffb9834ec
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class CheckBox < UIElement
|
3
|
+
attr_accessor :proxy
|
3
4
|
|
4
|
-
def initialize(parent, locator, context)
|
5
|
-
@parent
|
6
|
-
@locator
|
7
|
-
@context
|
8
|
-
@
|
5
|
+
def initialize(parent, locator, context, proxy = nil)
|
6
|
+
@parent = parent
|
7
|
+
@locator = locator
|
8
|
+
@context = context
|
9
|
+
@proxy = proxy
|
10
|
+
@type = :checkbox
|
9
11
|
@alt_locator = nil
|
10
12
|
end
|
11
13
|
|
@@ -42,14 +44,18 @@ module TestCentricity
|
|
42
44
|
obj, _ = find_element(:all)
|
43
45
|
object_not_found_exception(obj, 'Checkbox')
|
44
46
|
invalid_object_type_exception(obj, 'checkbox')
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
if @proxy.nil?
|
48
|
+
begin
|
49
|
+
obj.set(state)
|
50
|
+
rescue
|
51
|
+
unless state == obj.checked?
|
52
|
+
check_id = obj.native.attribute('id')
|
53
|
+
label = first("label[for='#{check_id}']", :wait => 1, :visible => true)
|
54
|
+
label.click unless label.nil?
|
55
|
+
end
|
52
56
|
end
|
57
|
+
else
|
58
|
+
@proxy.click unless state == obj.checked?
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class Radio < UIElement
|
3
|
+
attr_accessor :proxy
|
3
4
|
|
4
|
-
def initialize(parent, locator, context)
|
5
|
-
@parent
|
6
|
-
@locator
|
7
|
-
@context
|
8
|
-
@
|
5
|
+
def initialize(parent, locator, context, proxy = nil)
|
6
|
+
@parent = parent
|
7
|
+
@locator = locator
|
8
|
+
@context = context
|
9
|
+
@proxy = proxy
|
10
|
+
@type = :radio
|
9
11
|
@alt_locator = nil
|
10
12
|
end
|
11
13
|
|
@@ -42,14 +44,18 @@ module TestCentricity
|
|
42
44
|
obj, _ = find_element(:all)
|
43
45
|
object_not_found_exception(obj, 'Radio')
|
44
46
|
invalid_object_type_exception(obj, 'radio')
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
if @proxy.nil?
|
48
|
+
begin
|
49
|
+
obj.set(state)
|
50
|
+
rescue
|
51
|
+
unless state == obj.checked?
|
52
|
+
check_id = obj.native.attribute('id')
|
53
|
+
label = first("label[for='#{check_id}']", :wait => 1, :visible => true)
|
54
|
+
label.click unless label.nil?
|
55
|
+
end
|
52
56
|
end
|
57
|
+
else
|
58
|
+
@proxy.click unless state == obj.checked?
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
@@ -22,7 +22,7 @@ module TestCentricity
|
|
22
22
|
# Declare and instantiate a generic UI Element for this page object.
|
23
23
|
#
|
24
24
|
# @param element_name [Symbol] name of UI object (as a symbol)
|
25
|
-
# @param locator [String]
|
25
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
26
26
|
# @example
|
27
27
|
# element :siebel_view, 'div#_sweview'
|
28
28
|
# element :siebel_busy, "//html[contains(@class, 'siebui-busy')]"
|
@@ -34,7 +34,7 @@ module TestCentricity
|
|
34
34
|
# Declare and instantiate a button UI Element for this page object.
|
35
35
|
#
|
36
36
|
# @param element_name [Symbol] name of button object (as a symbol)
|
37
|
-
# @param locator [String]
|
37
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
38
38
|
# @example
|
39
39
|
# button :checkout_button, "button.checkout_button"
|
40
40
|
# button :login_button, "//input[@id='submit_button']"
|
@@ -46,7 +46,7 @@ module TestCentricity
|
|
46
46
|
# Declare and instantiate a text field UI Element for this page object.
|
47
47
|
#
|
48
48
|
# @param element_name [Symbol] name of text field object (as a symbol)
|
49
|
-
# @param locator [String]
|
49
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
50
50
|
# @example
|
51
51
|
# textfield :user_id_field, "//input[@id='UserName']"
|
52
52
|
# textfield :password_field, "consumer_password"
|
@@ -58,31 +58,33 @@ module TestCentricity
|
|
58
58
|
# Declare and instantiate a checkbox UI Element for this page object.
|
59
59
|
#
|
60
60
|
# @param element_name [Symbol] name of checkbox object (as a symbol)
|
61
|
-
# @param locator [String]
|
61
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
62
|
+
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
62
63
|
# @example
|
63
64
|
# checkbox :remember_checkbox, "//input[@id='RememberUser']"
|
64
|
-
# checkbox :accept_terms_checkbox, "accept_terms_conditions"
|
65
|
+
# checkbox :accept_terms_checkbox, "#accept_terms_conditions", :accept_terms_label
|
65
66
|
#
|
66
|
-
def self.checkbox(element_name, locator)
|
67
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :page);end))
|
67
|
+
def self.checkbox(element_name, locator, proxy = nil)
|
68
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :page, #{proxy});end))
|
68
69
|
end
|
69
70
|
|
70
71
|
# Declare and instantiate a radio button UI Element for this page object.
|
71
72
|
#
|
72
73
|
# @param element_name [Symbol] name of radio object (as a symbol)
|
73
|
-
# @param locator [String]
|
74
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
75
|
+
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
74
76
|
# @example
|
75
77
|
# radio :accept_terms_radio, "//input[@id='Accept_Terms']"
|
76
|
-
# radio :decline_terms_radio, "decline_terms_conditions"
|
78
|
+
# radio :decline_terms_radio, "#decline_terms_conditions", :decline_terms_label
|
77
79
|
#
|
78
|
-
def self.radio(element_name, locator)
|
79
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new(self, "#{locator}", :page);end))
|
80
|
+
def self.radio(element_name, locator, proxy = nil)
|
81
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new(self, "#{locator}", :page, #{proxy});end))
|
80
82
|
end
|
81
83
|
|
82
84
|
# Declare and instantiate a label UI Element for this page object.
|
83
85
|
#
|
84
86
|
# @param element_name [Symbol] name of label object (as a symbol)
|
85
|
-
# @param locator [String]
|
87
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
86
88
|
# @example
|
87
89
|
# label :welcome_label, 'div.Welcome'
|
88
90
|
# label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
|
@@ -94,7 +96,7 @@ module TestCentricity
|
|
94
96
|
# Declare and instantiate a link UI Element for this page object.
|
95
97
|
#
|
96
98
|
# @param element_name [Symbol] name of link object (as a symbol)
|
97
|
-
# @param locator [String]
|
99
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
98
100
|
# @example
|
99
101
|
# link :registration_link, "a.account-nav__link.register"
|
100
102
|
# link :shopping_basket_link, "//a[@href='shopping_basket']"
|
@@ -106,7 +108,7 @@ module TestCentricity
|
|
106
108
|
# Declare and instantiate a table UI Element for this page object.
|
107
109
|
#
|
108
110
|
# @param element_name [Symbol] name of table object (as a symbol)
|
109
|
-
# @param locator [String]
|
111
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
110
112
|
# @example
|
111
113
|
# table :payments_table, "//table[@class='payments_table']"
|
112
114
|
#
|
@@ -117,9 +119,9 @@ module TestCentricity
|
|
117
119
|
# Declare and instantiate a select list UI Element for this page object.
|
118
120
|
#
|
119
121
|
# @param element_name [Symbol] name of select list object (as a symbol)
|
120
|
-
# @param locator [String]
|
122
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
121
123
|
# @example
|
122
|
-
# selectlist :category_selector, "search_form_category_chosen"
|
124
|
+
# selectlist :category_selector, "#search_form_category_chosen"
|
123
125
|
# selectlist :gender_select, "//select[@id='customer_gender']"
|
124
126
|
#
|
125
127
|
def self.selectlist(element_name, locator)
|
@@ -129,7 +131,7 @@ module TestCentricity
|
|
129
131
|
# Declare and instantiate an image UI Element for this page object.
|
130
132
|
#
|
131
133
|
# @param element_name [Symbol] name of image object (as a symbol)
|
132
|
-
# @param locator [String]
|
134
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
133
135
|
# @example
|
134
136
|
# image :basket_item_image, "div.product_image"
|
135
137
|
# image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
|
@@ -141,7 +143,7 @@ module TestCentricity
|
|
141
143
|
# Declare and instantiate a File Field UI Element for this page object.
|
142
144
|
#
|
143
145
|
# @param element_name [Symbol] name of file field object (as a symbol)
|
144
|
-
# @param locator [String]
|
146
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
145
147
|
# @example
|
146
148
|
# filefield :attach_file, "s_SweFileName"
|
147
149
|
#
|
@@ -21,7 +21,7 @@ module TestCentricity
|
|
21
21
|
# @param block [&block] trait value
|
22
22
|
# @example
|
23
23
|
# trait(:section_locator) { "//div[@class='Messaging_Applet']" }
|
24
|
-
# trait(:list_table_name) { 'Messages' }
|
24
|
+
# trait(:list_table_name) { '#Messages' }
|
25
25
|
#
|
26
26
|
def self.trait(trait_name, &block)
|
27
27
|
define_method(trait_name.to_s, &block)
|
@@ -30,7 +30,7 @@ module TestCentricity
|
|
30
30
|
# Declare and instantiate a generic UI Element for this page section.
|
31
31
|
#
|
32
32
|
# @param element_name [Symbol] name of UI object (as a symbol)
|
33
|
-
# @param locator [String]
|
33
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
34
34
|
# @example
|
35
35
|
# element :undo_record_item, "//li[@rn='Undo Record']/a"
|
36
36
|
# element :basket_header, "div.basket_header"
|
@@ -42,7 +42,7 @@ module TestCentricity
|
|
42
42
|
# Declare and instantiate a button UI Element for this page section.
|
43
43
|
#
|
44
44
|
# @param element_name [Symbol] name of button object (as a symbol)
|
45
|
-
# @param locator [String]
|
45
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
46
46
|
# @example
|
47
47
|
# button :checkout_button, "button.checkout_button"
|
48
48
|
# button :login_button, "//input[@id='submit_button']"
|
@@ -54,10 +54,10 @@ module TestCentricity
|
|
54
54
|
# Declare and instantiate a text field UI Element for this page section.
|
55
55
|
#
|
56
56
|
# @param element_name [Symbol] name of text field object (as a symbol)
|
57
|
-
# @param locator [String]
|
57
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
58
58
|
# @example
|
59
59
|
# textfield :user_id_field, "//input[@id='UserName']"
|
60
|
-
# textfield :password_field, "consumer_password"
|
60
|
+
# textfield :password_field, "#consumer_password"
|
61
61
|
#
|
62
62
|
def self.textfield(element_name, locator)
|
63
63
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::TextField.new(self, "#{locator}", :section);end))
|
@@ -66,31 +66,33 @@ module TestCentricity
|
|
66
66
|
# Declare and instantiate a checkbox UI Element for this page section.
|
67
67
|
#
|
68
68
|
# @param element_name [Symbol] name of checkbox object (as a symbol)
|
69
|
-
# @param locator [String]
|
69
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
70
|
+
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
70
71
|
# @example
|
71
72
|
# checkbox :remember_checkbox, "//input[@id='RememberUser']"
|
72
|
-
# checkbox :accept_terms_checkbox, "accept_terms_conditions"
|
73
|
+
# checkbox :accept_terms_checkbox, "#accept_terms_conditions", :accept_terms_label
|
73
74
|
#
|
74
|
-
def self.checkbox(element_name, locator)
|
75
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :section);end))
|
75
|
+
def self.checkbox(element_name, locator, proxy = nil)
|
76
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :section, #{proxy});end))
|
76
77
|
end
|
77
78
|
|
78
79
|
# Declare and instantiate a radio button UI Element for this page section.
|
79
80
|
#
|
80
81
|
# @param element_name [Symbol] name of radio object (as a symbol)
|
81
|
-
# @param locator [String]
|
82
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
83
|
+
# @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
|
82
84
|
# @example
|
83
85
|
# radio :accept_terms_radio, "//input[@id='Accept_Terms']"
|
84
|
-
# radio :decline_terms_radio, "decline_terms_conditions"
|
86
|
+
# radio :decline_terms_radio, "#decline_terms_conditions", :decline_terms_label
|
85
87
|
#
|
86
|
-
def self.radio(element_name, locator)
|
87
|
-
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new(self, "#{locator}", :section);end))
|
88
|
+
def self.radio(element_name, locator, proxy = nil)
|
89
|
+
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Radio.new(self, "#{locator}", :section, #{proxy});end))
|
88
90
|
end
|
89
91
|
|
90
92
|
# Declare and instantiate a label UI Element for this page section.
|
91
93
|
#
|
92
94
|
# @param element_name [Symbol] name of label object (as a symbol)
|
93
|
-
# @param locator [String]
|
95
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
94
96
|
# @example
|
95
97
|
# label :welcome_label, 'div.Welcome'
|
96
98
|
# label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
|
@@ -102,7 +104,7 @@ module TestCentricity
|
|
102
104
|
# Declare and instantiate a link UI Element for this page section.
|
103
105
|
#
|
104
106
|
# @param element_name [Symbol] name of link object (as a symbol)
|
105
|
-
# @param locator [String]
|
107
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
106
108
|
# @example
|
107
109
|
# link :registration_link, "a.account-nav__link.register"
|
108
110
|
# link :shopping_basket_link, "//a[@href='shopping_basket']"
|
@@ -114,7 +116,7 @@ module TestCentricity
|
|
114
116
|
# Declare and instantiate a table UI Element for this page section.
|
115
117
|
#
|
116
118
|
# @param element_name [Symbol] name of table object (as a symbol)
|
117
|
-
# @param locator [String]
|
119
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
118
120
|
# @example
|
119
121
|
# table :payments_table, "//table[@class='payments_table']"
|
120
122
|
#
|
@@ -125,9 +127,9 @@ module TestCentricity
|
|
125
127
|
# Declare and instantiate a select list UI Element for this page section.
|
126
128
|
#
|
127
129
|
# @param element_name [Symbol] name of select list object (as a symbol)
|
128
|
-
# @param locator [String]
|
130
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
129
131
|
# @example
|
130
|
-
# selectlist :category_selector, "search_form_category_chosen"
|
132
|
+
# selectlist :category_selector, "#search_form_category_chosen"
|
131
133
|
# selectlist :gender_select, "//select[@id='customer_gender']"
|
132
134
|
#
|
133
135
|
def self.selectlist(element_name, locator)
|
@@ -137,7 +139,7 @@ module TestCentricity
|
|
137
139
|
# Declare and instantiate an image UI Element for this page section.
|
138
140
|
#
|
139
141
|
# @param element_name [Symbol] name of image object (as a symbol)
|
140
|
-
# @param locator [String]
|
142
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
141
143
|
# @example
|
142
144
|
# image :basket_item_image, "div.product_image"
|
143
145
|
# image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
|
@@ -149,7 +151,7 @@ module TestCentricity
|
|
149
151
|
# Declare and instantiate a File Field UI Element for this page section.
|
150
152
|
#
|
151
153
|
# @param element_name [Symbol] name of file field object (as a symbol)
|
152
|
-
# @param locator [String]
|
154
|
+
# @param locator [String] CSS selector or XPath expression that uniquely identifies object
|
153
155
|
# @example
|
154
156
|
# filefield :attach_file, "s_SweFileName"
|
155
157
|
#
|
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.9.
|
4
|
+
version: 0.9.2
|
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-05-
|
11
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.
|
217
|
+
rubygems_version: 2.5.1
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: A Page Object and Data Object Model Framework for desktop and mobile web
|