quke 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.config.example.yml +8 -0
- data/README.md +0 -4
- data/lib/quke/configuration.rb +2 -1
- data/lib/quke/driver_configuration.rb +26 -12
- data/lib/quke/driver_registration.rb +6 -0
- data/lib/quke/version.rb +1 -1
- data/quke.gemspec +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf47841852a9adeb51e32e6cd9b1a072eb41ba51
|
4
|
+
data.tar.gz: 96a014d8e1637dada1a2502dee5e989a35df19b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbaa3c15400503eb11144537df0b5e42bce9d832590f96221e3f60fa2f232e27a633aa2ba571ed827a41c59d21a8a1ee373574d2e8139086274687e9d8e792b2
|
7
|
+
data.tar.gz: f54b7569ef1cc12c187798fcf2dd7af25e53833eb5bd7e606e22cc777fbaf37507f8bbb30236d2dcfd544d76981ad8f8ff9dec7b38e5d9c0b7e5b6a47b6655f8
|
data/.config.example.yml
CHANGED
@@ -33,6 +33,14 @@ stop_on_error: 1
|
|
33
33
|
proxy:
|
34
34
|
host: '10.10.2.70'
|
35
35
|
port: 8080
|
36
|
+
# In some cases you may also need to tell the browser (driver) not to use the
|
37
|
+
# proxy for local or specific connections. For this simply provide a comma
|
38
|
+
# separated list of addresses.
|
39
|
+
#
|
40
|
+
# IMPORTANT NOTE! phantomjs does not currently support this option. If you
|
41
|
+
# have to go via a proxy server for external connections, but not local ones
|
42
|
+
# you will be limited to using either the Chrome or Firefox drivers.
|
43
|
+
no_proxy: '127.0.0.1,192.168.0.1'
|
36
44
|
|
37
45
|
# If you select the browserstack driver, there are a number of options you
|
38
46
|
# can pass through to setup your browserstack tests, username and auth_key
|
data/README.md
CHANGED
@@ -92,10 +92,6 @@ You should be aware of some default behaviours included in Quke.
|
|
92
92
|
|
93
93
|
Capybara includes the ability to save the source of the current page at any point. Quke has been configured so that if you are not using the headless browser and a step should fail it will save the source to file and then use a tool called [Launchy](https://github.com/copiousfreetime/launchy) to open it in your default browser.
|
94
94
|
|
95
|
-
### Early fail for CI
|
96
|
-
|
97
|
-
When running using the default PhantomJS headless browser, as soon as there is a failure Quke will exit. This is because it is assumed when used in headless mode the key thing to know is *are there any failures*, to ensure fast feedback from your CI build server.
|
98
|
-
|
99
95
|
### Quit on 5 failures
|
100
96
|
|
101
97
|
If you are running using Chrome or Firefox after the 5th failure Quke will automatically stop. This is to prevent scores of tabs being opened in the browser when an error is found, which may just be the result of an error in the test code.
|
data/lib/quke/configuration.rb
CHANGED
@@ -169,7 +169,8 @@ module Quke #:nodoc:
|
|
169
169
|
data = {} if data.nil?
|
170
170
|
data.merge(
|
171
171
|
'host' => (data['host'] || '').downcase.strip,
|
172
|
-
'port' => (data['port'] || '0').to_s.downcase.strip.to_i
|
172
|
+
'port' => (data['port'] || '0').to_s.downcase.strip.to_i,
|
173
|
+
'no_proxy' => (data['no_proxy'] || '').downcase.strip
|
173
174
|
)
|
174
175
|
end
|
175
176
|
|
@@ -118,7 +118,10 @@ module Quke #:nodoc:
|
|
118
118
|
# Capybara::Selenium::Driver.new(
|
119
119
|
# app,
|
120
120
|
# browser: :chrome,
|
121
|
-
# switches: [
|
121
|
+
# switches: [
|
122
|
+
# "--proxy-server=localhost:8080",
|
123
|
+
# "--proxy-bypass-list=127.0.0.1,192.168.0.1"
|
124
|
+
# ]
|
122
125
|
# )
|
123
126
|
#
|
124
127
|
# Rather than setting the switches manually Quke::DriverConfiguration.chrome
|
@@ -131,13 +134,20 @@ module Quke #:nodoc:
|
|
131
134
|
# switches: my_driver_config.chrome
|
132
135
|
# )
|
133
136
|
#
|
137
|
+
# rubocop:disable Metrics/AbcSize
|
134
138
|
def chrome
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
139
|
+
result = []
|
140
|
+
|
141
|
+
host = config.proxy['host']
|
142
|
+
port = config.proxy['port']
|
143
|
+
no_proxy = config.proxy['no_proxy'].tr(',', ';')
|
144
|
+
|
145
|
+
result.push("--proxy-server=#{host}:#{port}") if config.use_proxy?
|
146
|
+
result.push("--proxy-bypass-list=#{no_proxy}") unless config.proxy['no_proxy'].empty?
|
147
|
+
|
148
|
+
result
|
140
149
|
end
|
150
|
+
# rubocop:enable Metrics/AbcSize
|
141
151
|
|
142
152
|
# Returns an instance of Selenium::WebDriver::Remote::Capabilities to be
|
143
153
|
# used when registering an instance of Capybara::Selenium::Driver,
|
@@ -169,12 +179,16 @@ module Quke #:nodoc:
|
|
169
179
|
def firefox
|
170
180
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
171
181
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
182
|
+
settings = {}
|
183
|
+
host = config.proxy['host']
|
184
|
+
port = config.proxy['port']
|
185
|
+
no_proxy = config.proxy['no_proxy']
|
186
|
+
|
187
|
+
settings[:http] = "#{host}:#{port}" if config.use_proxy?
|
188
|
+
settings[:ssl] = settings[:http] if config.use_proxy?
|
189
|
+
settings[:no_proxy] = no_proxy unless config.proxy['no_proxy'].empty?
|
190
|
+
|
191
|
+
profile.proxy = Selenium::WebDriver::Proxy.new(settings) if config.use_proxy?
|
178
192
|
|
179
193
|
profile
|
180
194
|
end
|
@@ -43,6 +43,9 @@ module Quke #:nodoc:
|
|
43
43
|
# poltergeist, and we can even pass on options to phantomjs to configure how
|
44
44
|
# it runs.
|
45
45
|
def phantomjs
|
46
|
+
# For future reference the options we pass through to phantomjs appear to
|
47
|
+
# mirror those you can actually supply on the command line.
|
48
|
+
# http://phantomjs.org/api/command-line.html
|
46
49
|
Capybara.register_driver :phantomjs do |app|
|
47
50
|
# We ignore the next line (and those like it in the subsequent methods)
|
48
51
|
# from code coverage because we never actually execute them from Quke.
|
@@ -65,6 +68,8 @@ module Quke #:nodoc:
|
|
65
68
|
# object.
|
66
69
|
# https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings#firefox
|
67
70
|
# http://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/Firefox/Profile
|
71
|
+
# http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp
|
72
|
+
# http://preferential.mozdev.org/preferences.html
|
68
73
|
Capybara.register_driver :firefox do |app|
|
69
74
|
# :simplecov_ignore:
|
70
75
|
Capybara::Selenium::Driver.new(app, profile: config.firefox)
|
@@ -81,6 +86,7 @@ module Quke #:nodoc:
|
|
81
86
|
# Capybara to Selenium-webdriver, which in turn passes it to chromium
|
82
87
|
# https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings#chrome
|
83
88
|
# http://peter.sh/experiments/chromium-command-line-switches/
|
89
|
+
# https://www.chromium.org/developers/design-documents/network-settings
|
84
90
|
Capybara.register_driver :chrome do |app|
|
85
91
|
# :simplecov_ignore:
|
86
92
|
Capybara::Selenium::Driver.new(
|
data/lib/quke/version.rb
CHANGED
data/quke.gemspec
CHANGED
@@ -3,6 +3,9 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'quke/version'
|
5
5
|
|
6
|
+
# Don't believe you would want to break this particular block up hence adding
|
7
|
+
# the exception for rubocop.
|
8
|
+
# rubocop:disable Metrics/BlockLength
|
6
9
|
Gem::Specification.new do |spec|
|
7
10
|
spec.name = 'quke'
|
8
11
|
spec.version = Quke::VERSION
|
@@ -10,7 +13,11 @@ Gem::Specification.new do |spec|
|
|
10
13
|
spec.email = ['alan.cruikshanks@environment-agency.gov.uk']
|
11
14
|
|
12
15
|
spec.summary = 'A gem to simplify creating acceptance tests using Cucumber'
|
16
|
+
# My attempts to break this line up to meet the 120 char limit we have set
|
17
|
+
# have proved fruitles so far!
|
18
|
+
# rubocop:disable Metrics/LineLength
|
13
19
|
spec.description = 'Quke tries to simplify the process of writing and running acceptance tests by setting up Cucumber for you. It handles the config to allow you to run your tests in Firefox and Chrome, or the headless browser PhantomJS. It also has out of the box setup for using Browserstack automate. This leaves you to focus on just your features and steps.'
|
20
|
+
# rubocop:enable Metrics/LineLength
|
14
21
|
spec.homepage = 'https://github.com/environmentagency/quke'
|
15
22
|
spec.license = 'Nonstandard'
|
16
23
|
|
@@ -91,3 +98,4 @@ Gem::Specification.new do |spec|
|
|
91
98
|
spec.add_development_dependency 'simplecov', '~> 0.12'
|
92
99
|
spec.add_development_dependency 'github_changelog_generator', '~> 1.13'
|
93
100
|
end
|
101
|
+
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Cruikshanks
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|