test_utils 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8cf742132c2f26a71d6edbfb4d79e9486f51fa99
4
+ data.tar.gz: c2071534a7ae909edc8bacf76e5c2dd13436b3eb
5
+ SHA512:
6
+ metadata.gz: 479a502e385eed0eeed2add53d71feecf18a09e99af32379151b421498aa41a70f2ea1f7bb6f3aaa463d5cce19d56be56936da57ff6a22cc51fe51fe0756cfab
7
+ data.tar.gz: 85b3e72d301e74b69a87093ba6333bdf538513d9beb6092063ce10a7d9596249dee838fb5945456de8e5eafe6ccbb0359b15f7c6548b8e4301e0544138ce42b5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in test_utils.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # TestUtils
2
+
3
+ Collection of useful test related modules.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'test_utils'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install test_utils
20
+
21
+ ## Usage
22
+
23
+
24
+ ### Start up a browser locally
25
+
26
+ 1. Set the environment variable "PLATFORM" to "Chrome", "Firefox" or "Mobile". The drivers are already included in the (resources) directory.
27
+
28
+ `$ PLATFORM=Chrome`
29
+
30
+ ```ruby
31
+ require 'test_utils/browser_tests/browser_setup'
32
+ include BrowserSetup
33
+
34
+ start_browser
35
+ @browser.goto 'https://github.com/ef-ice/test_utils'
36
+ raise 'not found!' unless @browser.title.include?('Readme')
37
+ close_browser
38
+
39
+ ```
40
+
41
+ Note: Using "Mobile" will start a browser in mobile size (this uses the [webdriver-user-agent](https://github.com/alisterscott/webdriver-user-agent) gem)
42
+
43
+
44
+ ### Start up a browser in Browser stack
45
+
46
+ 1. Set the environment variable "BS":
47
+
48
+ `$ BS="win_7_ie_11"`
49
+
50
+ `$ BS="win_7_chrome"`
51
+
52
+ `$ BS="iphone_6s"`
53
+
54
+ 2. Set your credentails:
55
+
56
+ `$ BS_USER_NAME="your_username"`
57
+
58
+ `$ BS_AUTH_KEY="your_key"`
59
+
60
+ Note: Not including the browser version will get the latest available version of the browser. For the full list of browsers available in Browserstack Automate please go [here](https://www.browserstack.com/list-of-browsers-and-platforms?product=automate)
61
+
62
+
63
+ ### Start up a browser in Headless mode
64
+
65
+ Setting the environment variable "HEADLESS" to "true", will start a headless display (this uses the [headless](https://github.com/leonid-shevtsov/headless) gem)
66
+
67
+ `$ HEADLESS=TRUE`
68
+
69
+ Note: Does not work in Mac. Works in Linux.
70
+
71
+ ### Other watir utils
72
+
73
+ Have a look at other useful methods in the [web_helper](https://github.com/ef-ice/test_utils/blob/master/lib/test_utils/browser_tests/web_helper.rb) module.
74
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "test_utils"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,167 @@
1
+ require 'watir-webdriver'
2
+ require 'selenium-webdriver'
3
+ require 'webdriver-user-agent'
4
+
5
+ require_relative 'browser_stack_helper'
6
+ require_relative 'run_parameters'
7
+ require_relative 'web_helper'
8
+
9
+ include BrowserStackHelper
10
+ include Selenium
11
+ include RunParameters
12
+ include WebHelper
13
+
14
+ module BrowserSetup
15
+ # Starts a Browser
16
+ # Checks 'run_test_in_browser_stack?' to determine if it should run in BrowserStack
17
+ # Checks 'headless' to determine if it should start a headless display
18
+ # Otherwise, starts a local browser, checks 'browser' to determine which browser to use
19
+ def start_browser
20
+ client = Selenium::WebDriver::Remote::Http::Default.new
21
+ if run_test_in_browser_stack?
22
+ setup_browser_stack(client)
23
+ else
24
+ start_headless_display if headless == :true
25
+ # Local test run
26
+ client.timeout = 30 # Page load timeout
27
+ case platform
28
+ when :firefox
29
+ setup_firefox(client)
30
+ when :chrome
31
+ setup_chrome(client)
32
+ when :mobile
33
+ setup_chrome_mobile(client)
34
+ else fail 'Invalid browser'
35
+ end
36
+ end
37
+
38
+ @browser.driver.manage.timeouts.implicit_wait = 5
39
+ @browser.driver.manage.window.resize_to(1440, 900) unless mobile?
40
+ end
41
+
42
+ # Set up firefox
43
+ def setup_firefox(client)
44
+ trusted_profile = Selenium::WebDriver::Firefox::Profile.new
45
+ trusted_profile.native_events = true
46
+ @browser = Watir::Browser.new(:firefox, :profile => trusted_profile, :http_client => client)
47
+ end
48
+
49
+ # Set up Chrome
50
+ def setup_chrome(client)
51
+ times_retried = 0
52
+ max_retries = 3
53
+ begin
54
+ Selenium::WebDriver::Chrome.driver_path = chrome_driver_path
55
+ @browser = Watir::Browser.new(:chrome, :http_client => client, :switches => %w[--no-sandbox])
56
+ rescue Net::ReadTimeout => error
57
+ if times_retried < max_retries
58
+ p '### ERROR: Net::ReadTimeout on Browser Initialize (Watir::Browser.new) ###'
59
+ p '### RETRYING ... ###'
60
+ sleep 2
61
+ times_retried += 1
62
+ retry
63
+ else
64
+ p '### ERROR: Net::ReadTimeout on Browser Initialize (Watir::Browser.new) ###'
65
+ p error
66
+ fail "Browser failed to initialize after #{(times_retried + 1)} attempts. ###"
67
+ end
68
+ end
69
+ end
70
+
71
+ def setup_chrome_mobile(client)
72
+ Selenium::WebDriver::Chrome.driver_path = chrome_driver_path
73
+ driver = Webdriver::UserAgent.driver(:browser => :chrome, :agent => :iphone, :orientation => :portrait)
74
+ @browser = Watir::Browser.new(driver, :http_client => client)
75
+ end
76
+
77
+ # Set up browser stack
78
+ def setup_browser_stack(client)
79
+ client.timeout = 90 # Page load timeout
80
+ @browser = Watir::Browser.new(:remote, :url => bs_remote_url, :desired_capabilities => bs_caps, :http_client => client)
81
+ end
82
+
83
+ # Starts a headless display
84
+ def start_headless_display
85
+ require 'headless'
86
+ display_number = ENV['DISPLAY_PORT'].to_i || 99
87
+ headless = Headless.new(display: display_number)
88
+ headless.start
89
+ at_exit do
90
+ headless.destroy
91
+ end
92
+ end
93
+
94
+ # Sets Chromedriver path
95
+ def chrome_driver_path
96
+ case os
97
+ when :win32 then "#{Dir.pwd}/resources/drivers/chrome/#{os}/chromedriver.exe"
98
+ when :mac, :linux64 then "#{Dir.pwd}/resources/drivers/chrome/#{os}/chromedriver"
99
+ else fail 'Invalid OS'
100
+ end
101
+ end
102
+
103
+ def mobile?
104
+ bs_mobile?(ENV['BS']) || platform == :mobile
105
+ end
106
+
107
+ # Get the system OS
108
+ def os
109
+ @os ||= (
110
+ host_os = RbConfig::CONFIG['host_os']
111
+ case host_os
112
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ then :win32
113
+ when /darwin|mac os/ then :mac
114
+ when /linux/ then :linux64
115
+ when /solaris|bsd/ then :unix
116
+ else raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
117
+ end
118
+ )
119
+ end
120
+
121
+ # Closes the browser
122
+ # Takes screenshot and prints relevant information before closing
123
+ def close_browser(scenario = nil)
124
+ if !scenario.nil? && !@browser.nil?
125
+ if @current_page.nil?
126
+ file_name = "#{DateTime.now.strftime("%Y%m%d_%H%M%S")}.png"
127
+ @browser.screenshot.save file_name
128
+ embed(file_name, 'image/png')
129
+ else
130
+ file_name = "#{@current_page.class}-#{DateTime.now.strftime("%Y%m%d_%H%M%S")}.png"
131
+ @current_page.save_screenshot(file_name)
132
+ embed(file_name, 'image/png')
133
+ end
134
+ if scenario.failed?
135
+ print_session_storage
136
+ print_console_errors
137
+ end
138
+ end
139
+ @browser.close unless @browser.nil?
140
+ end
141
+
142
+ # Prints all sessionStorage data
143
+ def print_session_storage
144
+ storage = get_all_session_storage
145
+ if storage.nil? || storage.empty?
146
+ puts 'Session storage: Empty.'
147
+ else
148
+ puts "Session storage items (#{storage.length}):"
149
+ storage.each { |key, value| puts " - #{key} => #{value}" }
150
+ end
151
+ end
152
+
153
+ # Prints errors in the console
154
+ def print_console_errors
155
+ logs = @browser.driver.manage.logs.get(:browser)
156
+ if logs.length > 0
157
+ puts "\nConsole errors (#{logs.length}):"
158
+ logs.each do |error|
159
+ t = error.timestamp
160
+ time = Time.at(t.to_s[0..-4].to_i)
161
+ puts "- #{error.message} (#{error.level}) (#{time})"
162
+ end
163
+ else
164
+ puts 'No Console errors found.'
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,159 @@
1
+ include Selenium
2
+
3
+ module BrowserStackHelper
4
+ def run_test_in_browser_stack?
5
+ !ENV['BS_BROWSER'].nil? || (!ENV['BS'].nil? && !ENV['BS'].strip.empty?)
6
+ end
7
+
8
+ def bs_remote_url
9
+ "http://#{bs_account[:user_name]}:#{bs_account[:auth_key]}@hub.browserstack.com/wd/hub"
10
+ end
11
+
12
+ def bs_account
13
+ user_name = ENV['BS_USER_NAME']
14
+ auth_key = ENV['BS_AUTH_KEY']
15
+ if user_name.to_s.strip.empty? || auth_key.to_s.strip.empty?
16
+ fail "Browser Stack credentials not found in environment variables. \nBS_USER_NAME:#{user_name}\nBS_AUTH_KEY:#{auth_key}\n"
17
+ else
18
+ {:user_name => user_name, :auth_key => auth_key}
19
+ end
20
+ end
21
+
22
+ def bs_caps
23
+ if !ENV['BS'].nil? && !ENV['BS'].strip.empty?
24
+ if bs_mobile?(ENV['BS'])
25
+ mobile_caps
26
+ else
27
+ desktop_caps
28
+ end
29
+ else
30
+ if !ENV['BS_BROWSER'].nil?
31
+ generic_caps
32
+ end
33
+ end
34
+ end
35
+
36
+ def bs_mobile?(platform)
37
+ unless platform.nil?
38
+ true if (platform.downcase.include? 'android') || (platform.downcase.include? 'iphone')
39
+ end
40
+ end
41
+
42
+ def generic_caps
43
+ caps = Selenium::WebDriver::Remote::Capabilities.new
44
+ caps[:os] = ENV['BS_OS'].tr('_', ' ') unless ENV['BS_OS'].nil?
45
+ caps[:os_version] = ENV['BS_OS_VERSION'].tr('_', ' ') unless ENV['BS_OS_VERSION'].nil?
46
+ caps[:browser] = ENV['BS_BROWSER'].tr('_', ' ') unless ENV['BS_BROWSER'].nil?
47
+ caps[:browser_version] = ENV['BS_BROWSER_VERSION'].tr('_', ' ') unless ENV['BS_BROWSER_VERSION'].nil?
48
+ caps[:device] = ENV['BS_DEVICE'].tr('_', ' ') unless ENV['BS_DEVICE'].nil?
49
+ caps['browserstack.idleTimeout'] = 30
50
+ caps
51
+ end
52
+
53
+ def desktop_caps
54
+ bs_env = ENV['BS'].split('_') # Ex: win_7_ie_11
55
+ fail 'Invalid Platform' if bs_env.length < 3
56
+
57
+ caps = WebDriver::Remote::Capabilities.new
58
+ caps[:os] = bs_os(bs_env[0])
59
+ caps[:os_version] = bs_os_version(bs_env[1])
60
+ caps[:browser] = bs_browser(bs_env[2])
61
+ caps[:browser_version] = bs_browser_version(bs_env[3]) unless bs_env[3].nil?
62
+ caps[:javascriptEnabled] = true
63
+ caps['browserstack.idleTimeout'] = 30
64
+ caps
65
+ end
66
+
67
+ def mobile_caps
68
+ bs_env = ENV['BS'].split('_') # Ex: iphone_6s
69
+ fail 'Invalid Platform' if bs_env.length < 2
70
+
71
+ caps = WebDriver::Remote::Capabilities.new
72
+ caps[:browserName] = bs_mobile_browser(bs_env[0])
73
+ caps[:platform] = bs_mobile_platform(bs_env[0])
74
+ caps['device'] = bs_mobile_device(bs_env[1])
75
+ caps['browserstack.idleTimeout'] = 30
76
+ caps
77
+ end
78
+
79
+ def bs_mobile_browser(browser)
80
+ case browser.downcase
81
+ when 'iphone' then 'iPhone'
82
+ when 'android' then 'android'
83
+ else fail "Invalid Mobile Browser: #{browser}"
84
+ end
85
+ end
86
+
87
+ def bs_mobile_platform(platform)
88
+ case platform.downcase
89
+ when 'iphone' then 'MAC'
90
+ when 'android' then 'android'
91
+ else fail "Invalid Mobile Platform: #{platform}"
92
+ end
93
+ end
94
+
95
+ def bs_mobile_device(device)
96
+ case device.downcase
97
+ when '6splus' then 'iPhone 6S Plus'
98
+ when '6s' then 'iPhone 6S'
99
+ when '6plus' then 'iPhone 6 Plus'
100
+ when '6' then 'iPhone 6'
101
+ when 's5' then 'Samsung Galaxy S5'
102
+ when 'nexus5' then 'Google Nexus 5'
103
+ else fail "Invalid Mobile Device: #{device}"
104
+ end
105
+ end
106
+
107
+ def bs_os(os)
108
+ case os.downcase
109
+ when 'win', 'windows' then 'Windows'
110
+ when 'osx', 'mac' then 'OS X'
111
+ else fail "Invalid OS: #{os}"
112
+ end
113
+ end
114
+
115
+ def bs_os_version(os_version)
116
+ case os_version.downcase
117
+ when 'elcapitan', 'capitan' then 'El Capitan'
118
+ when 'yosemite' then 'Yosemite'
119
+ when 'mavericks' then 'Mavericks'
120
+ when 'mountainlion' then 'Mountain Lion'
121
+ when /\d/, /\d\.\d/ then os_version
122
+ else fail "Invalid OS version: #{os_version}"
123
+ end
124
+ end
125
+
126
+ def bs_browser(browser)
127
+ case browser.downcase
128
+ when 'ie' then 'IE'
129
+ when 'edge' then 'Edge'
130
+ when 'safari' then 'Safari'
131
+ when 'firefox' then 'Firefox'
132
+ when 'chrome' then 'Chrome'
133
+ else fail "Invalid Browser: #{browser}"
134
+ end
135
+ end
136
+
137
+ def bs_browser_version(browser_version)
138
+ case browser_version.downcase
139
+ when /\d/, /\d\.\d/ then browser_version
140
+ else fail "Invalid Browser version: #{browser_version}"
141
+ end
142
+ end
143
+
144
+ def bs_delete_env_bars
145
+ ENV['BS_BROWSER']=nil
146
+ ENV['BS_BROWSER_VERSION']=nil
147
+ ENV['BS_OS']=nil
148
+ ENV['BS_OS_VERSION']=nil
149
+ ENV['BS_DEVICE']=nil
150
+ end
151
+
152
+ def bs_set_env_vars_caps(browser)
153
+ ENV['BS_BROWSER'] = browser['browser'].tr(' ', '_') unless browser['browser'].nil?
154
+ ENV['BS_BROWSER_VERSION'] = browser['browser_version'].tr(' ', '_') unless browser['browser_version'].nil?
155
+ ENV['BS_OS'] = browser['os'].tr(' ', '_') unless browser['os'].nil?
156
+ ENV['BS_OS_VERSION'] = browser['os_version'].tr(' ', '_') unless browser['os_version'].nil?
157
+ ENV['BS_DEVICE'] = browser['device'].tr(' ', '_') unless browser['device'].nil?
158
+ end
159
+ end
@@ -0,0 +1,22 @@
1
+ require 'yaml'
2
+ include YAML
3
+
4
+ module RunParameters
5
+ def platform
6
+ p = (ENV['BROWSER'] ||= 'chrome').downcase.to_sym
7
+ raise ArgumentError, 'Set BROWSER to Chrome, Firefox or Mobile' unless [:chrome, :firefox, :mobile].include? p
8
+ p
9
+ end
10
+
11
+ # Browser Stack
12
+ def bs
13
+ ENV['BS']
14
+ end
15
+
16
+ # Run headless
17
+ def headless
18
+ h = (ENV['HEADLESS'] ||= 'false').downcase.to_sym
19
+ raise ArgumentError, 'Set HEADLESS to true or false' unless [:true, :false].include? h
20
+ h
21
+ end
22
+ end
@@ -0,0 +1,152 @@
1
+ module WebHelper
2
+ def open_url(url)
3
+ max_retries = 1
4
+ times_retried = 0
5
+ begin
6
+ @browser.goto url
7
+ rescue Net::ReadTimeout => error
8
+ if times_retried < max_retries
9
+ p "### ERROR: Net::ReadTimeout (@browser.goto url page timeout) (url: #{url}) ###"
10
+ p '### RETRYING ... ###'
11
+ times_retried += 1
12
+ retry
13
+ else
14
+ p "### ERROR: Net::ReadTimeout (@browser.goto url page timeout) (url: #{url}) ###"
15
+ p error
16
+ fail "Page failed to load (timeout) after #{(times_retried + 1)} attempts. ###"
17
+ end
18
+ end
19
+ end
20
+
21
+ # Switch to another browser window
22
+ def switch_browser_window(index)
23
+ sleep 3
24
+ @browser.window(:index => index).use if @browser.windows.length > 1
25
+ end
26
+
27
+ # Scrolls the page to focus on an element
28
+ def scroll_to_element(element)
29
+ @browser.execute_script('arguments[0].scrollIntoView();', element)
30
+ end
31
+
32
+ # Scrolls X and/or Y axis
33
+ def scroll_x_y(x, y)
34
+ @browser.execute_script("window.scrollBy(#{x},#{y})")
35
+ end
36
+
37
+ # Scroll on X axis
38
+ # Positive values scroll right. Negative values scroll left.
39
+ def scroll_horizontal(x)
40
+ @browser.execute_script("window.scrollBy(#{x},0)")
41
+ end
42
+
43
+ # Scroll on Y axis
44
+ # Positive values scroll down. Negative values scroll up.
45
+ def scroll_vertical(y)
46
+ @browser.execute_script("window.scrollBy(0,#{y})")
47
+ end
48
+
49
+ # Resize browser
50
+ def resize_browser(width, height)
51
+ @browser.window.resize_to(width, height)
52
+ sleep 2
53
+ end
54
+
55
+ # Confirms alert
56
+ def confirm_alert
57
+ @browser.alert.ok if @browser.alert.exists?
58
+ end
59
+
60
+ # Refresh browser
61
+ def browser_refresh
62
+ @browser.refresh
63
+ end
64
+
65
+ # Wait until an element is visible
66
+ # Waits for presence and then waits for visibility
67
+ # Note: Use on watir elements
68
+ def wait_until_visible(element, timeout = 15)
69
+ begin
70
+ element.wait_until_present(timeout)
71
+ rescue Watir::Wait::TimeoutError
72
+ fail "timeout on wait_until_present method for element '#{element.inspect}' after #{timeout} seconds."
73
+ end
74
+ begin
75
+ Watir::Wait.until(timeout) {element.visible?}
76
+ rescue Watir::Wait::TimeoutError
77
+ fail "timeout on Watir::Wait.until(t) {element.visible?} method for element '#{element.inspect}' after #{timeout} seconds."
78
+ end
79
+ end
80
+
81
+ # Clicks when an element is visible
82
+ # Waits for visibility (wait_until_visible) and then clicks on element
83
+ # Note: Use on watir elements
84
+ def click_when_visible(element, timeout = 15)
85
+ wait_until_visible(element, timeout)
86
+ element.click
87
+ end
88
+
89
+ # Wait until an element is visible
90
+ # Waits for visibility
91
+ # Note: Use on page object elements
92
+ def wait_until_visible_po(element, timeout = 15)
93
+ begin
94
+ Watir::Wait.until(timeout) {element.visible?}
95
+ rescue Watir::Wait::TimeoutError
96
+ fail "timeout on Watir::Wait.until(t) {element.visible?} method for element '#{element.inspect}' after #{timeout} seconds."
97
+ end
98
+ end
99
+
100
+ # Wait until an element is NOT visible
101
+ # Waits for !visibility
102
+ # Note: Use on page object elements
103
+ def wait_until_not_visible_po(element, timeout = 15)
104
+ begin
105
+ Watir::Wait.until(timeout) {!element.visible?}
106
+ rescue Watir::Wait::TimeoutError
107
+ fail "timeout on Watir::Wait.until(t) {!element.visible?} method for element '#{element.inspect}' after #{timeout} seconds."
108
+ end
109
+ end
110
+
111
+ # Clicks when an element is visible
112
+ # Waits for visibility (wait_until_visible_po) and then clicks on element
113
+ # Note: Use on page object elements
114
+ def click_when_visible_po(element, timeout = 15)
115
+ element.when_visible(timeout).click
116
+ end
117
+
118
+ # Get local storage item by key
119
+ def get_local_storage_item(key)
120
+ @browser.execute_script("return localStorage.getItem('#{key}')")
121
+ end
122
+
123
+ # Get session storage item by key
124
+ def get_session_storage_item(key)
125
+ @browser.execute_script("return sessionStorage.getItem('#{key}')")
126
+ end
127
+
128
+ # Get session storage key by index
129
+ def get_session_storage_key(index)
130
+ @browser.execute_script("return sessionStorage.key(#{index})")
131
+ end
132
+
133
+ # Returns an array with all the session storage items
134
+ def get_all_session_storage
135
+ begin
136
+ length = @browser.execute_script('return sessionStorage.length')
137
+ session_storage = Hash.new
138
+ length.times do |index|
139
+ key = get_session_storage_key(index)
140
+ session_storage[key] = get_session_storage_item(key)
141
+ end
142
+ session_storage
143
+ rescue Selenium::WebDriver::Error::NoScriptResultError
144
+ {}
145
+ end
146
+ end
147
+
148
+ # Delete session storage item by key
149
+ def delete_session_storage(key)
150
+ @browser.execute_script("return sessionStorage.removeItem('#{key}')")
151
+ end
152
+ end
@@ -0,0 +1,3 @@
1
+ module TestUtils
2
+ VERSION = '0.1.0'
3
+ end
data/lib/test_utils.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'test_utils/version'
2
+ require_relative '../lib/test_utils/browser_tests/browser_setup'
3
+
4
+ module TestUtils
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'test_utils/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "test_utils"
8
+ spec.version = TestUtils::VERSION
9
+ spec.authors = ["Cinthya Villalobos"]
10
+ spec.email = ["cinthya.villalobos@ef.com"]
11
+
12
+ spec.summary = 'Test automation utils'
13
+ spec.description = 'Test automation utils'
14
+ spec.homepage = 'https://github.com/ef-ice/test_utils'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'selenium-webdriver', '2.44.0'
22
+ spec.add_dependency 'watir-webdriver', '0.6.11'
23
+ spec.add_dependency 'webdriver-user-agent', '7.4'
24
+ spec.add_dependency 'headless', '2.2.2'
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.11"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "rubocop"
30
+ spec.add_development_dependency "guard"
31
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test_utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cinthya Villalobos
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: selenium-webdriver
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.44.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.44.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: watir-webdriver
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.11
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.11
41
+ - !ruby/object:Gem::Dependency
42
+ name: webdriver-user-agent
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: '7.4'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: '7.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: headless
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.2.2
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.2.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.11'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Test automation utils
140
+ email:
141
+ - cinthya.villalobos@ef.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - Gemfile
147
+ - README.md
148
+ - Rakefile
149
+ - bin/console
150
+ - bin/setup
151
+ - lib/test_utils.rb
152
+ - lib/test_utils/browser_tests/browser_setup.rb
153
+ - lib/test_utils/browser_tests/browser_stack_helper.rb
154
+ - lib/test_utils/browser_tests/run_parameters.rb
155
+ - lib/test_utils/browser_tests/web_helper.rb
156
+ - lib/test_utils/version.rb
157
+ - resources/drivers/chrome/linux64/chromedriver
158
+ - resources/drivers/chrome/mac/chromedriver
159
+ - resources/drivers/chrome/win32/chromedriver.exe
160
+ - resources/plugins/firefox/firebug@software.joehewitt.com.xpi
161
+ - resources/plugins/firefox/netExport-0.9b7.xpi
162
+ - test_utils.gemspec
163
+ homepage: https://github.com/ef-ice/test_utils
164
+ licenses: []
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.5.1
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Test automation utils
186
+ test_files: []