acceptance_test 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGES +5 -1
  3. data/Gemfile +4 -1
  4. data/Gemfile.lock +11 -11
  5. data/Rakefile +0 -6
  6. data/features/wikipedia/step_definitions/steps.rb +2 -2
  7. data/lib/acceptance_test/acceptance_test.rb +57 -140
  8. data/lib/acceptance_test/driver_manager.rb +138 -0
  9. data/lib/acceptance_test/{gherkin_helper.rb → gherkin_ext.rb} +2 -5
  10. data/lib/acceptance_test/page_set.rb +38 -1
  11. data/lib/acceptance_test/turnip_ext.rb +177 -0
  12. data/lib/acceptance_test/version.rb +1 -1
  13. data/lib/tasks/rspec.rake +7 -0
  14. data/spec/{features/data.csv → data.csv} +0 -0
  15. data/spec/features/search_with_drivers.feature +4 -3
  16. data/spec/features/search_with_examples_from_csv.feature +1 -1
  17. data/spec/features/search_with_pages.feature +13 -0
  18. data/spec/support/pages/main_page.rb +17 -0
  19. data/spec/support/{wikipedia/wikipedia_page_set.rb → pages/wikipedia_pages.rb} +8 -5
  20. data/spec/{features → support}/steps/common_steps.rb +0 -0
  21. data/spec/{features → support}/steps/search_with_drivers_steps.rb +2 -17
  22. data/spec/{features → support}/steps/search_with_examples_from_csv_steps.rb +1 -1
  23. data/spec/support/steps/search_with_pages_steps.rb +37 -0
  24. data/spec/{features → support}/steps/search_with_table_steps.rb +1 -1
  25. data/spec/test_helper.rb +1 -0
  26. data/spec/turnip_helper.rb +8 -9
  27. data/spec/wikipedia_search_spec.rb +5 -0
  28. data/spec/wikipedia_search_with_pages_spec.rb +8 -8
  29. metadata +26 -19
  30. data/lib/acceptance_test/turnip_helper.rb +0 -76
  31. data/spec/support/wikipedia/main_page.rb +0 -13
  32. data/turnip +0 -1
@@ -1,6 +1,6 @@
1
1
  steps_for :search_with_table do
2
2
  step "I am within wikipedia.com" do
3
- self.class.include_context "SearchWithTableAcceptanceTest"
3
+ AcceptanceTest.instance.setup
4
4
  end
5
5
 
6
6
  step "I am on wikipedia.com" do
@@ -0,0 +1 @@
1
+ $: << File.expand_path('spec/support')
@@ -4,6 +4,8 @@ require 'active_support/core_ext/hash'
4
4
 
5
5
  require 'acceptance_test'
6
6
 
7
+ require 'test_helper'
8
+
7
9
  acceptance_test = AcceptanceTest.instance
8
10
 
9
11
  # enable external source for gherkin
@@ -12,17 +14,14 @@ data_reader = lambda {|source_path| CSV.read(File.expand_path(source_path)) }
12
14
 
13
15
  acceptance_test.enable_external_source data_reader
14
16
 
15
- # acceptance_test.extend_turnip
16
-
17
- require 'features/steps/search_with_drivers_steps'
18
- require 'features/steps/search_with_examples_from_csv_steps'
19
- require 'features/steps/search_with_table_steps'
20
-
21
- AcceptanceTest.instance.create_shared_context "SearchWithDriversAcceptanceTest"
22
- AcceptanceTest.instance.create_shared_context "SearchWithExamplesFromCsvAcceptanceTest"
23
- AcceptanceTest.instance.create_shared_context "SearchWithTableAcceptanceTest"
17
+ require 'steps/search_with_drivers_steps'
18
+ require 'steps/search_with_pages_steps'
19
+ require 'steps/search_with_examples_from_csv_steps'
20
+ require 'steps/search_with_table_steps'
24
21
 
25
22
  config_name = File.expand_path("spec/acceptance_config.yml")
26
23
  config = HashWithIndifferentAccess.new(YAML.load_file(config_name))
27
24
 
28
25
  acceptance_test.configure config
26
+
27
+ acceptance_test.extend_turnip
@@ -7,10 +7,15 @@ acceptance_test.configure({webapp_url: "http://www.wikipedia.org", timeout_in_se
7
7
  RSpec.describe 'Wikipedia Search' do
8
8
 
9
9
  before do
10
+ acceptance_test.setup
10
11
  puts "Using driver: #{Capybara.current_driver}."
11
12
  puts "Default wait time: #{Capybara.default_wait_time}."
12
13
  end
13
14
 
15
+ after do
16
+ acceptance_test.teardown
17
+ end
18
+
14
19
  it "uses selenium driver", driver: :selenium, exclude: false do
15
20
  visit('/')
16
21
 
@@ -1,16 +1,16 @@
1
+ require 'test_helper'
2
+
1
3
  require 'acceptance_test'
2
4
 
3
5
  acceptance_test = AcceptanceTest.instance
4
- acceptance_test.configure_rspec
5
6
  acceptance_test.configure({webapp_url: "http://www.wikipedia.org", timeout_in_seconds: 10})
7
+ acceptance_test.configure_rspec
6
8
 
7
- $: << File.expand_path('spec/support')
8
-
9
- require 'wikipedia/wikipedia_page_set'
9
+ require 'pages/wikipedia_pages'
10
10
 
11
11
  RSpec.describe 'Wikipedia Search' do
12
12
 
13
- let(:page_set) { WikipediaPageSet.new(page) }
13
+ let(:page_set) { WikipediaPages.new(page) }
14
14
 
15
15
  before do
16
16
  puts "Using driver: #{Capybara.current_driver}."
@@ -19,11 +19,11 @@ RSpec.describe 'Wikipedia Search' do
19
19
 
20
20
  it "searches on wikipedia web site", driver: :selenium do
21
21
  page_set.execute do
22
- visit_page "/"
22
+ visit_home_page
23
23
 
24
- enter_search_request "Capybara"
24
+ enter_word "Capybara"
25
25
 
26
- click_search_button
26
+ submit_request
27
27
 
28
28
  expect(page).to have_content "Hydrochoerus hydrochaeris"
29
29
  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.5.5
4
+ version: 1.6.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-10-09 00:00:00.000000000 Z
11
+ date: 2014-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gemspec_deps_gen
@@ -71,29 +71,33 @@ files:
71
71
  - features/wikipedia/wikipedia_search_from_csv.feature
72
72
  - lib/acceptance_test.rb
73
73
  - lib/acceptance_test/acceptance_test.rb
74
- - lib/acceptance_test/gherkin_helper.rb
74
+ - lib/acceptance_test/driver_manager.rb
75
+ - lib/acceptance_test/gherkin_ext.rb
75
76
  - lib/acceptance_test/page.rb
76
77
  - lib/acceptance_test/page_set.rb
77
78
  - lib/acceptance_test/screenshot_maker.rb
78
- - lib/acceptance_test/turnip_helper.rb
79
+ - lib/acceptance_test/turnip_ext.rb
79
80
  - lib/acceptance_test/version.rb
81
+ - lib/tasks/rspec.rake
80
82
  - spec/acceptance_config.yml
81
- - spec/features/data.csv
83
+ - spec/data.csv
82
84
  - spec/features/search_with_drivers.feature
83
85
  - spec/features/search_with_examples_from_csv.feature
86
+ - spec/features/search_with_pages.feature
84
87
  - spec/features/search_with_table.feature
85
- - spec/features/steps/common_steps.rb
86
- - spec/features/steps/search_with_drivers_steps.rb
87
- - spec/features/steps/search_with_examples_from_csv_steps.rb
88
- - spec/features/steps/search_with_table_steps.rb
89
- - spec/support/wikipedia/main_page.rb
90
- - spec/support/wikipedia/wikipedia_page_set.rb
88
+ - spec/support/pages/main_page.rb
89
+ - spec/support/pages/wikipedia_pages.rb
90
+ - spec/support/steps/common_steps.rb
91
+ - spec/support/steps/search_with_drivers_steps.rb
92
+ - spec/support/steps/search_with_examples_from_csv_steps.rb
93
+ - spec/support/steps/search_with_pages_steps.rb
94
+ - spec/support/steps/search_with_table_steps.rb
95
+ - spec/test_helper.rb
91
96
  - spec/turnip_helper.rb
92
97
  - spec/wikipedia_search_spec.rb
93
98
  - spec/wikipedia_search_with_config_spec.rb
94
99
  - spec/wikipedia_search_with_pages_spec.rb
95
100
  - spec/wikipedia_search_with_steps.rb
96
- - turnip
97
101
  homepage: http://github.com/shvets/acceptance_test
98
102
  licenses:
99
103
  - MIT
@@ -124,16 +128,19 @@ test_files:
124
128
  - features/wikipedia/wikipedia_search.feature
125
129
  - features/wikipedia/wikipedia_search_from_csv.feature
126
130
  - spec/acceptance_config.yml
127
- - spec/features/data.csv
131
+ - spec/data.csv
128
132
  - spec/features/search_with_drivers.feature
129
133
  - spec/features/search_with_examples_from_csv.feature
134
+ - spec/features/search_with_pages.feature
130
135
  - spec/features/search_with_table.feature
131
- - spec/features/steps/common_steps.rb
132
- - spec/features/steps/search_with_drivers_steps.rb
133
- - spec/features/steps/search_with_examples_from_csv_steps.rb
134
- - spec/features/steps/search_with_table_steps.rb
135
- - spec/support/wikipedia/main_page.rb
136
- - spec/support/wikipedia/wikipedia_page_set.rb
136
+ - spec/support/pages/main_page.rb
137
+ - spec/support/pages/wikipedia_pages.rb
138
+ - spec/support/steps/common_steps.rb
139
+ - spec/support/steps/search_with_drivers_steps.rb
140
+ - spec/support/steps/search_with_examples_from_csv_steps.rb
141
+ - spec/support/steps/search_with_pages_steps.rb
142
+ - spec/support/steps/search_with_table_steps.rb
143
+ - spec/test_helper.rb
137
144
  - spec/turnip_helper.rb
138
145
  - spec/wikipedia_search_spec.rb
139
146
  - spec/wikipedia_search_with_config_spec.rb
@@ -1,76 +0,0 @@
1
- require 'singleton'
2
-
3
- require 'turnip/define'
4
-
5
- class TurnipHelper
6
- include Singleton
7
-
8
- def extend_turnip
9
- turnip_define = Turnip::Define
10
-
11
- turnip_define.class_eval do
12
- def before &block
13
- send(:define_method, "before", &block) if block
14
- end
15
-
16
- def after &block
17
- send(:define_method, "after", &block) if block
18
- end
19
- end
20
-
21
- turnip_rspec_execute = Turnip::RSpec::Execute
22
-
23
- turnip_rspec_execute.class_eval do
24
- def run_before rspec_root
25
- self.class.send(:define_method, :rspec_root, lambda { rspec_root })
26
-
27
- before
28
- end
29
-
30
- def run_after rspec_root
31
- self.class.send(:define_method, :rspec_root, lambda { rspec_root })
32
-
33
- after
34
- end
35
- end
36
-
37
- turnip_rspec = Turnip::RSpec
38
-
39
- turnip_rspec.class_eval do
40
- class << self
41
- def run(feature_file)
42
- Turnip::Builder.build(feature_file).features.each do |feature|
43
- ::RSpec.describe feature.name, feature.metadata_hash do
44
- rspec_root = self
45
-
46
- before do
47
- run_before rspec_root
48
- example = Turnip::RSpec.fetch_current_example(self)
49
- # This is kind of a hack, but it will make RSpec throw way nicer exceptions
50
- example.metadata[:file_path] ||= feature_file
51
-
52
- feature.backgrounds.map(&:steps).flatten.each do |step|
53
- run_step(feature_file, step)
54
- end
55
- end
56
- feature.scenarios.each do |scenario|
57
- instance_eval <<-EOS, feature_file, scenario.line
58
- describe scenario.name, scenario.metadata_hash do it(scenario.steps.map(&:to_s).join(' -> ')) do
59
- scenario.steps.each do |step|
60
- run_step(feature_file, step)
61
- end
62
- end
63
- end
64
- EOS
65
- end
66
- after do
67
- run_after rspec_root
68
- end
69
- end
70
- end
71
- end
72
- end
73
- end
74
- end
75
-
76
- end
@@ -1,13 +0,0 @@
1
- class MainPage < Page
2
- def visit_page root
3
- session.visit root
4
- end
5
-
6
- def enter_search_request request
7
- session.fill_in "searchInput", :with => request
8
- end
9
-
10
- def click_search_button
11
- session.find(".formBtn", match: :first).click
12
- end
13
- end
data/turnip DELETED
@@ -1 +0,0 @@
1
- system "bundle exec rspec -r turnip/rspec #{ARGV.join(' ')}"