testcentricity_web 0.4.1 → 0.4.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 411dbfd9b34e65051d04c4aaea10a483a2e6196f
|
4
|
+
data.tar.gz: 81ca19c8cb7489ca37514fad7d76c8f25420971e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f35a9baf87dbf8a86bf57e4dce84c9b51c3fae59f28bc87752a558aa2dd427dc9506b0246d315c03762a551656b5ce9dc7d1abe063f5193657e3c6388eeed32
|
7
|
+
data.tar.gz: b8a2d7f6518a9d5f797c9be9a300f422d02acbba36e9158d025475e32c0545608ba69808ef0b6a090c7bd7fd9e796f5a6c222151935b066c4892e33e04be5da4
|
data/README.md
CHANGED
@@ -30,6 +30,7 @@ If you are using Cucumber, you need to require the following in your *env.rb* fi
|
|
30
30
|
require 'capybara/cucumber'
|
31
31
|
require 'testcentricity_web'
|
32
32
|
|
33
|
+
|
33
34
|
###Using RSpec
|
34
35
|
|
35
36
|
If you are using RSpec instead, you need to require the following in your *env.rb* file:
|
@@ -38,6 +39,7 @@ If you are using RSpec instead, you need to require the following in your *env.r
|
|
38
39
|
require 'capybara/rspec'
|
39
40
|
require 'testcentricity_web'
|
40
41
|
|
42
|
+
|
41
43
|
###Selenium WebDriver
|
42
44
|
|
43
45
|
If you choose to not connect to selenium-webdriver using the ***WebDriverConnect.initialize_web_driver*** method, or if you need to
|
@@ -47,7 +49,7 @@ directly call methods in selenium-webdriver, you will also need to require the f
|
|
47
49
|
|
48
50
|
|
49
51
|
|
50
|
-
##
|
52
|
+
##Usage
|
51
53
|
|
52
54
|
###Defining a Page Object
|
53
55
|
|
@@ -134,12 +136,72 @@ You can add high level methods for interacting with the UI to hide implementatio
|
|
134
136
|
end
|
135
137
|
|
136
138
|
|
137
|
-
Once instantiated, you can call your methods as shown below:
|
139
|
+
Once your **Page Objects** have been instantiated, you can call your methods as shown below:
|
138
140
|
|
139
141
|
login_page.remember_me(true)
|
140
142
|
login_page.user_id_field.set('snicklefritz', 'Pa55w0rd')
|
141
143
|
|
144
|
+
|
145
|
+
|
146
|
+
###Defining a PageSection Object
|
147
|
+
|
148
|
+
You define new **PageSection Objects** as shown below:
|
149
|
+
|
150
|
+
class SearchForm < TestCentricity::PageSection
|
151
|
+
trait(:section_locator) { "//form[@id='gnav-search']" }
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
###Adding UI Elements to your PageSection Object
|
156
|
+
|
157
|
+
Your PageSection Object's **UI Elements** are added as shown below:
|
158
|
+
|
159
|
+
class SearchForm < TestCentricity::PageSection
|
160
|
+
trait(:section_locator) { "//form[@id='gnav-search']" }
|
161
|
+
|
162
|
+
# Search Form UI elements
|
163
|
+
textfield :search_field, "//input[@id='search-query']"
|
164
|
+
button :search_button, "//button[@type='submit']"
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
###Adding Methods to your PageSection Object
|
169
|
+
|
170
|
+
You can add high level methods to your PageSection Objects, as shown below:
|
171
|
+
|
172
|
+
class SearchForm < TestCentricity::PageSection
|
173
|
+
trait(:section_locator) { "//form[@id='gnav-search']" }
|
174
|
+
|
175
|
+
# Search Form UI elements
|
176
|
+
textfield :search_field, "//input[@id='search-query']"
|
177
|
+
button :search_button, "//button[@type='submit']"
|
178
|
+
|
179
|
+
def search_for(value)
|
180
|
+
search_field.set(value)
|
181
|
+
search_button.click
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
###Adding PageSection Objects to your Page Object
|
187
|
+
|
188
|
+
Your Page Object's **PageSection Objects** are added as shown below:
|
189
|
+
|
190
|
+
class HomePage < TestCentricity::PageObject
|
191
|
+
trait(:page_name) { 'Home' }
|
192
|
+
trait(:page_url) { "/dashboard" }
|
193
|
+
trait(:page_locator) { "//body[@class='dashboard']" }
|
194
|
+
|
195
|
+
# Home page Section Objects
|
196
|
+
section :search_form, SearchForm
|
197
|
+
end
|
198
|
+
|
199
|
+
Once your **Page Object** has been instantiated, you can call its **PageSection** methods as shown below:
|
200
|
+
|
201
|
+
home_page.search_form.search_for('ocarina')
|
202
|
+
|
142
203
|
|
204
|
+
|
143
205
|
## Copyright and License
|
144
206
|
|
145
207
|
TestCentricity(tm) Framework is Copyright (c) 2014-2016, Tony Mrozinski.
|
@@ -43,7 +43,7 @@ module TestCentricity
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def self.
|
46
|
+
def self.close_current_browser_instance
|
47
47
|
Capybara.page.driver.browser.close
|
48
48
|
Capybara.page.driver.browser.switch_to.window(Capybara.page.driver.browser.window_handles.last)
|
49
49
|
end
|
@@ -91,10 +91,6 @@ module TestCentricity
|
|
91
91
|
PageManager.set_current_page(self)
|
92
92
|
end
|
93
93
|
|
94
|
-
def take_screen_shot(page_name, context)
|
95
|
-
save_page_screen_shot(page_name, context)
|
96
|
-
end
|
97
|
-
|
98
94
|
def verify_page_contains(content)
|
99
95
|
raise "Expected page to have content '#{content}'" unless page.has_content?(:visible, content)
|
100
96
|
end
|
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.4.
|
4
|
+
version: 0.4.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-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|