acceptance_test 1.2.0 → 1.3.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 +8 -8
- data/.idea/acceptance_test.iml +51 -36
- data/CHANGES +9 -1
- data/lib/acceptance_test/acceptance_shared_context.rb +5 -1
- data/lib/acceptance_test/acceptance_test.rb +38 -35
- data/lib/acceptance_test/acceptance_test_builder.rb +37 -0
- data/lib/acceptance_test/version.rb +1 -1
- data/spec/features/acceptance_config.yml +1 -4
- data/spec/features/with_selenium_conf_spec.rb +21 -21
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZjJmMzE2MzI3M2Y3ZDhlYzJkMTEwNmU1MTRiNWYxNTM4M2ZmYTVlYg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
ODU5MjBlMzYzZjBjMDlhMGY1ZGMwMTdlOTdiYTc1YjUzNDIxOTIxYg==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
YTY1OGZiNTQ4ZGY3MTQ0OTExNGY1OGU5YzMyMDYwN2ExZmFiNGM5MzJlMTAw
|
|
10
|
+
NWZmN2IwODQ5NjRjN2I1YzU4NmNkYzJhYzY4YzIwNzcyY2ZjN2JlYTQyNThk
|
|
11
|
+
OTNmNDhhYzUyYWViOTg0ZTM4OTRiMjUwYzQyM2ZlZWNkYjYzOTk=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
NTQwODY0NDhhOTNlNzUzNDFmYmQzN2NkOWUwMGQzOWI4MzM1NTg1YWFhYWRm
|
|
14
|
+
OTgwMjkzZWVjZmUyNTJhYzE3Mzk3MDNhNTE1MzdkOWJmZGU2NDE0NjliZjdk
|
|
15
|
+
MzkwZjhkNWMyNTcyODdlZjBmNDc0OTY3NWIzMTI3MWU2ZjI1YTQ=
|
data/.idea/acceptance_test.iml
CHANGED
|
@@ -13,42 +13,6 @@
|
|
|
13
13
|
</facet>
|
|
14
14
|
</component>
|
|
15
15
|
<component name="ModuleRunConfigurationManager">
|
|
16
|
-
<configuration default="false" name="Google Search: acceptance_test" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
|
17
|
-
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
|
18
|
-
<module name="acceptance_test" />
|
|
19
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
20
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
|
21
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
22
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
23
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
24
|
-
<envs>
|
|
25
|
-
<env name="JRUBY_OPTS" value="-X+O" />
|
|
26
|
-
</envs>
|
|
27
|
-
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
|
28
|
-
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
29
|
-
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
30
|
-
<COVERAGE_PATTERN ENABLED="true">
|
|
31
|
-
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
32
|
-
</COVERAGE_PATTERN>
|
|
33
|
-
</EXTENSION>
|
|
34
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
|
35
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
36
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/features/with_selenium_conf_spec.rb" />
|
|
37
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
|
38
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
|
39
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="Google Search" />
|
|
40
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
41
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
|
42
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
|
43
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
|
44
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
45
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
|
46
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
|
47
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
|
48
|
-
<RunnerSettings RunnerId="RubyRunner" />
|
|
49
|
-
<ConfigurationWrapper RunnerId="RubyRunner" />
|
|
50
|
-
<method />
|
|
51
|
-
</configuration>
|
|
52
16
|
<configuration default="false" name="google_search_spec" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
|
53
17
|
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
|
54
18
|
<module name="acceptance_test" />
|
|
@@ -195,24 +159,74 @@
|
|
|
195
159
|
<ConfigurationWrapper RunnerId="RubyRunner" />
|
|
196
160
|
<method />
|
|
197
161
|
</configuration>
|
|
162
|
+
<configuration default="false" name=" uses selenium driver: acceptance_test" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
|
163
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
|
164
|
+
<module name="acceptance_test" />
|
|
165
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
166
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
|
167
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
168
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
169
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
170
|
+
<envs>
|
|
171
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
|
172
|
+
</envs>
|
|
173
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
174
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
175
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
176
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
177
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
178
|
+
</COVERAGE_PATTERN>
|
|
179
|
+
</EXTENSION>
|
|
180
|
+
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
|
181
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
182
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/features/google_search_spec.rb" />
|
|
183
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
|
184
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
|
185
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE=" uses selenium driver" />
|
|
186
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
187
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
|
188
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
|
189
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
|
190
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
191
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
|
192
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
|
193
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
|
194
|
+
<RunnerSettings RunnerId="RubyRunner" />
|
|
195
|
+
<ConfigurationWrapper RunnerId="RubyRunner" />
|
|
196
|
+
<method />
|
|
197
|
+
</configuration>
|
|
198
198
|
</component>
|
|
199
199
|
<component name="NewModuleRootManager">
|
|
200
200
|
<content url="file://$MODULE_DIR$" />
|
|
201
201
|
<orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-p547 [acceptance_test]" jdkType="RUBY_SDK" />
|
|
202
202
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
203
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v4.1.6, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
203
204
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.7.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
205
|
+
<orderEntry type="library" scope="PROVIDED" name="capybara (v2.4.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
206
|
+
<orderEntry type="library" scope="PROVIDED" name="capybara-firebug (v2.1.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
207
|
+
<orderEntry type="library" scope="PROVIDED" name="capybara-webkit (v1.3.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
204
208
|
<orderEntry type="library" scope="PROVIDED" name="childprocess (v0.5.3, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
205
209
|
<orderEntry type="library" scope="PROVIDED" name="cliver (v0.3.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
210
|
+
<orderEntry type="library" scope="PROVIDED" name="debugger-ruby_core_source (v1.3.5, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
206
211
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
207
212
|
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.3, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
208
213
|
<orderEntry type="library" scope="PROVIDED" name="file_utils (v1.0.7, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
209
214
|
<orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
210
215
|
<orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.1.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
216
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.11, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
211
217
|
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
212
218
|
<orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.4, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
219
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v2.3, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
220
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile (v0.6.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
221
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.4.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
222
|
+
<orderEntry type="library" scope="PROVIDED" name="mocha (v1.1.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
213
223
|
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
224
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.3.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
225
|
+
<orderEntry type="library" scope="PROVIDED" name="poltergeist (v1.5.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
214
226
|
<orderEntry type="library" scope="PROVIDED" name="rack (v1.5.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
215
227
|
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
228
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
229
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.1.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
216
230
|
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.1.3, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
217
231
|
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.1.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
218
232
|
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.1.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
@@ -220,6 +234,7 @@
|
|
|
220
234
|
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-base19x (v0.11.30.pre12, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
221
235
|
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-ide (v0.4.17, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
222
236
|
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v1.1.6, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
237
|
+
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v2.43.0, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
223
238
|
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.4, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
224
239
|
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.2, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
|
225
240
|
<orderEntry type="library" scope="PROVIDED" name="websocket (v1.2.1, RVM: ruby-1.9.3-p547 [acceptance_test]) [gem]" level="application" />
|
data/CHANGES
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
if defined? RSpec
|
|
2
|
+
require 'acceptance_test/acceptance_test_builder'
|
|
3
|
+
|
|
2
4
|
acceptance_test_lambda = lambda do
|
|
3
5
|
attr_reader :acceptance_test
|
|
4
6
|
|
|
5
7
|
before :all do
|
|
6
|
-
|
|
8
|
+
config_name = File.expand_path("spec/features/acceptance_config.yml")
|
|
9
|
+
|
|
10
|
+
@acceptance_test = AcceptanceTestBuilder.instance.create ".", config_name, "tmp"
|
|
7
11
|
end
|
|
8
12
|
|
|
9
13
|
before do
|
|
@@ -6,39 +6,20 @@ require 'active_support/core_ext/hash'
|
|
|
6
6
|
require 'acceptance_test/acceptance_test_helper'
|
|
7
7
|
|
|
8
8
|
class AcceptanceTest
|
|
9
|
-
attr_reader :
|
|
9
|
+
attr_reader :project_root, :config, :screenshot_dir
|
|
10
10
|
attr_accessor :app_host
|
|
11
11
|
|
|
12
|
-
def initialize project_root, screenshot_dir
|
|
12
|
+
def initialize project_root, config, screenshot_dir
|
|
13
13
|
@project_root = File.expand_path(project_root.to_s)
|
|
14
14
|
@screenshot_dir = File.expand_path(screenshot_dir.to_s)
|
|
15
15
|
|
|
16
16
|
@app_host = default_app_host
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
@config = config.kind_of?(HashWithIndifferentAccess) ? config : HashWithIndifferentAccess.new(config)
|
|
19
19
|
|
|
20
20
|
configure
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def acceptance_config= acceptance_config
|
|
24
|
-
@acceptance_config = acceptance_config.kind_of?(HashWithIndifferentAccess) ?
|
|
25
|
-
acceptance_config : HashWithIndifferentAccess.new(acceptance_config)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def driver metadata
|
|
29
|
-
driver = ENV['DRIVER'].nil? ? nil : ENV['DRIVER'].to_sym
|
|
30
|
-
|
|
31
|
-
driver = metadata[:driver] if driver.nil?
|
|
32
|
-
|
|
33
|
-
driver = :webkit if driver.nil?
|
|
34
|
-
|
|
35
|
-
driver
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def selenium_driver? driver
|
|
39
|
-
driver.to_s =~ /selenium/
|
|
40
|
-
end
|
|
41
|
-
|
|
42
23
|
def before metadata={}
|
|
43
24
|
driver = driver(metadata)
|
|
44
25
|
|
|
@@ -68,17 +49,26 @@ class AcceptanceTest
|
|
|
68
49
|
Capybara.current_driver = Capybara.default_driver
|
|
69
50
|
end
|
|
70
51
|
|
|
52
|
+
def driver metadata
|
|
53
|
+
driver = ENV['DRIVER'].nil? ? nil : ENV['DRIVER'].to_sym
|
|
54
|
+
|
|
55
|
+
driver = metadata[:driver] if driver.nil?
|
|
56
|
+
|
|
57
|
+
driver = :webkit if driver.nil?
|
|
58
|
+
|
|
59
|
+
driver
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def selenium_driver? driver
|
|
63
|
+
driver.to_s =~ /selenium/
|
|
64
|
+
end
|
|
65
|
+
|
|
71
66
|
private
|
|
72
67
|
|
|
73
68
|
def default_app_host
|
|
74
69
|
"http://#{AcceptanceTestHelper.get_localhost}:3000"
|
|
75
70
|
end
|
|
76
71
|
|
|
77
|
-
def set_defaults
|
|
78
|
-
ENV['APP_HOST'] ||= app_host
|
|
79
|
-
ENV['WAIT_TIME'] ||= Capybara.default_wait_time.to_s
|
|
80
|
-
end
|
|
81
|
-
|
|
82
72
|
def configure
|
|
83
73
|
run_server = (ENV['RUN_SERVER'] == "true")
|
|
84
74
|
|
|
@@ -110,9 +100,25 @@ class AcceptanceTest
|
|
|
110
100
|
end
|
|
111
101
|
|
|
112
102
|
Capybara.configure do |config|
|
|
113
|
-
config.default_wait_time =
|
|
103
|
+
config.default_wait_time = timeout_in_seconds
|
|
104
|
+
|
|
114
105
|
config.run_server = run_server
|
|
115
106
|
end
|
|
107
|
+
|
|
108
|
+
ENV['APP_HOST'] ||= app_host
|
|
109
|
+
ENV['WAIT_TIME'] ||= Capybara.default_wait_time.to_s
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def timeout_in_seconds
|
|
113
|
+
if ENV['WAIT_TIME']
|
|
114
|
+
ENV['WAIT_TIME'].to_i
|
|
115
|
+
else
|
|
116
|
+
if config[:timeout_in_seconds]
|
|
117
|
+
config[:timeout_in_seconds]
|
|
118
|
+
else
|
|
119
|
+
Capybara.default_wait_time.to_s
|
|
120
|
+
end
|
|
121
|
+
end
|
|
116
122
|
end
|
|
117
123
|
|
|
118
124
|
def register_driver driver
|
|
@@ -151,10 +157,8 @@ class AcceptanceTest
|
|
|
151
157
|
|
|
152
158
|
when :selenium_remote
|
|
153
159
|
unless Capybara.drivers[:selenium_remote]
|
|
154
|
-
url = "http://#{acceptance_config[:selenium_host]}:#{acceptance_config[:selenium_port]}/wd/hub"
|
|
155
|
-
|
|
156
160
|
Capybara.register_driver :selenium_remote do |app|
|
|
157
|
-
Capybara::Selenium::Driver.new(app, {:browser => :remote, :url =>
|
|
161
|
+
Capybara::Selenium::Driver.new(app, {:browser => :remote, :url => config[:selenium_url]})
|
|
158
162
|
|
|
159
163
|
#profile = Selenium::WebDriver::Firefox::Profile.new
|
|
160
164
|
#profile.enable_firebug
|
|
@@ -211,17 +215,16 @@ class AcceptanceTest
|
|
|
211
215
|
end
|
|
212
216
|
|
|
213
217
|
def acceptance_config_exist?
|
|
214
|
-
not
|
|
218
|
+
not config.nil?
|
|
215
219
|
end
|
|
216
220
|
|
|
217
221
|
def setup_driver_from_config driver
|
|
218
|
-
@app_host = app_host_from_url(
|
|
222
|
+
@app_host = app_host_from_url(config[:webapp_url])
|
|
219
223
|
|
|
220
|
-
Rails.env =
|
|
224
|
+
# Rails.env = config[:env] if defined? Rails.env
|
|
221
225
|
|
|
222
226
|
Capybara.current_driver = driver
|
|
223
227
|
Capybara.javascript_driver = driver
|
|
224
228
|
end
|
|
225
229
|
|
|
226
230
|
end
|
|
227
|
-
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'singleton'
|
|
3
|
+
require 'active_support/core_ext/hash'
|
|
4
|
+
|
|
5
|
+
class AcceptanceTestBuilder
|
|
6
|
+
include Singleton
|
|
7
|
+
|
|
8
|
+
def create project_root, config_name, screenshot_dir
|
|
9
|
+
Capybara.default_driver = :selenium
|
|
10
|
+
|
|
11
|
+
ENV['DRIVER'] = 'selenium'
|
|
12
|
+
|
|
13
|
+
Capybara.configure do |config|
|
|
14
|
+
config.match = :first
|
|
15
|
+
|
|
16
|
+
config.ignore_hidden_elements = false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
project_root = File.expand_path(project_root.to_s)
|
|
20
|
+
|
|
21
|
+
config = HashWithIndifferentAccess.new(YAML.load_file(config_name))
|
|
22
|
+
|
|
23
|
+
system "mkdir -p #{screenshot_dir}"
|
|
24
|
+
|
|
25
|
+
acceptance_test = AcceptanceTest.new project_root, config, screenshot_dir
|
|
26
|
+
|
|
27
|
+
ENV['ASSET_HOST'] = acceptance_test.app_host
|
|
28
|
+
|
|
29
|
+
puts "Application URL : #{config[:webapp_url]}"
|
|
30
|
+
puts "Selenium URL : http://#{config[:selenium_host]}:#{config[:selenium_port]}"
|
|
31
|
+
puts "ENV['DRIVER'] : #{ENV['DRIVER']}" if ENV['DRIVER']
|
|
32
|
+
puts "Default Wait Time : #{Capybara.default_wait_time}"
|
|
33
|
+
|
|
34
|
+
acceptance_test
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -5,30 +5,30 @@ RSpec.describe 'Google Search' do
|
|
|
5
5
|
include_context "AcceptanceTest"
|
|
6
6
|
|
|
7
7
|
before :all do
|
|
8
|
-
acceptance_config_file = "spec/features/acceptance_config.yml"
|
|
9
|
-
|
|
10
|
-
acceptance_test.acceptance_config = YAML.load_file(acceptance_config_file)
|
|
11
|
-
|
|
12
|
-
acceptance_config = acceptance_test.acceptance_config
|
|
13
|
-
|
|
14
|
-
env = acceptance_config[:env]
|
|
15
|
-
|
|
16
|
-
puts "\nEnvironment: #{@acceptance_config[:env]}" if env
|
|
17
|
-
puts "Application: #{@acceptance_config[:webapp_url]}"
|
|
18
|
-
|
|
19
|
-
driver = acceptance_test.driver(metadata)
|
|
20
|
-
|
|
21
|
-
if acceptance_test.selenium_driver?(driver)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
end
|
|
8
|
+
#acceptance_config_file = "spec/features/acceptance_config.yml"
|
|
9
|
+
|
|
10
|
+
# acceptance_test.acceptance_config = YAML.load_file(acceptance_config_file)
|
|
11
|
+
#
|
|
12
|
+
# acceptance_config = acceptance_test.acceptance_config
|
|
13
|
+
|
|
14
|
+
# env = acceptance_config[:env]
|
|
15
|
+
#
|
|
16
|
+
# puts "\nEnvironment: #{@acceptance_config[:env]}" if env
|
|
17
|
+
# puts "Application: #{@acceptance_config[:webapp_url]}"
|
|
18
|
+
#
|
|
19
|
+
# driver = acceptance_test.driver(metadata)
|
|
20
|
+
#
|
|
21
|
+
# if acceptance_test.selenium_driver?(driver)
|
|
22
|
+
# selenium_host = acceptance_config[:selenium_host]
|
|
23
|
+
# selenium_port = acceptance_config[:selenium_port]
|
|
24
|
+
#
|
|
25
|
+
# puts "Selenium: #{selenium_host}:#{selenium_port}"
|
|
26
|
+
# end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
before do
|
|
30
|
-
puts "Using driver: #{Capybara.current_driver}."
|
|
31
|
-
puts "Default wait time: #{Capybara.default_wait_time}."
|
|
30
|
+
# puts "Using driver: #{Capybara.current_driver}."
|
|
31
|
+
# puts "Default wait time: #{Capybara.default_wait_time}."
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it "uses selenium driver", driver: :selenium_remote do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acceptance_test
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander Shvets
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-09-
|
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gemspec_deps_gen
|
|
@@ -66,6 +66,7 @@ files:
|
|
|
66
66
|
- lib/acceptance_test.rb
|
|
67
67
|
- lib/acceptance_test/acceptance_shared_context.rb
|
|
68
68
|
- lib/acceptance_test/acceptance_test.rb
|
|
69
|
+
- lib/acceptance_test/acceptance_test_builder.rb
|
|
69
70
|
- lib/acceptance_test/acceptance_test_helper.rb
|
|
70
71
|
- lib/acceptance_test/screenshot_maker.rb
|
|
71
72
|
- lib/acceptance_test/version.rb
|