testcentricity_web 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +28 -0
- data/README.md +21 -0
- data/Rakefile +1 -0
- data/lib/testcentricity_web.rb +69 -0
- data/lib/testcentricity_web/browser_helper.rb +118 -0
- data/lib/testcentricity_web/data_objects_helper.rb +38 -0
- data/lib/testcentricity_web/drag_drop_helper.rb +15 -0
- data/lib/testcentricity_web/environment.rb +134 -0
- data/lib/testcentricity_web/excel_helper.rb +241 -0
- data/lib/testcentricity_web/exception_queue_helper.rb +29 -0
- data/lib/testcentricity_web/page_objects_helper.rb +147 -0
- data/lib/testcentricity_web/page_sections_helper.rb +161 -0
- data/lib/testcentricity_web/siebel_open_ui_helper.rb +59 -0
- data/lib/testcentricity_web/ui_elements_helper.rb +465 -0
- data/lib/testcentricity_web/utility_helpers.rb +18 -0
- data/lib/testcentricity_web/version.rb +3 -0
- data/lib/testcentricity_web/webdriver_helper.rb +170 -0
- data/testcentricity_web.gemspec +31 -0
- metadata +200 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4b426de480109e3629c091ea71a21bf2c3de61c0
|
4
|
+
data.tar.gz: 1b0cd17305facf14c3a49ae16f5775ba526e452e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7365bcde98755123f7119518bd092421f99cdb1b360f230a6a651ba6b04c65d2c24d804ba543e035a36d102d2cff833b8e91dafd94b7810ad7fa5dd689db634e
|
7
|
+
data.tar.gz: 61406e7464a07e74c39a21be2c56beecaa7ab4c29f539d8cd32d4ecd6ace2a670937608e15b3b67d54a37cc378d11b74006d7c567d920d301e6929edfe46a470
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
TestCentricity (tm) Framework is Copyright (c) 2014-2016, Tony Mrozinski
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
1. Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
notice, this list of conditions and the following disclaimer in the
|
13
|
+
documentation and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
16
|
+
may be used to endorse or promote products derived from this software without
|
17
|
+
specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
24
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
25
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
+
POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# TestcentricityWeb
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'testcentricity_web'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install testcentricity_web
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'capybara/cucumber'
|
2
|
+
require 'rspec/expectations'
|
3
|
+
require 'testcentricity_web/browser_helper'
|
4
|
+
require 'testcentricity_web/data_objects_helper'
|
5
|
+
require 'testcentricity_web/drag_drop_helper'
|
6
|
+
require 'testcentricity_web/excel_helper'
|
7
|
+
require 'testcentricity_web/exception_queue_helper'
|
8
|
+
require 'testcentricity_web/page_objects_helper'
|
9
|
+
require 'testcentricity_web/page_sections_helper'
|
10
|
+
require 'testcentricity_web/siebel_open_ui_helper'
|
11
|
+
require 'testcentricity_web/ui_elements_helper'
|
12
|
+
require 'testcentricity_web/utility_helpers'
|
13
|
+
require 'testcentricity_web/environment'
|
14
|
+
require 'testcentricity_web/webdriver_helper'
|
15
|
+
require 'testcentricity_web/version'
|
16
|
+
|
17
|
+
|
18
|
+
module TestCentricity
|
19
|
+
class PageManager
|
20
|
+
attr_accessor :current_page
|
21
|
+
|
22
|
+
@page_objects = {}
|
23
|
+
|
24
|
+
def self.register_page_object(page_ref, page_object)
|
25
|
+
@page_objects[page_ref] = page_object unless @page_objects.has_key?(page_ref)
|
26
|
+
page_key = page_object.page_name.gsub(/\s+/, "").downcase.to_sym
|
27
|
+
if page_key != page_ref
|
28
|
+
@page_objects[page_key] = page_object unless @page_objects.has_key?(page_key)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.loaded?
|
33
|
+
not @page_objects.empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.pages
|
37
|
+
@page_objects
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.find_page(page_name)
|
41
|
+
(page_name.is_a? String) ? page_id = page_name.gsub(/\s+/, "").downcase.to_sym : page_id = page_name
|
42
|
+
@page_objects[page_id]
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.current_page
|
46
|
+
@current_page
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.set_current_page(page)
|
50
|
+
@current_page = page
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class DataManager
|
55
|
+
@data_objects = {}
|
56
|
+
|
57
|
+
def self.register_data_object(data_type, data_class)
|
58
|
+
@data_objects[data_type] = data_class unless @data_objects.has_key?(data_type)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.loaded?
|
62
|
+
not @data_objects.empty?
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.data_objects
|
66
|
+
@data_objects
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class Browsers
|
3
|
+
include Capybara::DSL
|
4
|
+
|
5
|
+
# Resize selenium browser window to avoid Selenium::WebDriver::Error::MoveTargetOutOfBoundsError errors
|
6
|
+
#
|
7
|
+
# Example usage:
|
8
|
+
#
|
9
|
+
# config.before(:each) do
|
10
|
+
# set_browser_window_size(1250, 800) if Capybara.current_driver == :selenium
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
def self.set_browser_window_size(resolution)
|
14
|
+
window = Capybara.current_session.driver.browser.manage.window
|
15
|
+
window.resize_to(resolution[0], resolution[1])
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.maximize_browser
|
19
|
+
window = Capybara.current_session.driver.browser.manage.window
|
20
|
+
window.maximize
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.refresh_browser
|
24
|
+
page.driver.browser.navigate.refresh
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.switch_to_new_browser_instance
|
28
|
+
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.close_all_browser_instances
|
32
|
+
page.driver.browser.window_handles.each do |handle|
|
33
|
+
page.driver.browser.switch_to.window(handle)
|
34
|
+
page.driver.browser.close
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.close_current_browser_window
|
39
|
+
page.driver.browser.close
|
40
|
+
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.close_old_browser_instance
|
44
|
+
page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)
|
45
|
+
page.driver.browser.close
|
46
|
+
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.close_named_browser_instance(name)
|
50
|
+
page.driver.browser.switch_to.window(page.driver.find_window(name))
|
51
|
+
page.driver.browser.close
|
52
|
+
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.delete_all_cookies
|
56
|
+
if Capybara.current_driver == :selenium
|
57
|
+
browser = Capybara.current_session.driver.browser
|
58
|
+
if browser.respond_to?(:manage) and browser.manage.respond_to?(:delete_all_cookies)
|
59
|
+
browser.manage.delete_all_cookies
|
60
|
+
else
|
61
|
+
raise 'Could not clear cookies.'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.mobile_device_agent(device)
|
67
|
+
devices = { :iphone => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
|
68
|
+
:iphone4 => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
|
69
|
+
:iphone5 => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
|
70
|
+
:iphone6 => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
|
71
|
+
:iphone6_plus => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
|
72
|
+
:ipad => "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/3B143 Safari/601.1",
|
73
|
+
:ipad_pro => "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1",
|
74
|
+
:android_phone => "Mozilla/5.0 (Linux; U; Android 4.0.1; en-us; sdk Build/ICS_MR0) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
75
|
+
:android_tablet => "Mozilla/5.0 (Linux; U; Android 3.0; en-us; GT-P7100 Build/HRI83) AppleWebkit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
|
76
|
+
:windows_phone8 => "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
|
77
|
+
:windows_phone7 => "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)"
|
78
|
+
}
|
79
|
+
|
80
|
+
key = device.gsub(/\s+/, "").downcase.to_sym
|
81
|
+
agent_string = devices[key]
|
82
|
+
raise "Device '#{device}' is not defined" unless agent_string
|
83
|
+
agent_string
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.browser_size(browser, orientation)
|
87
|
+
sizes = { :iphone => [320, 568, :portrait],
|
88
|
+
:iphone4 => [320, 480, :portrait],
|
89
|
+
:iphone5 => [320, 568, :portrait],
|
90
|
+
:iphone6 => [375, 667, :portrait],
|
91
|
+
:iphone6_plus => [414, 736, :portrait],
|
92
|
+
:ipad => [1024, 768, :landscape],
|
93
|
+
:ipad_pro => [1366, 1024, :landscape],
|
94
|
+
:android_phone => [320, 480, :portrait],
|
95
|
+
:android_tablet => [1024, 768, :landscape],
|
96
|
+
:windows_phone8 => [320, 480, :portrait],
|
97
|
+
:windows_phone7 => [320, 480, :portrait]
|
98
|
+
}
|
99
|
+
key = browser.gsub(/\s+/, "").downcase.to_sym
|
100
|
+
browser_data = sizes[key]
|
101
|
+
if browser_data
|
102
|
+
width = browser_data[0]
|
103
|
+
height = browser_data[1]
|
104
|
+
default_orientation = browser_data[2]
|
105
|
+
if orientation
|
106
|
+
(orientation.downcase.to_sym == default_orientation) ?
|
107
|
+
size = [width, height] :
|
108
|
+
size = [height, width]
|
109
|
+
else
|
110
|
+
size = [width, height]
|
111
|
+
end
|
112
|
+
else
|
113
|
+
size = [1900, 1000]
|
114
|
+
end
|
115
|
+
size
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class DataObject
|
3
|
+
attr_accessor :current
|
4
|
+
attr_accessor :context
|
5
|
+
attr_accessor :hash_table
|
6
|
+
|
7
|
+
def initialize(data)
|
8
|
+
@hash_table = data
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.set_current(current)
|
12
|
+
@current = current
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.current
|
16
|
+
@current
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
class DataSource
|
22
|
+
attr_accessor :current
|
23
|
+
|
24
|
+
def pick_excel_data_source(sheet, row_name)
|
25
|
+
data_file = Excel_Data.get_environment_data_file
|
26
|
+
data_file = XL_PRIMARY_DATA_FILE unless Excel_Data.rowspec_exists?(data_file, sheet, row_name)
|
27
|
+
data_file
|
28
|
+
end
|
29
|
+
|
30
|
+
def read_excel_row_data(sheet, row_name)
|
31
|
+
Excel_Data.read_row_data(pick_excel_data_source(sheet, row_name), sheet, row_name)
|
32
|
+
end
|
33
|
+
|
34
|
+
def read_excel_pool_data(sheet, row_name)
|
35
|
+
Excel_Data.read_row_from_pool(pick_excel_data_source(sheet, row_name), sheet, row_name)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CapybaraExtension
|
2
|
+
def drag_by(right_by, down_by)
|
3
|
+
base.drag_by(right_by, down_by)
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
module CapybaraSeleniumExtension
|
9
|
+
def drag_by(right_by, down_by)
|
10
|
+
driver.browser.action.drag_and_drop_by(native, right_by, down_by).perform
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
::Capybara::Selenium::Node.send :include, CapybaraSeleniumExtension
|
15
|
+
::Capybara::Node::Element.send :include, CapybaraExtension
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class EnvironData < TestCentricity::DataSource
|
3
|
+
attr_accessor :current
|
4
|
+
|
5
|
+
WKS_ENVIRONS ||= 'Environments'
|
6
|
+
|
7
|
+
def find_environ(row_name)
|
8
|
+
@current = Environ.new(Excel_Data.read_row_data(XL_PRIMARY_DATA_FILE, WKS_ENVIRONS, row_name))
|
9
|
+
Environ.set_current(@current)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
class Environ < TestCentricity::DataObject
|
15
|
+
@session_id = Time.now.strftime('%d%H%M%S%L')
|
16
|
+
@session_time_stamp = Time.now.strftime('%Y%m%d%H%M%S')
|
17
|
+
@session_code
|
18
|
+
|
19
|
+
@screen_shots = []
|
20
|
+
|
21
|
+
attr_accessor :browser
|
22
|
+
attr_accessor :os
|
23
|
+
attr_accessor :device
|
24
|
+
attr_accessor :device_type
|
25
|
+
attr_accessor :platform
|
26
|
+
attr_accessor :signed_in
|
27
|
+
attr_accessor :portal_status
|
28
|
+
|
29
|
+
attr_reader :protocol
|
30
|
+
attr_reader :hostname
|
31
|
+
attr_reader :base_url
|
32
|
+
attr_reader :user_id
|
33
|
+
attr_reader :password
|
34
|
+
attr_reader :append
|
35
|
+
|
36
|
+
def initialize(data)
|
37
|
+
@protocol = data['PROTOCOL']
|
38
|
+
@hostname = data['HOST_NAME']
|
39
|
+
@base_url = data['BASE_URL']
|
40
|
+
@user_id = data['USER_ID']
|
41
|
+
@password = data['PASSWORD']
|
42
|
+
@append = data['APPEND']
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.session_code
|
47
|
+
if @session_code == nil
|
48
|
+
characters = ('a'..'z').to_a
|
49
|
+
@session_code = (0..12).map{characters.sample}.join
|
50
|
+
end
|
51
|
+
@session_code
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.session_id
|
55
|
+
@session_id
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.session_time_stamp
|
59
|
+
@session_time_stamp
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.set_browser(browser)
|
63
|
+
@browser = browser.downcase.to_sym
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.browser
|
67
|
+
@browser
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.set_os(os)
|
71
|
+
@os = os
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.os
|
75
|
+
@os
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.set_device(device)
|
79
|
+
@device = device
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.is_device?
|
83
|
+
@device
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.set_device_type(type)
|
87
|
+
@device_type = type.downcase
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.device_type
|
91
|
+
@device_type
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.set_platform(platform)
|
95
|
+
@platform = platform
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.is_mobile?
|
99
|
+
@platform == :mobile
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.is_desktop?
|
103
|
+
@platform == :desktop
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.set_signed_in(signed_in)
|
107
|
+
@signed_in = signed_in
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.is_signed_in?
|
111
|
+
@signed_in
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.set_portal_state(portal_state)
|
115
|
+
@portal_status = portal_state
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.portal_state
|
119
|
+
@portal_status
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.save_screen_shot(screen_shot)
|
123
|
+
@screen_shots.push(screen_shot)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.get_screen_shots
|
127
|
+
@screen_shots
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.reset_contexts
|
131
|
+
@screen_shots = []
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|