acceptance_test 1.5.5 → 1.6.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/CHANGES +5 -1
- data/Gemfile +4 -1
- data/Gemfile.lock +11 -11
- data/Rakefile +0 -6
- data/features/wikipedia/step_definitions/steps.rb +2 -2
- data/lib/acceptance_test/acceptance_test.rb +57 -140
- data/lib/acceptance_test/driver_manager.rb +138 -0
- data/lib/acceptance_test/{gherkin_helper.rb → gherkin_ext.rb} +2 -5
- data/lib/acceptance_test/page_set.rb +38 -1
- data/lib/acceptance_test/turnip_ext.rb +177 -0
- data/lib/acceptance_test/version.rb +1 -1
- data/lib/tasks/rspec.rake +7 -0
- data/spec/{features/data.csv → data.csv} +0 -0
- data/spec/features/search_with_drivers.feature +4 -3
- data/spec/features/search_with_examples_from_csv.feature +1 -1
- data/spec/features/search_with_pages.feature +13 -0
- data/spec/support/pages/main_page.rb +17 -0
- data/spec/support/{wikipedia/wikipedia_page_set.rb → pages/wikipedia_pages.rb} +8 -5
- data/spec/{features → support}/steps/common_steps.rb +0 -0
- data/spec/{features → support}/steps/search_with_drivers_steps.rb +2 -17
- data/spec/{features → support}/steps/search_with_examples_from_csv_steps.rb +1 -1
- data/spec/support/steps/search_with_pages_steps.rb +37 -0
- data/spec/{features → support}/steps/search_with_table_steps.rb +1 -1
- data/spec/test_helper.rb +1 -0
- data/spec/turnip_helper.rb +8 -9
- data/spec/wikipedia_search_spec.rb +5 -0
- data/spec/wikipedia_search_with_pages_spec.rb +8 -8
- metadata +26 -19
- data/lib/acceptance_test/turnip_helper.rb +0 -76
- data/spec/support/wikipedia/main_page.rb +0 -13
- data/turnip +0 -1
    
        data/spec/test_helper.rb
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            $: << File.expand_path('spec/support')
         | 
    
        data/spec/turnip_helper.rb
    CHANGED
    
    | @@ -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 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
            require  ' | 
| 18 | 
            -
            require  ' | 
| 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 | 
            -
             | 
| 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) {  | 
| 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 | 
            -
                   | 
| 22 | 
            +
                  visit_home_page
         | 
| 23 23 |  | 
| 24 | 
            -
                   | 
| 24 | 
            +
                  enter_word "Capybara"
         | 
| 25 25 |  | 
| 26 | 
            -
                   | 
| 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. | 
| 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- | 
| 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/ | 
| 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/ | 
| 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/ | 
| 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/ | 
| 86 | 
            -
            - spec/ | 
| 87 | 
            -
            - spec/ | 
| 88 | 
            -
            - spec/ | 
| 89 | 
            -
            - spec/support/ | 
| 90 | 
            -
            - spec/support/ | 
| 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/ | 
| 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/ | 
| 132 | 
            -
            - spec/ | 
| 133 | 
            -
            - spec/ | 
| 134 | 
            -
            - spec/ | 
| 135 | 
            -
            - spec/support/ | 
| 136 | 
            -
            - spec/support/ | 
| 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(' ')}"
         |