acceptance_test 1.9.13 → 1.10.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.
Files changed (32) hide show
  1. checksums.yaml +8 -8
  2. data/.rspec +1 -1
  3. data/CHANGES +5 -1
  4. data/Rakefile +7 -0
  5. data/lib/acceptance_test/acceptance_config.rb +107 -0
  6. data/lib/acceptance_test/version.rb +1 -1
  7. data/spec/{turnip_helper.rb → spec_helper.rb} +10 -2
  8. data/spec/{acceptance → wikipedia/acceptance}/search_with_config_spec.rb +0 -0
  9. data/spec/{acceptance → wikipedia/acceptance}/search_with_drivers_spec.rb +0 -0
  10. data/spec/{acceptance → wikipedia/acceptance}/search_with_example_steps_spec.rb +0 -0
  11. data/spec/{acceptance → wikipedia/acceptance}/search_with_pages_spec.rb +1 -1
  12. data/spec/{acceptance → wikipedia/acceptance}/search_with_steps_spec.rb +0 -0
  13. data/spec/{acceptance_config.yml → wikipedia/acceptance_config.yml} +0 -0
  14. data/spec/{data.csv → wikipedia/data.csv} +0 -0
  15. data/spec/{data.yml → wikipedia/data.yml} +0 -0
  16. data/spec/{features → wikipedia/features}/search_with_drivers.feature +0 -0
  17. data/spec/{features → wikipedia/features}/search_with_pages.feature +0 -0
  18. data/spec/{features → wikipedia/features}/search_with_scenario_outline1.feature +0 -0
  19. data/spec/{features → wikipedia/features}/search_with_scenario_outline2.feature +1 -1
  20. data/spec/{features → wikipedia/features}/search_with_scenario_outline3.feature +1 -1
  21. data/spec/{features → wikipedia/features}/search_with_scenario_outline4.feature +1 -1
  22. data/spec/{features → wikipedia/features}/search_with_table.feature +0 -0
  23. data/spec/wikipedia/support/pages.rb +20 -0
  24. data/spec/{support → wikipedia/support}/steps/search_with_drivers_steps.rb +0 -0
  25. data/spec/{support → wikipedia/support}/steps/search_with_pages_steps.rb +1 -1
  26. data/spec/{support → wikipedia/support}/steps/search_with_scenario_outline_steps.rb +0 -0
  27. data/spec/{support → wikipedia/support}/steps/search_with_table_steps.rb +0 -0
  28. data/spec/wikipedia/support/wikipedia_pages.rb +15 -0
  29. metadata +48 -49
  30. data/spec/support/pages/main_page.rb +0 -17
  31. data/spec/support/pages/wikipedia_pages.rb +0 -21
  32. data/spec/test_helper.rb +0 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzllM2IyMmY4MGQ0Y2MyNzk4NjUwZjEyMDNjNjViZDhmNGNkYTM4ZQ==
4
+ ODQ2NTYxZjI5MzA5MzEyZDc3NmViM2M1MGJhMmFhYTNhZGEwMzk2YQ==
5
5
  data.tar.gz: !binary |-
6
- YTAxODEzMDk5OTcxYjA5ZWUwZTc2OTgwZDc4MzE3YjMxNWU0YzIzZQ==
6
+ ODliM2U3YWNjM2IyYjMyMzdlZWQ3NjNlNDllNDg4NDI3MGU1M2ExNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjZhNGU2NWY3M2ViM2Y0YzIyNTdjYmI1YmYxNDdkOTA3YWUwMWRlMTcwNzc3
10
- NjE4YmQ3YTUwN2Y4ZmZlZmI0NjNlNjdiZmU4NWZiNmFmMDNlNGU2MTk0MGM5
11
- MWVkMjI5NzI1NWE1ZDM1NGFhY2I4NDNmNmM5MTcxMjEzMWJjNzA=
9
+ OWM1MTAyYjdmMTU4ZWI1MjdkYTJhODBjZDE2OGVkZWUwNGFhYTllZTNiYmJi
10
+ MjUzOWUwZDYzODdlOWYzMzllZDA2M2FlZjcxZTBhZDY1MjZiNDhmOGU5ZTgz
11
+ NTM0Zjk2MzkwOGY5ZDhhMWI2OTk0Y2QxM2JkMWJkNGUwNWFjMTE=
12
12
  data.tar.gz: !binary |-
13
- NmViNDIwZGJmZTJkY2UyNjdjN2M2NzM4MDMyOGRlMTdiNjFmM2JhNDQ3N2Uw
14
- NTlmMTZhZmFmYTIyNjUyZDgwNWYxOTA1NzQ0MTc4YWUxNDI3ZmM1MTMyMmIz
15
- M2NjYjRmY2NlM2UyMWQ4MmYzNjgwMTAyMjFhMTk1NjUzYmU0MGI=
13
+ MDRmYzBiMDU2MjE5MTI4NzVjMzgzN2Y1MTI1NDc2ODcyZTUzYTdjOTU3YWVj
14
+ YTA3N2EyZjIxOTI5MDYwNjZhMDMzMmZmNmMyYThhYTRhYzgzZmE5ZTMwMTU1
15
+ N2JjZjgwYmZiNjgyYThhNGM3OGRiZTU1OGYxYmNlNjQyZmUyYzQ=
data/.rspec CHANGED
@@ -1 +1 @@
1
- -r turnip/rspec
1
+ -r acceptance_test/acceptance_config -r turnip/rspec
data/CHANGES CHANGED
@@ -287,4 +287,8 @@
287
287
 
288
288
  == Version 1.9.13
289
289
 
290
- * Add method to dynamically detect pages
290
+ * Add method to dynamically detect pages
291
+
292
+ == Version 1.10.0
293
+
294
+ * Adding acceptance_config
data/Rakefile CHANGED
@@ -89,4 +89,11 @@ task :diff_steps do
89
89
 
90
90
  DiffTool.instance.diff source, target
91
91
  end
92
+ end
93
+
94
+ task :turnip do
95
+ # result = system "CONFIG_FILE=workspace/wikipedia/acceptance_config.yml rspec -r acceptd/acceptance_config -r turnip/rspec workspace/wikipedia/features/search_with_drivers.feature"
96
+ result = system "CONFIG_FILE=spec/wikipedia/acceptance_config.yml rspec -r acceptance_test/acceptance_config -r turnip/rspec spec/wikipedia/features/search_with_drivers.feature"
97
+
98
+ puts result
92
99
  end
@@ -0,0 +1,107 @@
1
+ require 'singleton'
2
+ require 'yaml'
3
+ require 'csv'
4
+ require 'active_support/core_ext/hash'
5
+ require 'acceptance_test'
6
+
7
+ require 'turnip/capybara'
8
+ require 'gnawrnip'
9
+
10
+ class AcceptanceConfig
11
+ include Singleton
12
+
13
+ def configure app_name=nil
14
+ @app_name = app_name
15
+
16
+ load_support_code "spec"
17
+
18
+ acceptance_test = AcceptanceTest.instance
19
+
20
+ #acceptance_test.enable_external_source data_reader # enable external source for gherkin
21
+
22
+ RSpec.configure do |config|
23
+ config_file = acceptance_config_file(app_name)
24
+ acceptance_config = config_file ? HashWithIndifferentAccess.new(YAML.load_file(config_file)) : {}
25
+
26
+ acceptance_test.configure(acceptance_config)
27
+
28
+ acceptance_test.configure_turnip 'tmp/report.html', "test"
29
+
30
+ config.before(:type => :feature) do |example|
31
+ acceptance_test.setup page, example.metadata
32
+ end
33
+
34
+ config.after(:type => :feature) do |example|
35
+ extra_metadata = {}
36
+
37
+ extra_metadata[:screenshot_url_base] = acceptance_config[:screenshot_url_base] if acceptance_config[:screenshot_url_base]
38
+
39
+ acceptance_test.teardown page, example.metadata.merge(extra_metadata), example.exception
40
+ end
41
+ end
42
+ end
43
+
44
+ def app_name
45
+ ENV['APP_NAME'].nil? ? @app_name : ENV['APP_NAME']
46
+ end
47
+
48
+ def environment
49
+ ENV['ACCEPTANCE_ENV'].nil? ? "development" : ENV['ACCEPTANCE_ENV']
50
+ end
51
+
52
+ def acceptance_config_file app_name
53
+ ENV['CONFIG_FILE'] ? File.expand_path(ENV['CONFIG_FILE']) : detect_file("acceptance_config", app_name, ".yml")
54
+ end
55
+
56
+ private
57
+
58
+ def load_support_code basedir
59
+ target = nil
60
+
61
+ ARGV.each do |arg|
62
+ if arg =~ /.*\.feature/
63
+ target = arg
64
+ end
65
+ end
66
+
67
+ target = ARGV.last unless target
68
+
69
+ if File.directory?(target)
70
+ target_dir = target
71
+ else
72
+ target_dir = File.dirname(target)
73
+ end
74
+
75
+ support_dir = "#{target_dir}/../support"
76
+
77
+ $: << File.expand_path("#{basedir}/support")
78
+ $: << File.expand_path(support_dir)
79
+
80
+ Dir.entries("#{support_dir}/steps").each do |name|
81
+ require "steps/#{File.basename(name)}" unless [".", ".."].include? name
82
+ end
83
+ end
84
+
85
+ def detect_file dir, app_type, ext
86
+ path1 = "#{dir}/#{app_type}-#{environment}#{ext}"
87
+ path2 = "#{dir}/#{app_type}#{ext}"
88
+
89
+ full_path = File.expand_path(path1)
90
+
91
+ File.exist?(full_path) ? full_path : File.expand_path(path2)
92
+ end
93
+
94
+ def data_reader
95
+ lambda do |source_path|
96
+ ext = File.extname(source_path)
97
+
98
+ if ext == '.csv'
99
+ CSV.read(File.expand_path(source_path))
100
+ elsif ext == '.yml'
101
+ YAML.load_file(File.expand_path(source_path))
102
+ end
103
+ end
104
+ end
105
+
106
+ end
107
+
@@ -1,3 +1,3 @@
1
1
  class AcceptanceTest
2
- VERSION = "1.9.13"
2
+ VERSION = "1.10.0"
3
3
  end
@@ -2,7 +2,8 @@ require 'yaml'
2
2
  require 'csv'
3
3
  require 'active_support/core_ext/hash'
4
4
 
5
- require 'test_helper'
5
+ $: << File.expand_path('spec/support')
6
+ $: << File.expand_path('spec/wikipedia/support')
6
7
 
7
8
  require 'acceptance_test'
8
9
 
@@ -18,7 +19,7 @@ acceptance_test = AcceptanceTest.instance
18
19
 
19
20
  RSpec.configure do |conf|
20
21
  conf.before(:type => :feature) do
21
- config_name = File.expand_path("spec/acceptance_config.yml")
22
+ config_name = File.expand_path("spec/wikipedia/acceptance_config.yml")
22
23
  config = config_name ? HashWithIndifferentAccess.new(YAML.load_file(config_name)) : {}
23
24
 
24
25
  acceptance_test.configure(config)
@@ -37,6 +38,13 @@ RSpec.configure do |conf|
37
38
  end
38
39
  end
39
40
 
41
+ # ENV['CONFIG_FILE'] = "spec/wikipedia/acceptance_config.yml"
42
+ #
43
+ # require 'acceptance_test/acceptance_config'
44
+ #
45
+ # AcceptanceConfig.instance.configure "wikipedia"
46
+
47
+
40
48
 
41
49
 
42
50
 
@@ -24,7 +24,7 @@ end
24
24
  AcceptanceTest.instance.configure({webapp_url: 'http://www.wikipedia.org', timeout_in_seconds: 10,
25
25
  driver: :selenium, browser: :chrome})
26
26
 
27
- require 'test_helper'
27
+ require 'spec_helper'
28
28
  require 'pages/wikipedia_pages'
29
29
 
30
30
  RSpec.describe 'Wikipedia Search' do
File without changes
File without changes
@@ -13,4 +13,4 @@ Feature: Using Wikipedia
13
13
 
14
14
  Examples:
15
15
  | keyword | result | something_else |
16
- | file:spec/data.csv || |
16
+ | file:spec/wikipedia/data.csv || |
@@ -13,4 +13,4 @@ Feature: Using Wikipedia
13
13
 
14
14
  Examples:
15
15
  | keyword | result |something_else |
16
- | file:spec/data.yml, key:test1 || |
16
+ | file:spec/wikipedia/data.yml, key:test1 || |
@@ -12,4 +12,4 @@ Feature: Using Wikipedia
12
12
  Then I should see "<result>"
13
13
 
14
14
  Examples:
15
- | file:spec/data.yml, key:test2 |
15
+ | file:spec/wikipedia/data.yml, key:test2 |
@@ -0,0 +1,20 @@
1
+ require 'acceptance_test/page'
2
+
3
+ module Pages
4
+ class MainPage < Page
5
+ def visit_home_page
6
+ session.visit('/')
7
+ end
8
+
9
+ def enter_word word
10
+ with_session do
11
+ fill_in "searchInput", :with => word
12
+ end
13
+ end
14
+
15
+ def submit_request
16
+ session.find(".formBtn", match: :first).click
17
+ end
18
+ end
19
+
20
+ end
@@ -1,5 +1,5 @@
1
1
  require 'steps/common_steps'
2
- require 'pages/wikipedia_pages'
2
+ require 'wikipedia_pages'
3
3
 
4
4
  steps_for :search_with_pages do
5
5
  include CommonSteps
@@ -0,0 +1,15 @@
1
+ require 'acceptance_test/page_set'
2
+
3
+ require 'pages'
4
+
5
+ class WikipediaPages < PageSet
6
+
7
+ def initialize session
8
+ super session
9
+
10
+ @main_page = Pages::MainPage.new self
11
+
12
+ delegate_to_pages :main_page
13
+ end
14
+
15
+ end
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.9.13
4
+ version: 1.10.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: 2015-02-24 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -237,6 +237,7 @@ files:
237
237
  - features/wikipedia/wikipedia_search.feature
238
238
  - features/wikipedia/wikipedia_search_from_csv.feature
239
239
  - lib/acceptance_test.rb
240
+ - lib/acceptance_test/acceptance_config.rb
240
241
  - lib/acceptance_test/acceptance_test.rb
241
242
  - lib/acceptance_test/cucumber_ext.rb
242
243
  - lib/acceptance_test/diff_tool.rb
@@ -251,30 +252,29 @@ files:
251
252
  - lib/acceptance_test/turnip_ext.rb
252
253
  - lib/acceptance_test/version.rb
253
254
  - lib/tasks/rspec.rake
254
- - spec/acceptance/search_with_config_spec.rb
255
- - spec/acceptance/search_with_drivers_spec.rb
256
- - spec/acceptance/search_with_example_steps_spec.rb
257
- - spec/acceptance/search_with_pages_spec.rb
258
- - spec/acceptance/search_with_steps_spec.rb
259
- - spec/acceptance_config.yml
260
- - spec/data.csv
261
- - spec/data.yml
262
- - spec/features/search_with_drivers.feature
263
- - spec/features/search_with_pages.feature
264
- - spec/features/search_with_scenario_outline1.feature
265
- - spec/features/search_with_scenario_outline2.feature
266
- - spec/features/search_with_scenario_outline3.feature
267
- - spec/features/search_with_scenario_outline4.feature
268
- - spec/features/search_with_table.feature
269
- - spec/support/pages/main_page.rb
270
- - spec/support/pages/wikipedia_pages.rb
255
+ - spec/spec_helper.rb
271
256
  - spec/support/steps/common_steps.rb
272
- - spec/support/steps/search_with_drivers_steps.rb
273
- - spec/support/steps/search_with_pages_steps.rb
274
- - spec/support/steps/search_with_scenario_outline_steps.rb
275
- - spec/support/steps/search_with_table_steps.rb
276
- - spec/test_helper.rb
277
- - spec/turnip_helper.rb
257
+ - spec/wikipedia/acceptance/search_with_config_spec.rb
258
+ - spec/wikipedia/acceptance/search_with_drivers_spec.rb
259
+ - spec/wikipedia/acceptance/search_with_example_steps_spec.rb
260
+ - spec/wikipedia/acceptance/search_with_pages_spec.rb
261
+ - spec/wikipedia/acceptance/search_with_steps_spec.rb
262
+ - spec/wikipedia/acceptance_config.yml
263
+ - spec/wikipedia/data.csv
264
+ - spec/wikipedia/data.yml
265
+ - spec/wikipedia/features/search_with_drivers.feature
266
+ - spec/wikipedia/features/search_with_pages.feature
267
+ - spec/wikipedia/features/search_with_scenario_outline1.feature
268
+ - spec/wikipedia/features/search_with_scenario_outline2.feature
269
+ - spec/wikipedia/features/search_with_scenario_outline3.feature
270
+ - spec/wikipedia/features/search_with_scenario_outline4.feature
271
+ - spec/wikipedia/features/search_with_table.feature
272
+ - spec/wikipedia/support/pages.rb
273
+ - spec/wikipedia/support/steps/search_with_drivers_steps.rb
274
+ - spec/wikipedia/support/steps/search_with_pages_steps.rb
275
+ - spec/wikipedia/support/steps/search_with_scenario_outline_steps.rb
276
+ - spec/wikipedia/support/steps/search_with_table_steps.rb
277
+ - spec/wikipedia/support/wikipedia_pages.rb
278
278
  homepage: http://github.com/shvets/acceptance_test
279
279
  licenses:
280
280
  - MIT
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  version: '0'
296
296
  requirements: []
297
297
  rubyforge_project:
298
- rubygems_version: 2.4.4
298
+ rubygems_version: 2.4.6
299
299
  signing_key:
300
300
  specification_version: 4
301
301
  summary: Simplifies congiguration and run of acceptance tests.
@@ -304,27 +304,26 @@ test_files:
304
304
  - features/wikipedia/support/env.rb
305
305
  - features/wikipedia/wikipedia_search.feature
306
306
  - features/wikipedia/wikipedia_search_from_csv.feature
307
- - spec/acceptance/search_with_config_spec.rb
308
- - spec/acceptance/search_with_drivers_spec.rb
309
- - spec/acceptance/search_with_example_steps_spec.rb
310
- - spec/acceptance/search_with_pages_spec.rb
311
- - spec/acceptance/search_with_steps_spec.rb
312
- - spec/acceptance_config.yml
313
- - spec/data.csv
314
- - spec/data.yml
315
- - spec/features/search_with_drivers.feature
316
- - spec/features/search_with_pages.feature
317
- - spec/features/search_with_scenario_outline1.feature
318
- - spec/features/search_with_scenario_outline2.feature
319
- - spec/features/search_with_scenario_outline3.feature
320
- - spec/features/search_with_scenario_outline4.feature
321
- - spec/features/search_with_table.feature
322
- - spec/support/pages/main_page.rb
323
- - spec/support/pages/wikipedia_pages.rb
307
+ - spec/spec_helper.rb
324
308
  - spec/support/steps/common_steps.rb
325
- - spec/support/steps/search_with_drivers_steps.rb
326
- - spec/support/steps/search_with_pages_steps.rb
327
- - spec/support/steps/search_with_scenario_outline_steps.rb
328
- - spec/support/steps/search_with_table_steps.rb
329
- - spec/test_helper.rb
330
- - spec/turnip_helper.rb
309
+ - spec/wikipedia/acceptance/search_with_config_spec.rb
310
+ - spec/wikipedia/acceptance/search_with_drivers_spec.rb
311
+ - spec/wikipedia/acceptance/search_with_example_steps_spec.rb
312
+ - spec/wikipedia/acceptance/search_with_pages_spec.rb
313
+ - spec/wikipedia/acceptance/search_with_steps_spec.rb
314
+ - spec/wikipedia/acceptance_config.yml
315
+ - spec/wikipedia/data.csv
316
+ - spec/wikipedia/data.yml
317
+ - spec/wikipedia/features/search_with_drivers.feature
318
+ - spec/wikipedia/features/search_with_pages.feature
319
+ - spec/wikipedia/features/search_with_scenario_outline1.feature
320
+ - spec/wikipedia/features/search_with_scenario_outline2.feature
321
+ - spec/wikipedia/features/search_with_scenario_outline3.feature
322
+ - spec/wikipedia/features/search_with_scenario_outline4.feature
323
+ - spec/wikipedia/features/search_with_table.feature
324
+ - spec/wikipedia/support/pages.rb
325
+ - spec/wikipedia/support/steps/search_with_drivers_steps.rb
326
+ - spec/wikipedia/support/steps/search_with_pages_steps.rb
327
+ - spec/wikipedia/support/steps/search_with_scenario_outline_steps.rb
328
+ - spec/wikipedia/support/steps/search_with_table_steps.rb
329
+ - spec/wikipedia/support/wikipedia_pages.rb
@@ -1,17 +0,0 @@
1
- require 'acceptance_test/page'
2
-
3
- class MainPage < Page
4
- def visit_home_page
5
- session.visit('/')
6
- end
7
-
8
- def enter_word word
9
- with_session do
10
- fill_in "searchInput", :with => word
11
- end
12
- end
13
-
14
- def submit_request
15
- session.find(".formBtn", match: :first).click
16
- end
17
- end
@@ -1,21 +0,0 @@
1
- require 'rspec/expectations'
2
- require 'acceptance_test/page_set'
3
-
4
- require 'pages/main_page'
5
-
6
- class WikipediaPages < PageSet
7
- include Capybara::DSL
8
- include RSpec::Matchers
9
-
10
- attr_reader :context
11
-
12
- def initialize session
13
- super session
14
-
15
- @main_page = MainPage.new self
16
-
17
- delegate_to :main_page
18
- end
19
-
20
- end
21
-
@@ -1 +0,0 @@
1
- $: << File.expand_path('spec/support')