testcentricity_web 0.6.7 → 0.6.8
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 +9 -3
- data/lib/testcentricity_web/elements/checkbox.rb +18 -0
- data/lib/testcentricity_web/elements/radio.rb +55 -0
- data/lib/testcentricity_web/page_objects_helper.rb +12 -0
- data/lib/testcentricity_web/page_sections_helper.rb +13 -1
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/webdriver_helper.rb +1 -1
- data/lib/testcentricity_web.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cb0e1a1851e2ac0feb4df8e4f1b0b80b7b7f2d4
|
4
|
+
data.tar.gz: 35ac1c8ade715fdd4ed7b1157caa297561b8e0a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 653539ce697349cc81341c96669abc6cb647e687fa630bc79c57acc844892a667c871d771673501c71b6427b25ad570142d6c0b570c28f9827ba1b3739432043
|
7
|
+
data.tar.gz: 6305c88271b41331e3dfca4fffd697c8b4223b69a03bc8821523dd0d3fbd98ad2d289922af589c600a7c5241202d00f143a7d5789730b3ea25e52d6c42768b31
|
data/README.md
CHANGED
@@ -4,8 +4,9 @@ The TestCentricity™ core generic framework for desktop and mobile web site tes
|
|
4
4
|
use with Cucumber, Capybara, and Selenium-Webdriver.
|
5
5
|
|
6
6
|
The TestCentricity™ web gem supports running testing against the following web test targets:
|
7
|
+
|
7
8
|
* locally hosted desktop browsers (Firefox, Chrome, Safari, IE, or Edge)
|
8
|
-
* locally hosted emulated iOS and
|
9
|
+
* locally hosted emulated iOS, Android, and Windows Phone mobile browsers (using Firefox)
|
9
10
|
* a "headless" browser (using Poltergeist and PhantomJS)
|
10
11
|
* cloud hosted desktop or mobile web browsers using the BrowserStack, Sauce Labs, CrossBrowserTesting, or TestingBot services.
|
11
12
|
|
@@ -345,8 +346,9 @@ For locally hosted desktop web browsers, the `WEB_BROWSER` Environment Variable
|
|
345
346
|
|
346
347
|
### Locally hosted emulated mobile web browser
|
347
348
|
|
348
|
-
You can also run your tests against emulated mobile device browsers within a locally hosted instance of the Firefox desktop browser.
|
349
|
-
|
349
|
+
You can also run your tests against emulated mobile device browsers within a locally hosted instance of the Firefox desktop browser. The specified
|
350
|
+
mobile browser's user agent and default screen resolution and orientation will be automatically be set in the local Firefox browser instance. You
|
351
|
+
may even specify the emulated device's screen orientation. For locally hosted emulated mobile web browsers, the `WEB_BROWSER` Environment Variable
|
350
352
|
must be set to one of the values from the table below:
|
351
353
|
|
352
354
|
`WEB_BROWSER` |
|
@@ -360,6 +362,8 @@ must be set to one of the values from the table below:
|
|
360
362
|
`iphone6_plus` |
|
361
363
|
`android_phone` |
|
362
364
|
`android_tablet` |
|
365
|
+
`windows_phone7` |
|
366
|
+
`windows_phone8` |
|
363
367
|
|
364
368
|
To specify the emulated device's screen orientation, you set the `ORIENTATION` Environment Variable to either `portrait` or `landscape`.
|
365
369
|
|
@@ -526,6 +530,8 @@ replace the placeholder text with your user account and authorization code for t
|
|
526
530
|
iphone6_plus: WEB_BROWSER=iphone6_plus <%= mobile %>
|
527
531
|
android_phone: WEB_BROWSER=android_phone <%= mobile %>
|
528
532
|
android_tablet: WEB_BROWSER=android_tablet <%= mobile %>
|
533
|
+
windows_phone7: WEB_BROWSER=windows_phone7 <%= mobile %>
|
534
|
+
windows_phone8: WEB_BROWSER=windows_phone8 <%= mobile %>
|
529
535
|
|
530
536
|
|
531
537
|
#==============
|
@@ -34,6 +34,24 @@ module TestCentricity
|
|
34
34
|
obj.set(state)
|
35
35
|
end
|
36
36
|
|
37
|
+
# Set the check state of a checkbox object.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# remember_me_checkbox.check
|
41
|
+
#
|
42
|
+
def check
|
43
|
+
set_checkbox_state(true)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Uncheck a checkbox object.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# remember_me_checkbox.uncheck
|
50
|
+
#
|
51
|
+
def uncheck
|
52
|
+
set_checkbox_state(false)
|
53
|
+
end
|
54
|
+
|
37
55
|
def verify_check_state(state, enqueue = false)
|
38
56
|
actual = checked?
|
39
57
|
enqueue ?
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class Radio < UIElement
|
3
|
+
|
4
|
+
def initialize(parent, locator, context)
|
5
|
+
@parent = parent
|
6
|
+
@locator = locator
|
7
|
+
@context = context
|
8
|
+
@type = :radio
|
9
|
+
@alt_locator = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
# Is radio button selected?
|
13
|
+
#
|
14
|
+
# @return [Boolean]
|
15
|
+
# @example
|
16
|
+
# accept_terms_radio.selected?
|
17
|
+
#
|
18
|
+
def selected?
|
19
|
+
obj, _ = find_element
|
20
|
+
object_not_found_exception(obj, 'Radio')
|
21
|
+
obj.checked?
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set the select state of a radio button object.
|
25
|
+
#
|
26
|
+
# @param state [Boolean] true = selected / false = unselected
|
27
|
+
# @example
|
28
|
+
# accept_terms_radio.set_selected_state(true)
|
29
|
+
#
|
30
|
+
def set_selected_state(state)
|
31
|
+
obj, _ = find_element
|
32
|
+
object_not_found_exception(obj, 'Radio')
|
33
|
+
invalid_object_type_exception(obj, 'radio')
|
34
|
+
obj.set(state)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Set the selected state of a radio button object.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# accept_terms_radio.select
|
41
|
+
#
|
42
|
+
def select
|
43
|
+
set_selected_state(true)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Unselect a radio button object.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# accept_terms_radio.unselect
|
50
|
+
#
|
51
|
+
def unselect
|
52
|
+
set_selected_state(false)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -67,6 +67,18 @@ module TestCentricity
|
|
67
67
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :page);end))
|
68
68
|
end
|
69
69
|
|
70
|
+
# Declare and instantiate a radio button UI Element for this page object.
|
71
|
+
#
|
72
|
+
# @param element_name [Symbol] name of radio object (as a symbol)
|
73
|
+
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
74
|
+
# @example
|
75
|
+
# radio :accept_terms_radio, "//input[@id='Accept_Terms']"
|
76
|
+
# radio :decline_terms_radio, "decline_terms_conditions"
|
77
|
+
#
|
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
|
+
end
|
81
|
+
|
70
82
|
# Declare and instantiate a label UI Element for this page object.
|
71
83
|
#
|
72
84
|
# @param element_name [Symbol] name of label object (as a symbol)
|
@@ -75,6 +75,18 @@ module TestCentricity
|
|
75
75
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::CheckBox.new(self, "#{locator}", :section);end))
|
76
76
|
end
|
77
77
|
|
78
|
+
# Declare and instantiate a radio button UI Element for this page section.
|
79
|
+
#
|
80
|
+
# @param element_name [Symbol] name of radio object (as a symbol)
|
81
|
+
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
82
|
+
# @example
|
83
|
+
# radio :accept_terms_radio, "//input[@id='Accept_Terms']"
|
84
|
+
# radio :decline_terms_radio, "decline_terms_conditions"
|
85
|
+
#
|
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
|
+
end
|
89
|
+
|
78
90
|
# Declare and instantiate a label UI Element for this page section.
|
79
91
|
#
|
80
92
|
# @param element_name [Symbol] name of label object (as a symbol)
|
@@ -134,7 +146,7 @@ module TestCentricity
|
|
134
146
|
class_eval(%Q(def #{element_name.to_s};@#{element_name.to_s} ||= TestCentricity::Image.new(self, "#{locator}", :section);end))
|
135
147
|
end
|
136
148
|
|
137
|
-
# Declare and instantiate a File Field UI Element for this page
|
149
|
+
# Declare and instantiate a File Field UI Element for this page section.
|
138
150
|
#
|
139
151
|
# @param element_name [Symbol] name of file field object (as a symbol)
|
140
152
|
# @param locator [String] css selector or xpath expression that uniquely identifies object
|
@@ -51,7 +51,7 @@ module TestCentricity
|
|
51
51
|
case browser.downcase.to_sym
|
52
52
|
when :firefox, :chrome, :ie, :safari, :edge
|
53
53
|
Capybara::Selenium::Driver.new(app, :browser => browser.to_sym)
|
54
|
-
when :iphone, :iphone5, :iphone6, :iphone6_plus, :ipad, :ipad_pro, :android_phone, :android_tablet
|
54
|
+
when :iphone, :iphone5, :iphone6, :iphone6_plus, :ipad, :ipad_pro, :android_phone, :android_tablet, :windows_phone7, :windows_phone8
|
55
55
|
Environ.set_platform(:mobile)
|
56
56
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
57
57
|
profile['general.useragent.override'] = Browsers.mobile_device_agent(browser)
|
data/lib/testcentricity_web.rb
CHANGED
@@ -23,6 +23,7 @@ require 'testcentricity_web/elements/file_field'
|
|
23
23
|
require 'testcentricity_web/elements/image'
|
24
24
|
require 'testcentricity_web/elements/label'
|
25
25
|
require 'testcentricity_web/elements/link'
|
26
|
+
require 'testcentricity_web/elements/radio'
|
26
27
|
require 'testcentricity_web/elements/select_list'
|
27
28
|
require 'testcentricity_web/elements/table'
|
28
29
|
require 'testcentricity_web/elements/textfield'
|
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.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- A.J. Mrozinski
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/testcentricity_web/elements/image.rb
|
177
177
|
- lib/testcentricity_web/elements/label.rb
|
178
178
|
- lib/testcentricity_web/elements/link.rb
|
179
|
+
- lib/testcentricity_web/elements/radio.rb
|
179
180
|
- lib/testcentricity_web/elements/select_list.rb
|
180
181
|
- lib/testcentricity_web/elements/table.rb
|
181
182
|
- lib/testcentricity_web/elements/textfield.rb
|