howitzer 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +3 -1
- data/.ruby-gemset +1 -0
- data/.travis.yml +4 -1
- data/.yardopts +5 -0
- data/CHANGELOG.md +23 -1
- data/CONTRIBUTING.md +14 -0
- data/GETTING_STARTED.md +283 -183
- data/Gemfile +3 -2
- data/LICENSE +1 -1
- data/README.md +93 -39
- data/Rakefile +4 -0
- data/bin/howitzer +34 -5
- data/features/cli_help.feature +3 -2
- data/features/cli_new.feature +1 -1
- data/features/cli_unknown.feature +1 -1
- data/features/cli_update.feature +84 -0
- data/features/step_definitions/common_steps.rb +9 -1
- data/generators/base_generator.rb +30 -15
- data/generators/config/config_generator.rb +7 -7
- data/generators/config/templates/custom.yml +1 -0
- data/generators/config/templates/default.yml +35 -5
- data/generators/cucumber/templates/env.rb +2 -2
- data/generators/cucumber/templates/transformers.rb +3 -1
- data/generators/root/templates/Gemfile +5 -3
- data/generators/root/templates/Rakefile +2 -0
- data/generators/rspec/templates/example_spec.rb +3 -3
- data/generators/rspec/templates/spec_helper.rb +6 -7
- data/howitzer.gemspec +15 -15
- data/lib/howitzer/capybara/settings.rb +125 -49
- data/lib/howitzer/helpers.rb +161 -94
- data/lib/howitzer/mailgun/client.rb +1 -1
- data/lib/howitzer/tasks/framework.rake +3 -0
- data/lib/howitzer/utils.rb +1 -1
- data/lib/howitzer/utils/locator_store.rb +1 -1
- data/lib/howitzer/utils/log.rb +1 -1
- data/lib/howitzer/utils/page_validator.rb +1 -1
- data/lib/howitzer/version.rb +1 -1
- data/lib/howitzer/web_page.rb +11 -11
- data/spec/spec_helper.rb +25 -22
- data/spec/support/generator_helper.rb +8 -1
- data/spec/unit/generators/base_generator_spec.rb +242 -0
- data/spec/unit/generators/config_generator_spec.rb +34 -0
- data/spec/unit/generators/cucumber_generator_spec.rb +45 -0
- data/spec/unit/generators/emails_generator_spec.rb +31 -0
- data/spec/unit/generators/pages_generator_spec.rb +33 -0
- data/spec/unit/generators/root_generator_spec.rb +35 -0
- data/spec/unit/generators/rspec_generator_spec.rb +36 -0
- data/spec/unit/generators/tasks_generator_spec.rb +31 -0
- data/spec/unit/lib/capybara/dsl_ex_spec.rb +11 -11
- data/spec/unit/lib/capybara/settings_spec.rb +336 -58
- data/spec/unit/lib/email_spec.rb +17 -17
- data/spec/unit/lib/helpers_spec.rb +699 -315
- data/spec/unit/lib/mailgun/client_spec.rb +9 -9
- data/spec/unit/lib/mailgun/connector_spec.rb +20 -20
- data/spec/unit/lib/mailgun/response_spec.rb +9 -9
- data/spec/unit/lib/settings_spec.rb +6 -6
- data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +31 -31
- data/spec/unit/lib/utils/data_generator/gen_spec.rb +20 -20
- data/spec/unit/lib/utils/locator_store_spec.rb +39 -39
- data/spec/unit/lib/utils/log_spec.rb +42 -42
- data/spec/unit/lib/utils/page_validator_spec.rb +69 -70
- data/spec/unit/lib/web_page_spec.rb +91 -69
- data/spec/unit/version_spec.rb +3 -3
- metadata +100 -78
- data/spec/unit/generators/generators_spec.rb +0 -175
@@ -1,13 +1,13 @@
|
|
1
1
|
require_relative '../base_generator'
|
2
2
|
module Howitzer
|
3
3
|
class ConfigGenerator < BaseGenerator
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
def manifest
|
5
|
+
{ files:
|
6
|
+
[
|
7
|
+
{ source: 'custom.yml', destination: 'config/custom.yml'},
|
8
|
+
{ source: 'default.yml', destination: 'config/default.yml'}
|
9
|
+
]
|
10
|
+
}
|
11
11
|
end
|
12
12
|
|
13
13
|
protected
|
@@ -19,13 +19,19 @@
|
|
19
19
|
# TEST ENVIRONMENTS SETTINGS #
|
20
20
|
###########################################################
|
21
21
|
|
22
|
-
# Specify
|
23
|
-
|
22
|
+
# Specify maximized browser window size
|
23
|
+
maximized_window: false
|
24
|
+
|
25
|
+
# Specify one of the following drivers: selenium, selenium_dev, selenium_grid, webkit, poltergeist, phantomjs, sauce, testingbot, browserstack
|
26
|
+
driver: phantomjs
|
24
27
|
|
25
28
|
# -Selenium-
|
26
|
-
# specify one of next browsers: iexplore (ie), firefox (ff), chrome, opera
|
29
|
+
# specify one of next browsers: iexplore (ie), firefox (ff), chrome, opera, safari
|
27
30
|
sel_browser: ff
|
28
31
|
|
32
|
+
# -Selenium Grid-
|
33
|
+
sel_hub_url: "http://example.com:4444/wd/hub"
|
34
|
+
|
29
35
|
# -PhantomJS-
|
30
36
|
# specify settings for poltergeist
|
31
37
|
pjs_ignore_js_errors: false
|
@@ -53,6 +59,31 @@
|
|
53
59
|
tb_idle_timeout: '180'
|
54
60
|
tb_record_screenshot: false
|
55
61
|
|
62
|
+
# -BrowserStack
|
63
|
+
bs_user_name: bs_user
|
64
|
+
bs_password: bs_password
|
65
|
+
bs_url: "http://${bs_user_name}:${bs_password}@hub.browserstack.com/wd/hub"
|
66
|
+
bs_os_name: 'Windows'
|
67
|
+
bs_os_version: '8'
|
68
|
+
bs_browser_name: 'Firefox'
|
69
|
+
bs_browser_version: '16.0'
|
70
|
+
bs_resolution: '1024x768'
|
71
|
+
bs_max_duration: '1800'
|
72
|
+
bs_idle_timeout: '180'
|
73
|
+
|
74
|
+
# Run tests on mobile browsers
|
75
|
+
bs_mobile: false
|
76
|
+
bs_m_browser: 'iPhone'
|
77
|
+
bs_m_platform: 'MAC'
|
78
|
+
bs_m_device: 'iPhone 5'
|
79
|
+
|
80
|
+
bs_local: 'false'
|
81
|
+
bs_local_ID: 'Testing123'
|
82
|
+
bs_build: 'v1'
|
83
|
+
bs_project: 'Test Project'
|
84
|
+
bs_ssl: 'true'
|
85
|
+
bs_debug: 'false'
|
86
|
+
|
56
87
|
###########################################################
|
57
88
|
# DATABASE SETTINGS #
|
58
89
|
###########################################################
|
@@ -85,5 +116,4 @@
|
|
85
116
|
timeout_tiny: 1
|
86
117
|
timeout_short: 3
|
87
118
|
timeout_small: 20
|
88
|
-
timeout_medium: 60
|
89
|
-
|
119
|
+
timeout_medium: 60
|
@@ -14,7 +14,7 @@ if sauce_driver?
|
|
14
14
|
end
|
15
15
|
|
16
16
|
Before do |scenario|
|
17
|
-
log.print_feature_name(scenario.feature.
|
17
|
+
log.print_feature_name(scenario.feature.name)
|
18
18
|
log.print_scenario_name(scenario.name)
|
19
19
|
@session_start = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
|
20
20
|
end
|
@@ -36,4 +36,4 @@ at_exit do
|
|
36
36
|
log.info "SAUCE SERVER LOG URL: #{Capybara::Settings.sauce_resource_path('selenium-server.log')}"
|
37
37
|
Capybara::Settings.update_sauce_job_status(passed: DataStorage.extract('sauce', :status))
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
@@ -24,5 +24,7 @@ Transform /^table:.*$/ do |table|
|
|
24
24
|
res
|
25
25
|
end
|
26
26
|
end
|
27
|
-
Cucumber::Ast::
|
27
|
+
location = Cucumber::Core::Ast::Location.of_caller
|
28
|
+
ast_table = Cucumber::Core::Ast::DataTable.new(raw, location)
|
29
|
+
Cucumber::MultilineArgument::DataTable.new(ast_table)
|
28
30
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Uncomment it if you are going to use 'webkit' driver. QT library should be installed. See https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
|
4
|
+
#
|
5
|
+
# gem 'capybara-webkit'
|
5
6
|
|
7
|
+
gem 'howitzer'
|
@@ -2,6 +2,8 @@ require 'rspec'
|
|
2
2
|
require 'capybara/rspec'
|
3
3
|
require_relative '../boot'
|
4
4
|
|
5
|
+
Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each{ |f| require f }
|
6
|
+
|
5
7
|
RSpec.configure do |config|
|
6
8
|
log.settings_as_formatted_text
|
7
9
|
|
@@ -12,21 +14,18 @@ RSpec.configure do |config|
|
|
12
14
|
config.include Capybara::RSpecMatchers
|
13
15
|
config.include DataGenerator
|
14
16
|
|
15
|
-
config.
|
16
|
-
config.
|
17
|
-
|
18
|
-
config.color_enabled = true
|
19
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
17
|
+
config.disable_monkey_patching = true
|
18
|
+
config.color = true
|
20
19
|
|
21
20
|
config.before(:all) do
|
22
21
|
if sauce_driver?
|
23
|
-
suite_name = "#{(ENV['RAKE_TASK'] || 'CUSTOM').sub(
|
22
|
+
suite_name = "#{(ENV['RAKE_TASK'] || 'CUSTOM').sub('rspec:', '').upcase} #{settings.sl_browser_name.upcase}"
|
24
23
|
Capybara.drivers[:sauce][].options[:desired_capabilities][:name] = suite_name
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
config.before(:each) do
|
29
|
-
log.print_scenario_name(
|
28
|
+
log.print_scenario_name(RSpec.current_example.description.empty? ? RSpec.current_example.metadata[:full_description] : RSpec.current_example.description)
|
30
29
|
@session_start = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
|
31
30
|
end
|
32
31
|
|
data/howitzer.gemspec
CHANGED
@@ -2,42 +2,42 @@
|
|
2
2
|
require File.expand_path('../lib/howitzer/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.
|
6
|
-
gem.email =
|
7
|
-
gem.description = %q{Howitzer
|
5
|
+
gem.author = 'Roman Parashchenko'
|
6
|
+
gem.email = 'howitzer@strongqa.com'
|
7
|
+
gem.description = %q{Howitzer uses the best practices and design patterns allowing to generate a test project in less than 5 minutes. It has out-of-the-box configurations for parallel cross-browser testing in the Cloud.}
|
8
8
|
gem.summary = %q{Ruby based framework for acceptance testing}
|
9
|
-
gem.homepage =
|
9
|
+
gem.homepage = 'http://strongqa.github.io/howitzer/'
|
10
|
+
gem.license = 'MIT'
|
10
11
|
|
11
12
|
gem.bindir = 'bin'
|
12
13
|
gem.files = `git ls-files`.split($\)
|
13
14
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
15
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
-
gem.name =
|
16
|
-
gem.require_paths = [
|
16
|
+
gem.name = 'howitzer'
|
17
|
+
gem.require_paths = ['lib']
|
17
18
|
gem.version = Howitzer::VERSION
|
18
19
|
gem.required_ruby_version = '>= 1.9.3'
|
19
20
|
|
20
|
-
gem.add_runtime_dependency 'nokogiri', '~> 1.6
|
21
|
+
gem.add_runtime_dependency 'nokogiri', '~> 1.6' if gem.platform.to_s =~ /mswin|mingw/
|
21
22
|
gem.add_runtime_dependency 'rake'
|
22
23
|
gem.add_runtime_dependency 'gli'
|
23
|
-
gem.add_runtime_dependency 'i18n'
|
24
24
|
gem.add_runtime_dependency 'syntax'
|
25
|
-
gem.add_runtime_dependency 'cucumber'
|
26
|
-
gem.add_runtime_dependency 'rspec', '~>
|
25
|
+
gem.add_runtime_dependency 'cucumber', '~>2.0'
|
26
|
+
gem.add_runtime_dependency 'rspec', '~>3.2'
|
27
27
|
gem.add_runtime_dependency 'sexy_settings'
|
28
28
|
gem.add_runtime_dependency 'repeater'
|
29
29
|
gem.add_runtime_dependency 'launchy'
|
30
|
-
gem.add_runtime_dependency 'log4r', '1.1.10'
|
30
|
+
gem.add_runtime_dependency 'log4r', '~>1.1.10'
|
31
31
|
gem.add_runtime_dependency 'rest-client'
|
32
32
|
gem.add_runtime_dependency 'poltergeist'
|
33
33
|
gem.add_runtime_dependency 'rawler'
|
34
34
|
gem.add_runtime_dependency 'capybara'
|
35
35
|
gem.add_runtime_dependency 'selenium-webdriver'
|
36
|
-
gem.add_runtime_dependency 'activesupport', '~>4.
|
36
|
+
gem.add_runtime_dependency 'activesupport', '~>4.2'
|
37
37
|
gem.add_runtime_dependency 'testingbot'
|
38
38
|
|
39
39
|
gem.add_development_dependency('aruba')
|
40
|
-
gem.add_development_dependency(
|
41
|
-
gem.add_development_dependency(
|
42
|
-
|
40
|
+
gem.add_development_dependency('fuubar')
|
41
|
+
gem.add_development_dependency('ffaker')
|
42
|
+
gem.add_development_dependency('yard')
|
43
43
|
end
|
@@ -1,10 +1,7 @@
|
|
1
|
-
##
|
2
|
-
#
|
3
|
-
# Predefined Capybara settings and capybara drivers
|
4
|
-
#
|
5
1
|
require 'selenium-webdriver'
|
6
2
|
require 'capybara'
|
7
3
|
require 'howitzer/utils/log'
|
4
|
+
require 'howitzer/helpers'
|
8
5
|
module Capybara
|
9
6
|
module Settings
|
10
7
|
extend self
|
@@ -20,11 +17,11 @@ module Capybara
|
|
20
17
|
|
21
18
|
def self.base_ff_profile_settings
|
22
19
|
profile = ::Selenium::WebDriver::Firefox::Profile.new
|
23
|
-
profile[
|
24
|
-
profile[
|
25
|
-
profile[
|
26
|
-
profile[
|
27
|
-
profile[
|
20
|
+
profile['network.http.phishy-userpass-length'] = 255
|
21
|
+
profile['browser.safebrowsing.malware.enabled'] = false
|
22
|
+
profile['network.automatic-ntlm-auth.allow-non-fqdn'] = true
|
23
|
+
profile['network.ntlm.send-lm-response'] = true
|
24
|
+
profile['network.automatic-ntlm-auth.trusted-uris'] = settings.app_host
|
28
25
|
profile
|
29
26
|
end
|
30
27
|
|
@@ -36,7 +33,7 @@ module Capybara
|
|
36
33
|
#
|
37
34
|
|
38
35
|
def define_driver
|
39
|
-
case settings.driver.to_sym
|
36
|
+
case settings.driver.to_s.to_sym
|
40
37
|
when :selenium
|
41
38
|
define_selenium_driver
|
42
39
|
when :selenium_dev
|
@@ -51,16 +48,39 @@ module Capybara
|
|
51
48
|
define_sauce_driver
|
52
49
|
when :testingbot
|
53
50
|
define_testingbot_driver
|
51
|
+
when :browserstack
|
52
|
+
define_browserstack_driver
|
53
|
+
when :selenium_grid
|
54
|
+
define_selenium_grid_driver
|
54
55
|
else
|
55
|
-
log.error "Unknown '#{settings.driver}' driver. Check your settings, it should be one of [selenium, selenium_dev, webkit, poltergeist, phantomjs, sauce, testingbot]"
|
56
|
+
log.error "Unknown '#{settings.driver}' driver. Check your settings, it should be one of [selenium, selenium_grid, selenium_dev, webkit, poltergeist, phantomjs, sauce, testingbot, browserstack]"
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
59
60
|
private
|
61
|
+
def define_selenium_grid_driver
|
62
|
+
Capybara.register_driver :selenium_grid do |app|
|
63
|
+
caps = if ie_browser?
|
64
|
+
::Selenium::WebDriver::Remote::Capabilities.internet_explorer
|
65
|
+
elsif ff_browser?
|
66
|
+
::Selenium::WebDriver::Remote::Capabilities.firefox
|
67
|
+
elsif chrome_browser?
|
68
|
+
::Selenium::WebDriver::Remote::Capabilities.chrome
|
69
|
+
elsif opera_browser?
|
70
|
+
::Selenium::WebDriver::Remote::Capabilities.opera
|
71
|
+
elsif safari_browser?
|
72
|
+
::Selenium::WebDriver::Remote::Capabilities.safari
|
73
|
+
else
|
74
|
+
log.error "Unknown '#{settings.sel_browser}' sel_browser. Check your settings, it should be one of [:ie, :iexplore, :ff, :firefox, :chrome, :opera, safari]"
|
75
|
+
end
|
76
|
+
|
77
|
+
Capybara::Selenium::Driver.new(app, :browser => :remote, :url => settings.sel_hub_url, :desired_capabilities => caps)
|
78
|
+
end
|
79
|
+
end
|
60
80
|
|
61
81
|
def define_selenium_driver
|
62
82
|
Capybara.register_driver :selenium do |app|
|
63
|
-
params = {browser: settings.sel_browser.to_sym}
|
83
|
+
params = {browser: settings.sel_browser.to_s.to_sym}
|
64
84
|
params[:profile] = base_ff_profile_settings if ff_browser?
|
65
85
|
Capybara::Selenium::Driver.new app, params
|
66
86
|
end
|
@@ -80,12 +100,12 @@ module Capybara
|
|
80
100
|
end
|
81
101
|
end
|
82
102
|
profile['extensions.firebug.currentVersion'] = 'Last' # avoid 'first run' tab
|
83
|
-
profile[
|
84
|
-
profile[
|
85
|
-
profile[
|
86
|
-
profile[
|
87
|
-
profile[
|
88
|
-
profile[
|
103
|
+
profile['extensions.firebug.previousPlacement'] = 1
|
104
|
+
profile['extensions.firebug.onByDefault'] = true
|
105
|
+
profile['extensions.firebug.defaultPanelName'] = 'firepath'
|
106
|
+
profile['extensions.firebug.script.enableSites'] = true
|
107
|
+
profile['extensions.firebug.net.enableSites'] = true
|
108
|
+
profile['extensions.firebug.console.enableSites'] = true
|
89
109
|
|
90
110
|
Capybara::Selenium::Driver.new app, browser: :firefox, profile: profile
|
91
111
|
end
|
@@ -99,10 +119,10 @@ module Capybara
|
|
99
119
|
require 'capybara/poltergeist'
|
100
120
|
Capybara.register_driver :poltergeist do |app|
|
101
121
|
Capybara::Poltergeist::Driver.new(
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
122
|
+
app, {
|
123
|
+
js_errors: !settings.pjs_ignore_js_errors,
|
124
|
+
phantomjs_options: ["--ignore-ssl-errors=#{settings.pjs_ignore_ssl_errors ? 'yes' : 'no'}" ]
|
125
|
+
}
|
106
126
|
)
|
107
127
|
end
|
108
128
|
end
|
@@ -111,36 +131,36 @@ module Capybara
|
|
111
131
|
Capybara.register_driver :phantomjs do |app|
|
112
132
|
Capybara::Selenium::Driver.new(
|
113
133
|
app, browser: :phantomjs,
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
134
|
+
desired_capabilities: {
|
135
|
+
javascript_enabled: !settings.pjs_ignore_js_errors
|
136
|
+
},
|
137
|
+
args: ["--ignore-ssl-errors=#{settings.pjs_ignore_ssl_errors ? 'yes' : 'no'}" ]
|
118
138
|
)
|
119
139
|
end
|
120
140
|
end
|
121
141
|
|
122
142
|
def define_sauce_driver
|
123
|
-
task_name =
|
143
|
+
task_name = rake_task_name
|
124
144
|
caps_opts = {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
145
|
+
platform: settings.sl_platform,
|
146
|
+
browser_name: settings.sl_browser_name,
|
147
|
+
name: "#{ENV['RAKE_TASK'] ? (task_name.empty? ? 'ALL' : task_name) : 'CUSTOM'} #{settings.sl_browser_name.upcase}",
|
148
|
+
'max-duration' => settings.sl_max_duration,
|
149
|
+
'idle-timeout' => settings.sl_idle_timeout,
|
150
|
+
'selenium-version' => settings.sl_selenium_version,
|
151
|
+
'record-screenshots' => settings.sl_record_screenshot,
|
152
|
+
'video-upload-on-pass' => settings.sl_video_upload_on_pass
|
133
153
|
}
|
134
154
|
|
135
|
-
unless (settings.sl_browser_version.to_s ||
|
155
|
+
unless (settings.sl_browser_version.to_s || '').empty?
|
136
156
|
caps_opts['version'] = settings.sl_browser_version.to_s
|
137
157
|
end
|
138
158
|
|
139
159
|
options = {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
160
|
+
url: settings.sl_url,
|
161
|
+
desired_capabilities: ::Selenium::WebDriver::Remote::Capabilities.new(caps_opts),
|
162
|
+
http_client: ::Selenium::WebDriver::Remote::Http::Default.new.tap{|c| c.timeout = settings.timeout_medium},
|
163
|
+
browser: :remote
|
144
164
|
}
|
145
165
|
|
146
166
|
Capybara.register_driver :sauce do |app|
|
@@ -155,7 +175,7 @@ module Capybara
|
|
155
175
|
|
156
176
|
def define_testingbot_driver
|
157
177
|
require 'testingbot'
|
158
|
-
task_name =
|
178
|
+
task_name = rake_task_name
|
159
179
|
caps_opts = {
|
160
180
|
platform: settings.tb_platform,
|
161
181
|
browser_name: settings.tb_browser_name,
|
@@ -168,7 +188,7 @@ module Capybara
|
|
168
188
|
}
|
169
189
|
|
170
190
|
unless (settings.tb_browser_version.to_s || "").empty?
|
171
|
-
|
191
|
+
caps_opts['version'] = settings.tb_browser_version.to_s
|
172
192
|
end
|
173
193
|
options = {
|
174
194
|
url: settings.tb_url,
|
@@ -187,6 +207,49 @@ module Capybara
|
|
187
207
|
end
|
188
208
|
end
|
189
209
|
|
210
|
+
def define_browserstack_driver
|
211
|
+
task_name = rake_task_name
|
212
|
+
caps_opts = {
|
213
|
+
name: "#{ENV['RAKE_TASK'] ? (task_name.empty? ? 'ALL' : task_name) : 'CUSTOM'} #{settings.bs_mobile ? settings.bs_m_browser : settings.bs_browser_name.upcase}",
|
214
|
+
maxduration: settings.bs_max_duration.to_i,
|
215
|
+
idletimeout: settings.bs_idle_timeout.to_i,
|
216
|
+
project: settings.bs_project,
|
217
|
+
build: settings.bs_build,
|
218
|
+
resolution: settings.bs_resolution
|
219
|
+
}
|
220
|
+
|
221
|
+
if settings.bs_local
|
222
|
+
caps_opts['browserstack.local'] = settings.bs_local
|
223
|
+
caps_opts['browserstack.localIdentifier'] = settings.bs_local_ID
|
224
|
+
end
|
225
|
+
|
226
|
+
if settings.bs_mobile
|
227
|
+
caps_opts[:browserName] = settings.bs_m_browser
|
228
|
+
caps_opts[:platform] = settings.bs_m_platform
|
229
|
+
caps_opts[:device] = settings.bs_m_device
|
230
|
+
else
|
231
|
+
caps_opts[:os] = settings.bs_os_name
|
232
|
+
caps_opts[:os_version] = settings.bs_os_version
|
233
|
+
caps_opts[:browser] = settings.bs_browser_name
|
234
|
+
caps_opts[:browser_version] = settings.bs_browser_version
|
235
|
+
end
|
236
|
+
|
237
|
+
options = {
|
238
|
+
url: settings.bs_url,
|
239
|
+
desired_capabilities: ::Selenium::WebDriver::Remote::Capabilities.new(caps_opts),
|
240
|
+
browser: :remote
|
241
|
+
}
|
242
|
+
Capybara.register_driver :browserstack do |app|
|
243
|
+
driver = Capybara::Selenium::Driver.new(app, options)
|
244
|
+
driver.browser.file_detector = lambda do |args|
|
245
|
+
str = args.first.to_s
|
246
|
+
str if File.exist?(str)
|
247
|
+
end
|
248
|
+
|
249
|
+
driver
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
190
253
|
##
|
191
254
|
#
|
192
255
|
# Returns url of current Sauce Labs job
|
@@ -230,11 +293,11 @@ module Capybara
|
|
230
293
|
|
231
294
|
def suite_name
|
232
295
|
res = if ENV['RAKE_TASK']
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
296
|
+
res = ENV['RAKE_TASK'].sub(/(?:r?spec|cucumber):?(.*)/, '\1').upcase
|
297
|
+
res.empty? ? 'ALL' : res
|
298
|
+
else
|
299
|
+
'CUSTOM'
|
300
|
+
end
|
238
301
|
"#{res} #{settings.sl_browser_name.upcase}"
|
239
302
|
end
|
240
303
|
|
@@ -247,15 +310,28 @@ module Capybara
|
|
247
310
|
Capybara.current_session.driver.browser.instance_variable_get(:@bridge).session_id
|
248
311
|
end
|
249
312
|
|
313
|
+
##
|
314
|
+
#
|
315
|
+
# Returns custom name for rake task
|
316
|
+
#
|
317
|
+
# *Returns:*
|
318
|
+
# * +string+ - Returns rake task name
|
319
|
+
#
|
320
|
+
|
321
|
+
def rake_task_name
|
322
|
+
ENV['RAKE_TASK'].to_s.sub(/(?:r?spec|cucumber):?(.*)/, '\1').upcase
|
323
|
+
end
|
324
|
+
|
250
325
|
Capybara.run_server = false
|
251
326
|
Capybara.app_host = ''
|
327
|
+
Capybara.asset_host = app_base_url
|
252
328
|
Capybara.default_wait_time = settings.timeout_small
|
253
329
|
Capybara.ignore_hidden_elements = true
|
254
330
|
Capybara.visible_text_only = true
|
255
331
|
Capybara.match = :one
|
256
332
|
Capybara.exact_options = true
|
257
|
-
Capybara.default_driver = settings.driver.to_sym
|
258
|
-
Capybara.javascript_driver = settings.driver.to_sym
|
333
|
+
Capybara.default_driver = settings.driver.to_s.to_sym
|
334
|
+
Capybara.javascript_driver = settings.driver.to_s.to_sym
|
259
335
|
|
260
336
|
define_driver
|
261
337
|
|