testcentricity_web 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79a7fa37b1e2a170c3dfe53463b2f32c345c6bc8
4
- data.tar.gz: 12b13c153ae52006acef1010136cb532aff35bb8
3
+ metadata.gz: 8eac97f61bc406208f747ef3f6b85c0078d41498
4
+ data.tar.gz: cf07e512e939c2af1ab03a8823e14457393cc678
5
5
  SHA512:
6
- metadata.gz: 171dd73728c60562a7ce1895c2e9a18631440c7cdb6d7c375d95621c674d129870d63836213506db407eada9cc8a3249bc6863078e1f0cb80f59999d2b4be9b2
7
- data.tar.gz: 3059f83f6a3258232ea6aa41ae89cd7a76ddb6780cc0a427f185e9cd4d7f9a6b15e66a8bd4d968a64efad5424dcc8043b4830ab73743b1168d39a11bdb37bf83
6
+ metadata.gz: 93d41573d1d76f30c80e691ae2b71168ea54e4a026ef8ed252bd3a66a32e287d8c179dd76dd7b37ca0e04e9ec82b8fb3a5b40bf3371aa7531528a32a8fdf2cd8
7
+ data.tar.gz: c7967d82b27dc411ace1e3a99f3b1a32677b5f0b1354ed0ef8de3283dcc6bae6487aa2097877cf73cd2c32e516e7a28be6594ac7b829e1b6e34664b4cd728851
@@ -9,7 +9,7 @@ module TestCentricity
9
9
 
10
10
  # Define a trait for this page object.
11
11
  #
12
- # @param trait_name [symbol] name of trait
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,13 +20,21 @@ module TestCentricity
20
20
  define_method(trait_name.to_s, &block)
21
21
  end
22
22
 
23
+ # Define and instantiate a generic UI Element for this page object.
24
+ #
25
+ # @param element_name [symbol] name of UI object (as a symbol)
26
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
27
+ # @example
28
+ # element :siebel_view, 'div#_sweview'
29
+ # element :siebel_busy, "//html[contains(@class, 'siebui-busy')]"
30
+ #
23
31
  def self.element(element_name, locator)
24
32
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, nil);end))
25
33
  end
26
34
 
27
35
  # Define and instantiate a button UI Element for this page object.
28
36
  #
29
- # @param element_name [symbol] name of button object
37
+ # @param element_name [symbol] name of button object (as a symbol)
30
38
  # @param locator [String] css selector or xpath expression that uniquely identifies object
31
39
  # @example
32
40
  # button :checkout_button, "button.checkout_button"
@@ -38,7 +46,7 @@ module TestCentricity
38
46
 
39
47
  # Define and instantiate a text field UI Element for this page object.
40
48
  #
41
- # @param element_name [symbol] name of text field object
49
+ # @param element_name [symbol] name of text field object (as a symbol)
42
50
  # @param locator [String] css selector or xpath expression that uniquely identifies object
43
51
  # @example
44
52
  # textfield :user_id_field, "//input[@id='UserName']"
@@ -50,7 +58,7 @@ module TestCentricity
50
58
 
51
59
  # Define and instantiate a checkbox UI Element for this page object.
52
60
  #
53
- # @param element_name [symbol] name of checkbox object
61
+ # @param element_name [symbol] name of checkbox object (as a symbol)
54
62
  # @param locator [String] css selector or xpath expression that uniquely identifies object
55
63
  # @example
56
64
  # checkbox :remember_checkbox, "//input[@id='RememberUser']"
@@ -60,22 +68,61 @@ module TestCentricity
60
68
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :checkbox);end))
61
69
  end
62
70
 
71
+ # Define and instantiate a label UI Element for this page object.
72
+ #
73
+ # @param element_name [symbol] name of label object (as a symbol)
74
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
75
+ # @example
76
+ # label :welcome_label, 'div.Welcome'
77
+ # label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
78
+ #
63
79
  def self.label(element_name, locator)
64
80
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :label);end))
65
81
  end
66
82
 
83
+ # Define and instantiate a link UI Element for this page object.
84
+ #
85
+ # @param element_name [symbol] name of link object (as a symbol)
86
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
87
+ # @example
88
+ # link :registration_link, "a.account-nav__link.register"
89
+ # link :shopping_basket_link, "//a[@href='shopping_basket']"
90
+ #
67
91
  def self.link(element_name, locator)
68
92
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :link);end))
69
93
  end
70
94
 
95
+ # Define and instantiate a table UI Element for this page object.
96
+ #
97
+ # @param element_name [symbol] name of table object (as a symbol)
98
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
99
+ # @example
100
+ # table :payments_table, "//table[@class='payments_table']"
101
+ #
71
102
  def self.table(element_name, locator)
72
103
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :table);end))
73
104
  end
74
105
 
106
+ # Define and instantiate a select list UI Element for this page object.
107
+ #
108
+ # @param element_name [symbol] name of select list object (as a symbol)
109
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
110
+ # @example
111
+ # selectlist :category_selector, "search_form_category_chosen"
112
+ # selectlist :gender_select, "//select[@id='customer_gender']"
113
+ #
75
114
  def self.selectlist(element_name, locator)
76
115
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :selectlist);end))
77
116
  end
78
117
 
118
+ # Define and instantiate an image UI Element for this page object.
119
+ #
120
+ # @param element_name [symbol] name of image object (as a symbol)
121
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
122
+ # @example
123
+ # image :basket_item_image, "div.product_image"
124
+ # image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
125
+ #
79
126
  def self.image(element_name, locator)
80
127
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :page, :image);end))
81
128
  end
@@ -128,6 +175,12 @@ module TestCentricity
128
175
  raise "Expected page to have content '#{content}'" unless page.has_content?(:visible, content)
129
176
  end
130
177
 
178
+ # Does Page object exists?
179
+ #
180
+ # @return [Boolean]
181
+ # @example
182
+ # home_page.exists?
183
+ #
131
184
  def exists?
132
185
  saved_wait_time = Capybara.default_max_wait_time
133
186
  Capybara.default_max_wait_time = 0.1
@@ -144,6 +197,12 @@ module TestCentricity
144
197
  Capybara.default_max_wait_time = saved_wait_time
145
198
  end
146
199
 
200
+ # Is current Page object URL secure?
201
+ #
202
+ # @return [Boolean]
203
+ # @example
204
+ # home_page.secure?
205
+ #
147
206
  def secure?
148
207
  !current_url.match(/^https/).nil?
149
208
  end
@@ -18,7 +18,7 @@ module TestCentricity
18
18
 
19
19
  # Define a trait for this page section.
20
20
  #
21
- # @param trait_name [symbol] name of trait
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,13 +28,21 @@ module TestCentricity
28
28
  define_method(trait_name.to_s, &block)
29
29
  end
30
30
 
31
+ # Define and instantiate a generic UI Element for this page section.
32
+ #
33
+ # @param element_name [symbol] name of UI object (as a symbol)
34
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
35
+ # @example
36
+ # element :undo_record_item, "//li[@rn='Undo Record']/a"
37
+ # element :basket_header, "div.basket_header"
38
+ #
31
39
  def self.element(element_name, locator)
32
40
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, nil);end))
33
41
  end
34
42
 
35
43
  # Define and instantiate a button UI Element for this page section.
36
44
  #
37
- # @param element_name [symbol] name of button object
45
+ # @param element_name [symbol] name of button object (as a symbol)
38
46
  # @param locator [String] css selector or xpath expression that uniquely identifies object
39
47
  # @example
40
48
  # button :checkout_button, "button.checkout_button"
@@ -46,7 +54,7 @@ module TestCentricity
46
54
 
47
55
  # Define and instantiate a text field UI Element for this page section.
48
56
  #
49
- # @param element_name [symbol] name of text field object
57
+ # @param element_name [symbol] name of text field object (as a symbol)
50
58
  # @param locator [String] css selector or xpath expression that uniquely identifies object
51
59
  # @example
52
60
  # textfield :user_id_field, "//input[@id='UserName']"
@@ -58,7 +66,7 @@ module TestCentricity
58
66
 
59
67
  # Define and instantiate a checkbox UI Element for this page section.
60
68
  #
61
- # @param element_name [symbol] name of checkbox object
69
+ # @param element_name [symbol] name of checkbox object (as a symbol)
62
70
  # @param locator [String] css selector or xpath expression that uniquely identifies object
63
71
  # @example
64
72
  # checkbox :remember_checkbox, "//input[@id='RememberUser']"
@@ -68,22 +76,61 @@ module TestCentricity
68
76
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :checkbox);end))
69
77
  end
70
78
 
79
+ # Define and instantiate a label UI Element for this page section.
80
+ #
81
+ # @param element_name [symbol] name of label object (as a symbol)
82
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
83
+ # @example
84
+ # label :welcome_label, 'div.Welcome'
85
+ # label :rollup_price_label, "//div[contains(@id, 'Rollup Item Price')]"
86
+ #
71
87
  def self.label(element_name, locator)
72
88
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :label);end))
73
89
  end
74
90
 
91
+ # Define and instantiate a link UI Element for this page section.
92
+ #
93
+ # @param element_name [symbol] name of link object (as a symbol)
94
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
95
+ # @example
96
+ # link :registration_link, "a.account-nav__link.register"
97
+ # link :shopping_basket_link, "//a[@href='shopping_basket']"
98
+ #
75
99
  def self.link(element_name, locator)
76
100
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :link);end))
77
101
  end
78
102
 
103
+ # Define and instantiate a table UI Element for this page section.
104
+ #
105
+ # @param element_name [symbol] name of table object (as a symbol)
106
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
107
+ # @example
108
+ # table :payments_table, "//table[@class='payments_table']"
109
+ #
79
110
  def self.table(element_name, locator)
80
111
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :table);end))
81
112
  end
82
113
 
114
+ # Define and instantiate a select list UI Element for this page section.
115
+ #
116
+ # @param element_name [symbol] name of select list object (as a symbol)
117
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
118
+ # @example
119
+ # selectlist :category_selector, "search_form_category_chosen"
120
+ # selectlist :gender_select, "//select[@id='customer_gender']"
121
+ #
83
122
  def self.selectlist(element_name, locator)
84
123
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :selectlist);end))
85
124
  end
86
125
 
126
+ # Define and instantiate an image UI Element for this page section.
127
+ #
128
+ # @param element_name [symbol] name of image object (as a symbol)
129
+ # @param locator [String] css selector or xpath expression that uniquely identifies object
130
+ # @example
131
+ # image :basket_item_image, "div.product_image"
132
+ # image :corporate_logo_image, "//img[@alt='MyCompany_logo']"
133
+ #
87
134
  def self.image(element_name, locator)
88
135
  class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::UIElement.new(self, "#{locator}", :section, :image);end))
89
136
  end
@@ -71,6 +71,13 @@ module TestCentricity
71
71
  page.driver.browser.mouse.double_click(obj.native)
72
72
  end
73
73
 
74
+ # Click at a specific location within an an object
75
+ #
76
+ # @param x [Integer] X offset
77
+ # @param y [Integer] Y offset
78
+ # @example
79
+ # basket_item_image.click_at(10, 10)
80
+ #
74
81
  def click_at(x, y)
75
82
  obj, _ = find_element
76
83
  raise "Object #{@locator} not found" unless obj
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '0.5.3'
2
+ VERSION = '0.5.4'
3
3
  end
@@ -12,10 +12,10 @@ Gem::Specification.new do |spec|
12
12
  spec.email = ['test_automation@icloud.com']
13
13
  spec.summary = %q{A Page Object and Data Object Model Framework for desktop and responsive mobile web testing}
14
14
  spec.description = %q{
15
- TestCentricity™ core generic framework for desktop and responsive mobile web site testing implements a
16
- Page Object Model DSL, for use with Capybara and selenium-webdriver. Supports testing against locally
17
- hosted desktop browsers (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated mobile browsers
18
- (using Firefox), or on cloud hosted browsers on BrowserStack, Sauce Labs, or CrossBrowserTesting.}
15
+ TestCentricity™ core generic framework for desktop and responsive mobile web site testing implements a Page Object
16
+ Model DSL, for use with Capybara and selenium-webdriver. Supports testing against locally hosted desktop browsers
17
+ (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated mobile browsers (using Firefox), or on cloud hosted
18
+ browsers using the BrowserStack, Sauce Labs, or CrossBrowserTesting services.}
19
19
  spec.homepage = ''
20
20
  spec.license = 'BSD3'
21
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
@@ -158,10 +158,10 @@ dependencies:
158
158
  version: 1.1.1
159
159
  description: |2-
160
160
 
161
- TestCentricity™ core generic framework for desktop and responsive mobile web site testing implements a
162
- Page Object Model DSL, for use with Capybara and selenium-webdriver. Supports testing against locally
163
- hosted desktop browsers (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated mobile browsers
164
- (using Firefox), or on cloud hosted browsers on BrowserStack, Sauce Labs, or CrossBrowserTesting.
161
+ TestCentricity™ core generic framework for desktop and responsive mobile web site testing implements a Page Object
162
+ Model DSL, for use with Capybara and selenium-webdriver. Supports testing against locally hosted desktop browsers
163
+ (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated mobile browsers (using Firefox), or on cloud hosted
164
+ browsers using the BrowserStack, Sauce Labs, or CrossBrowserTesting services.
165
165
  email:
166
166
  - test_automation@icloud.com
167
167
  executables: []