quke 0.6.0 → 0.7.0
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 +5 -5
- data/README.md +4 -4
- data/Rakefile +9 -7
- data/exe/quke +6 -2
- data/lib/features/support/after_hook.rb +11 -6
- data/lib/features/support/after_step_hook.rb +3 -1
- data/lib/features/support/before_hook.rb +6 -4
- data/lib/features/support/env.rb +17 -20
- data/lib/quke.rb +12 -7
- data/lib/quke/browserstack_configuration.rb +19 -18
- data/lib/quke/browserstack_status_reporter.rb +6 -4
- data/lib/quke/configuration.rb +30 -26
- data/lib/quke/cuke_runner.rb +6 -4
- data/lib/quke/driver_configuration.rb +12 -14
- data/lib/quke/driver_registration.rb +8 -6
- data/lib/quke/version.rb +3 -1
- data/spec/quke/browserstack_configuration_spec.rb +262 -0
- data/spec/quke/browserstack_status_reporter_spec.rb +129 -0
- data/spec/quke/configuration_spec.rb +270 -0
- data/spec/quke/cuke_runner_spec.rb +36 -0
- data/spec/quke/driver_configuration_spec.rb +279 -0
- data/spec/quke/driver_registration_spec.rb +33 -0
- data/spec/quke/quke_spec.rb +18 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/support/helpers.rb +48 -0
- data/spec/support/simplecov.rb +29 -0
- data/spec/support/webmock.rb +3 -0
- metadata +97 -58
- data/.browserstack.yml +0 -11
- data/.codeclimate.yml +0 -19
- data/.config.example.yml +0 -198
- data/.gitignore +0 -60
- data/.rspec +0 -2
- data/.rubocop.yml +0 -61
- data/.travis.yml +0 -55
- data/CHANGELOG.md +0 -170
- data/Gemfile +0 -4
- data/quke.gemspec +0 -105
- data/quke.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8861cc9092349b180b66c0cc650d29012a7eae69
|
4
|
+
data.tar.gz: 189b186c7b0606373a89b419c430933352b2799f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6990b5aebeb9c93a8623f6f97b0fe4f7d637c96bc76b9f887bdb950ecd2541242e69b9d012d8ad60b745bfc1e07054bbd7035752211d84c649cd51555226ea4d
|
7
|
+
data.tar.gz: 9d43a939c2c6d746c25077c68e955baf27f5e24902cb9c0ae5312763eb801e18f071315eb9311b46fb2e9270a0cfb6bbf9fe135ba072ec925818ed9f1271af31
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
<img src="/quke.png" alt="
|
1
|
+
<img src="/quke.png" alt="Quke logo" />
|
2
2
|
|
3
3
|
[](https://travis-ci.org/DEFRA/quke)
|
4
|
-
[](https://codeclimate.com/github/DEFRA/quke/maintainability)
|
5
|
+
[](https://codeclimate.com/github/DEFRA/quke/test_coverage)
|
6
6
|
[](https://hakiri.io/github/DEFRA/quke/master)
|
7
|
-
[](https://dependencyci.com/github/DEFRA/quke)
|
8
7
|
[](https://badge.fury.io/rb/quke)
|
8
|
+
[](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)
|
9
9
|
|
10
10
|
Quke is a gem that helps you to build a suite of [Cucumber](https://cucumber.io/) acceptance tests.
|
11
11
|
|
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'rdoc/task'
|
4
|
-
require 'github_changelog_generator/task'
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rdoc/task"
|
6
|
+
require "github_changelog_generator/task"
|
7
|
+
|
8
|
+
task default: :spec
|
7
9
|
|
8
10
|
RSpec::Core::RakeTask.new(:spec)
|
9
11
|
|
10
12
|
RDoc::Task.new do |doc|
|
11
|
-
doc.main =
|
12
|
-
doc.title =
|
13
|
+
doc.main = "README.md"
|
14
|
+
doc.title = "Quke"
|
13
15
|
doc.rdoc_files = FileList.new %w[README.md lib LICENSE]
|
14
16
|
end
|
15
17
|
|
data/exe/quke
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Layout/LeadingCommentSpace
|
1
4
|
#!/usr/bin/env ruby
|
5
|
+
# rubocop:enable Layout/LeadingCommentSpace
|
2
6
|
|
3
|
-
require
|
4
|
-
require
|
7
|
+
require "quke"
|
8
|
+
require "quke/configuration"
|
5
9
|
|
6
10
|
Quke::Quke.config = Quke::Configuration.new
|
7
11
|
Quke::Quke.execute(ARGV)
|
@@ -1,11 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "quke/configuration"
|
4
|
+
|
5
|
+
# Because of the way cucumber works everthing is made global. This also means
|
6
|
+
# any variables we set also need to be made global so they can be accessed
|
7
|
+
# across the scenarios.
|
8
|
+
# rubocop:disable Style/GlobalVars
|
9
|
+
After("not @nonweb") do |scenario|
|
4
10
|
$fail_count ||= 0
|
5
11
|
|
6
|
-
if Quke::Quke.config.browserstack.using_browserstack?
|
7
|
-
$session_id = page.driver.browser.session_id
|
8
|
-
end
|
12
|
+
$session_id = page.driver.browser.session_id if Quke::Quke.config.browserstack.using_browserstack?
|
9
13
|
|
10
14
|
if scenario.failed?
|
11
15
|
$fail_count = $fail_count + 1
|
@@ -31,9 +35,10 @@ After('~@nonweb') do |scenario|
|
|
31
35
|
# handle e
|
32
36
|
puts "FAILED: #{scenario.name}"
|
33
37
|
puts "FAILED: URL of the page with the failure #{page.current_path}"
|
34
|
-
puts
|
38
|
+
puts ""
|
35
39
|
puts page.html
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
44
|
+
# rubocop:enable Style/GlobalVars
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "quke/configuration"
|
4
|
+
|
5
|
+
Before("not @nonweb") do
|
4
6
|
# We have to make a special case for phantomjs when it comes to implementing
|
5
7
|
# the ability to override the user agent. Unlike the selinium backed drivers
|
6
8
|
# specifying the user agent is not part of the arguments we pass in when
|
@@ -12,10 +14,10 @@ Before('~@nonweb') do
|
|
12
14
|
# test is running. Once a test finishes, the changes are lost.
|
13
15
|
# Hence the only way we can ensure its set across all tests is by making use
|
14
16
|
# of the Before hook, and adding the User-Agent header each time.
|
15
|
-
if Quke::Quke.config.driver ==
|
17
|
+
if Quke::Quke.config.driver == "phantomjs"
|
16
18
|
unless Quke::Quke.config.user_agent.empty?
|
17
19
|
page.driver.add_header(
|
18
|
-
|
20
|
+
"User-Agent",
|
19
21
|
Quke::Quke.config.user_agent,
|
20
22
|
permanent: true
|
21
23
|
)
|
data/lib/features/support/env.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
|
2
|
-
require 'capybara/cucumber'
|
3
|
-
require 'site_prism'
|
4
|
-
require 'quke/configuration'
|
5
|
-
require 'quke/driver_configuration'
|
6
|
-
require 'quke/driver_registration'
|
7
|
-
require 'browserstack/local'
|
8
|
-
require 'quke/browserstack_status_reporter'
|
1
|
+
# frozen_string_literal: true
|
9
2
|
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
require "rspec/expectations"
|
4
|
+
require "capybara/cucumber"
|
5
|
+
require "site_prism"
|
6
|
+
require "quke/configuration"
|
7
|
+
require "quke/driver_configuration"
|
8
|
+
require "quke/driver_registration"
|
9
|
+
require "browserstack/local"
|
10
|
+
require "quke/browserstack_status_reporter"
|
11
|
+
|
12
|
+
Capybara.app_host = Quke::Quke.config.app_host unless Quke::Quke.config.app_host.empty?
|
13
13
|
|
14
14
|
driver_config = Quke::DriverConfiguration.new(Quke::Quke.config)
|
15
15
|
driver_reg = Quke::DriverRegistration.new(driver_config, Quke::Quke.config)
|
@@ -39,15 +39,7 @@ Capybara.run_server = false
|
|
39
39
|
# automatically in the event of an error when using the selenium driver.
|
40
40
|
# Not setting this leads to Capybara saving the file to the root of the project
|
41
41
|
# which can mess up your project structure.
|
42
|
-
Capybara.save_path =
|
43
|
-
|
44
|
-
# By default, SitePrism element and section methods do not utilize Capybara's
|
45
|
-
# implicit wait methodology and will return immediately if the element or
|
46
|
-
# section requested is not found on the page. Adding the following code
|
47
|
-
# enables Capybara's implicit wait methodology to pass through
|
48
|
-
SitePrism.configure do |config|
|
49
|
-
config.use_implicit_waits = true
|
50
|
-
end
|
42
|
+
Capybara.save_path = "tmp/"
|
51
43
|
|
52
44
|
# There aren't specific hooks we can attach to that only get called once before
|
53
45
|
# and after all tests have run in Cucumber. Therefore the next best thing is to
|
@@ -71,6 +63,10 @@ end
|
|
71
63
|
# used for final cleanup, we make use of it to kill our browserstack local
|
72
64
|
# testing binary, and update the status of the session in browserstack
|
73
65
|
at_exit do
|
66
|
+
# Because of the way cucumber works everthing is made global. This also means
|
67
|
+
# any variables we set also need to be made global so they can be accessed
|
68
|
+
# across the scenarios.
|
69
|
+
# rubocop:disable Style/GlobalVars
|
74
70
|
if $fail_count && Quke::Quke.config.browserstack.using_browserstack?
|
75
71
|
reporter = Quke::BrowserstackStatusReporter.new(Quke::Quke.config.browserstack)
|
76
72
|
begin
|
@@ -83,6 +79,7 @@ at_exit do
|
|
83
79
|
puts err
|
84
80
|
end
|
85
81
|
end
|
82
|
+
# rubocop:enable Style/GlobalVars
|
86
83
|
if bs_local && Quke::Quke.config.browserstack.test_locally?
|
87
84
|
# stop the local instance
|
88
85
|
bs_local.stop
|
data/lib/quke.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
|
6
|
-
require
|
7
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "selenium/webdriver"
|
4
|
+
require "chromedriver-helper"
|
5
|
+
|
6
|
+
require "quke/version"
|
7
|
+
require "quke/browserstack_configuration"
|
8
|
+
require "quke/browserstack_status_reporter"
|
9
|
+
require "quke/configuration"
|
10
|
+
require "quke/cuke_runner"
|
11
|
+
require "quke/driver_registration"
|
12
|
+
require "quke/driver_configuration"
|
8
13
|
|
9
14
|
module Quke #:nodoc:
|
10
15
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quke #:nodoc:
|
2
4
|
|
3
5
|
# Determines the configuration for browserstack, when selected as the driver
|
@@ -43,20 +45,18 @@ module Quke #:nodoc:
|
|
43
45
|
# Initialize's the instance based in the +Quke::Configuration+ instance
|
44
46
|
# passed in.
|
45
47
|
#--
|
46
|
-
# rubocop:disable Metrics/AbcSize
|
47
48
|
# rubocop:disable Metrics/CyclomaticComplexity
|
48
49
|
# rubocop:disable Metrics/PerceivedComplexity
|
49
50
|
#++
|
50
51
|
def initialize(configuration)
|
51
|
-
@using_browserstack = configuration.data[
|
52
|
+
@using_browserstack = configuration.data["driver"] == "browserstack"
|
52
53
|
data = validate_input_data(configuration.data)
|
53
|
-
@username = ENV[
|
54
|
-
@auth_key = ENV[
|
55
|
-
@local_key = ENV[
|
56
|
-
@capabilities = data[
|
54
|
+
@username = ENV["BROWSERSTACK_USERNAME"] || data["username"] || ""
|
55
|
+
@auth_key = ENV["BROWSERSTACK_AUTH_KEY"] || data["auth_key"] || ""
|
56
|
+
@local_key = ENV["BROWSERSTACK_LOCAL_KEY"] || data["local_key"] || ""
|
57
|
+
@capabilities = data["capabilities"] || {}
|
57
58
|
determine_local_testing_args(configuration)
|
58
59
|
end
|
59
|
-
# rubocop:enable Metrics/AbcSize
|
60
60
|
# rubocop:enable Metrics/CyclomaticComplexity
|
61
61
|
# rubocop:enable Metrics/PerceivedComplexity
|
62
62
|
|
@@ -66,7 +66,7 @@ module Quke #:nodoc:
|
|
66
66
|
# It is used when determing whether to start and stop the binary
|
67
67
|
# Browserstack provides to support local testing.
|
68
68
|
def test_locally?
|
69
|
-
@capabilities[
|
69
|
+
@capabilities["browserstack.local"] == true && using_browserstack?
|
70
70
|
end
|
71
71
|
|
72
72
|
# Returns true if the driver was set +browserstack+, else false.
|
@@ -110,35 +110,36 @@ module Quke #:nodoc:
|
|
110
110
|
# )
|
111
111
|
#
|
112
112
|
def url
|
113
|
-
return "http://#{@username}:#{@auth_key}@hub.browserstack.com/wd/hub" unless @username ==
|
113
|
+
return "http://#{@username}:#{@auth_key}@hub.browserstack.com/wd/hub" unless @username == ""
|
114
114
|
end
|
115
115
|
|
116
116
|
private
|
117
117
|
|
118
118
|
def validate_input_data(data)
|
119
119
|
return {} if data.nil?
|
120
|
-
return {} unless data[
|
121
|
-
|
120
|
+
return {} unless data["browserstack"]
|
121
|
+
|
122
|
+
data["browserstack"]
|
122
123
|
end
|
123
124
|
|
124
125
|
def determine_local_testing_args(configuration)
|
125
126
|
@local_testing_args = {
|
126
127
|
# Key is the only required arg. Everything else is optional
|
127
|
-
|
128
|
+
"key" => @local_key,
|
128
129
|
# Always kill other running Browserstack Local instances
|
129
|
-
|
130
|
+
"force" => "true",
|
130
131
|
# We only want to enable local testing for automate
|
131
|
-
|
132
|
+
"onlyAutomate" => "true",
|
132
133
|
# Enable verbose logging. It's of no consequence to the tests, but it
|
133
134
|
# could help in the event of errors
|
134
|
-
|
135
|
+
"v" => "true",
|
135
136
|
# Rather than
|
136
|
-
|
137
|
+
"logfile" => File.join(Dir.pwd, "/tmp/bowerstack_local_log.txt")
|
137
138
|
}
|
138
139
|
return unless configuration.use_proxy?
|
139
140
|
|
140
|
-
@local_testing_args[
|
141
|
-
@local_testing_args[
|
141
|
+
@local_testing_args["proxyHost"] = configuration.proxy["host"]
|
142
|
+
@local_testing_args["proxyPort"] = configuration.proxy["port"].to_s
|
142
143
|
end
|
143
144
|
|
144
145
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quke #:nodoc:
|
2
4
|
|
3
5
|
# Used to update the status of a session in Browserstack to mark it as passed
|
@@ -30,7 +32,7 @@ module Quke #:nodoc:
|
|
30
32
|
# It returns a string which can be used as a message for output confirming
|
31
33
|
# the action.
|
32
34
|
def passed(session_id)
|
33
|
-
check_before_update(session_id, status:
|
35
|
+
check_before_update(session_id, status: "passed")
|
34
36
|
"Browserstack session #{session_id} status set to \e[32mpassed\e[0m 😀"
|
35
37
|
end
|
36
38
|
|
@@ -40,14 +42,14 @@ module Quke #:nodoc:
|
|
40
42
|
# It returns a string which can be used as a message for output confirming
|
41
43
|
# the action.
|
42
44
|
def failed(session_id)
|
43
|
-
check_before_update(session_id, status:
|
45
|
+
check_before_update(session_id, status: "failed")
|
44
46
|
"Browserstack session #{session_id} status set to \e[31mfailed\e[0m 😢"
|
45
47
|
end
|
46
48
|
|
47
49
|
private
|
48
50
|
|
49
51
|
def check_before_update(session_id, body)
|
50
|
-
raise(ArgumentError,
|
52
|
+
raise(ArgumentError, "Need a session ID to update browserstack status") if session_id.nil?
|
51
53
|
|
52
54
|
uri = URI("https://www.browserstack.com/automate/sessions/#{session_id}.json")
|
53
55
|
set_status(uri, body)
|
@@ -56,7 +58,7 @@ module Quke #:nodoc:
|
|
56
58
|
def set_status(uri, body)
|
57
59
|
request = Net::HTTP::Put.new(uri)
|
58
60
|
request.basic_auth @username, @auth_key
|
59
|
-
request.content_type =
|
61
|
+
request.content_type = "application/json"
|
60
62
|
request.body = body.to_json
|
61
63
|
|
62
64
|
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
data/lib/quke/configuration.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
2
4
|
|
3
5
|
module Quke #:nodoc:
|
4
6
|
|
@@ -35,7 +37,7 @@ module Quke #:nodoc:
|
|
35
37
|
# Return the file name for the config file, either as set by the user in
|
36
38
|
# an environment variable called `QCONFIG` or the default of +.config.yml+.
|
37
39
|
def self.file_name
|
38
|
-
ENV[
|
40
|
+
ENV["QUKE_CONFIG"] || ".config.yml"
|
39
41
|
end
|
40
42
|
|
41
43
|
# When an instance is initialized it will automatically populate itself by
|
@@ -51,7 +53,7 @@ module Quke #:nodoc:
|
|
51
53
|
# tells Cucumber where the main features folder which contains the tests is
|
52
54
|
# located. If not set in the +.config.yml+ file it defaults to 'features'.
|
53
55
|
def features_folder
|
54
|
-
@data[
|
56
|
+
@data["features_folder"]
|
55
57
|
end
|
56
58
|
|
57
59
|
# Returns the value set for +app_host+.
|
@@ -66,7 +68,7 @@ module Quke #:nodoc:
|
|
66
68
|
#
|
67
69
|
# This saves you from having to repeat the full url each time.
|
68
70
|
def app_host
|
69
|
-
@data[
|
71
|
+
@data["app_host"]
|
70
72
|
end
|
71
73
|
|
72
74
|
# Returns the value set for +driver+.
|
@@ -74,7 +76,7 @@ module Quke #:nodoc:
|
|
74
76
|
# Tells Quke which browser to use for testing. Choices are firefox,
|
75
77
|
# chrome browserstack and phantomjs, with the default being phantomjs.
|
76
78
|
def driver
|
77
|
-
@data[
|
79
|
+
@data["driver"]
|
78
80
|
end
|
79
81
|
|
80
82
|
# Return the value set for +pause+.
|
@@ -83,7 +85,7 @@ module Quke #:nodoc:
|
|
83
85
|
# browser is responding. Only useful if using a non-headless browser. The
|
84
86
|
# default is 0.
|
85
87
|
def pause
|
86
|
-
@data[
|
88
|
+
@data["pause"]
|
87
89
|
end
|
88
90
|
|
89
91
|
# Return the value set for +stop_on_error+.
|
@@ -94,7 +96,9 @@ module Quke #:nodoc:
|
|
94
96
|
def stop_on_error
|
95
97
|
# This use of Yaml.load to convert a string to a boolean comes from
|
96
98
|
# http://stackoverflow.com/a/21804027/6117745
|
97
|
-
|
99
|
+
# rubocop:disable Security/YAMLLoad
|
100
|
+
YAML.load(@data["stop_on_error"])
|
101
|
+
# rubocop:enable Security/YAMLLoad
|
98
102
|
end
|
99
103
|
|
100
104
|
# Return the value for +max_wait_time+
|
@@ -107,7 +111,7 @@ module Quke #:nodoc:
|
|
107
111
|
# If the value is not set in config file, it will default to whatever is the
|
108
112
|
# current Capybara value for default_max_wait_time.
|
109
113
|
def max_wait_time
|
110
|
-
@data[
|
114
|
+
@data["max_wait_time"]
|
111
115
|
end
|
112
116
|
|
113
117
|
# Return the value set for +user_agent+.
|
@@ -118,7 +122,7 @@ module Quke #:nodoc:
|
|
118
122
|
# you want to pretend to be another kind of browser, because the one you
|
119
123
|
# have is not supported by the site.
|
120
124
|
def user_agent
|
121
|
-
@data[
|
125
|
+
@data["user_agent"]
|
122
126
|
end
|
123
127
|
|
124
128
|
# Return the value set for +javascript_errors+.
|
@@ -131,7 +135,7 @@ module Quke #:nodoc:
|
|
131
135
|
# are out of your scope. You still want to test other aspects of the site
|
132
136
|
# but not let these errors prevent you from using phantomjs.
|
133
137
|
def javascript_errors
|
134
|
-
@data[
|
138
|
+
@data["javascript_errors"]
|
135
139
|
end
|
136
140
|
|
137
141
|
# Return the hash of +proxy+ server settings
|
@@ -140,7 +144,7 @@ module Quke #:nodoc:
|
|
140
144
|
# configure Quke to use it by setting the +host+ and +port+ in your config
|
141
145
|
# file.
|
142
146
|
def proxy
|
143
|
-
@data[
|
147
|
+
@data["proxy"]
|
144
148
|
end
|
145
149
|
|
146
150
|
# Return true if the +proxy: host+ value has been set in the +.config.yml+
|
@@ -149,7 +153,7 @@ module Quke #:nodoc:
|
|
149
153
|
# It is mainly used when determining whether to apply proxy server settings
|
150
154
|
# to the different drivers when registering them with Capybara.
|
151
155
|
def use_proxy?
|
152
|
-
proxy[
|
156
|
+
proxy["host"] != ""
|
153
157
|
end
|
154
158
|
|
155
159
|
# Return the hash of +custom+ server settings
|
@@ -165,14 +169,14 @@ module Quke #:nodoc:
|
|
165
169
|
# http://www.yamllint.com/) Quke will be able to pick it up and make it
|
166
170
|
# available in your tests.
|
167
171
|
def custom
|
168
|
-
@data[
|
172
|
+
@data["custom"]
|
169
173
|
end
|
170
174
|
|
171
175
|
private
|
172
176
|
|
173
177
|
def load_data
|
174
178
|
data = default_data!(load_yml_data)
|
175
|
-
data[
|
179
|
+
data["proxy"] = proxy_data(data["proxy"])
|
176
180
|
data
|
177
181
|
end
|
178
182
|
|
@@ -181,13 +185,13 @@ module Quke #:nodoc:
|
|
181
185
|
# rubocop:disable Metrics/PerceivedComplexity
|
182
186
|
def default_data!(data)
|
183
187
|
data.merge(
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
"features_folder" => (data["features"] || "features").downcase.strip,
|
189
|
+
"app_host" => (data["app_host"] || "").downcase.strip,
|
190
|
+
"driver" => (data["driver"] || "phantomjs").downcase.strip,
|
191
|
+
"pause" => (data["pause"] || "0").to_s.downcase.strip.to_i,
|
192
|
+
"stop_on_error" => (data["stop_on_error"] || "false").to_s.downcase.strip,
|
193
|
+
"max_wait_time" => (data["max_wait_time"] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i,
|
194
|
+
"user_agent" => (data["user_agent"] || "").strip,
|
191
195
|
# Because we want to default to 'true', but allow users to override it
|
192
196
|
# with 'false' it causes us to mess with the logic. Essentially if the
|
193
197
|
# user does enter false (either as a string or as a boolean) the result
|
@@ -195,9 +199,9 @@ module Quke #:nodoc:
|
|
195
199
|
# Else the condition fails and we get 'false', which when flipped gives
|
196
200
|
# us 'true', which is what we want the default value to be
|
197
201
|
# rubocop:disable Style/InverseMethods
|
198
|
-
|
202
|
+
"javascript_errors" => !(data["javascript_errors"].to_s.downcase.strip == "false"),
|
199
203
|
# rubocop:enable Style/InverseMethods
|
200
|
-
|
204
|
+
"custom" => (data["custom"] || nil)
|
201
205
|
)
|
202
206
|
end
|
203
207
|
# rubocop:enable Metrics/AbcSize
|
@@ -207,9 +211,9 @@ module Quke #:nodoc:
|
|
207
211
|
def proxy_data(data)
|
208
212
|
data = {} if data.nil?
|
209
213
|
data.merge(
|
210
|
-
|
211
|
-
|
212
|
-
|
214
|
+
"host" => (data["host"] || "").downcase.strip,
|
215
|
+
"port" => (data["port"] || "0").to_s.downcase.strip.to_i,
|
216
|
+
"no_proxy" => (data["no_proxy"] || "").downcase.strip
|
213
217
|
)
|
214
218
|
end
|
215
219
|
|