Search code examples
site-prism

Site Prism: after creating Sections I get a Rack::File argument error deep in the gem code, am I using this wrong?


I get this error when attempting to run cucumber when the site_prism page model is using sections. I had done a simpler page without sections that worked just fine.

Rack::File headers parameter replaces cache_control after Rack 1.5. You should provide section class either as a block, or as the second argument (ArgumentError)

Full Stack Trace:

home/mengen/.rvm/rubies/jruby-1.7.13/bin/jruby -S bundle exec cucumber --format progress -t ~@exclude --profile default Rack::File headers parameter replaces cache_control after Rack 1.5. You should provide section class either as a block, or as the second argument (ArgumentError) /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/site_prism-2.6/lib/site_prism/element_container.rb:173:in extract_section_options' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/site_prism-2.6/lib/site_prism/element_container.rb:21:insection' /home/mengen/projects/cdris_test_ui/features/support/page_models/test_ui_page.rb:4:in TestUIPage' /home/mengen/projects/cdris_test_ui/features/support/page_models/test_ui_page.rb:1:in (root)' org/jruby/RubyKernel.java:1065:in require' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:1:in (root)' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in load_dependency' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' org/jruby/RubyKernel.java:1081:inload' /home/mengen/projects/cdris_test_ui/features/support/cdris_test_ui.rb:6:in (root)' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:1:in (root)' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in load' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in load_dependency' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in load' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/rb_support/rb_language.rb:95:in load_code_file' org/jruby/RubyArray.java:1613:in each' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/runtime/support_code.rb:180:in load_file' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/runtime/support_code.rb:83:in load_files!' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/runtime/support_code.rb:82:in load_files!' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/runtime.rb:184:in load_step_definitions' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/runtime.rb:42:in run!' org/jruby/RubyKernel.java:1081:in load' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/../lib/cucumber/cli/main.rb:47:in execute!' org/jruby/RubyKernel.java:1101:in eval' /home/mengen/.rvm/gems/jruby-1.7.13@cdris_test_ui/gems/cucumber-1.3.17/bin/cucumber:13:in (root)'

Site Prism page model:

class TestUIPage < SitePrism::Page
  set_url Rails.application.routes.url_helpers.documents_retrieve_path
  set_url_matcher /Rails.application.routes.url_helpers.documents_retrieve_path/
  section :validation, 'div#collapseFifteen'
  section :document_set, 'div#collapseFour'
end

class DocumentSetSection < SitePrism::Section
  element :root, 'input#root'
  element :extension, 'input#extension'
  element :submit_button, 'button'
end

class ValidationSection < SitePrism::Section
  element :patient_root, 'input#patient_root'
  element :patient_extension, 'input#patient_extension'
  element :patient_first_name, 'input#patient_first_name'
  element :patient_gender, 'input#patient_gender'
  element :patient_birth_date, 'input#patient_birth_date'
  element :validate_button, 'button#validate_patient_demographics'
end

Solution

  • You left out the model in your section. Here's what you want:

    class TestUIPage < SitePrism::Page
      set_url Rails.application.routes.url_helpers.documents_retrieve_path
      set_url_matcher /Rails.application.routes.url_helpers.documents_retrieve_path/
      section :validation, ValidationSection, 'div#collapseFifteen'
      section :document_set, DocumentSetSection, 'div#collapseFour'
    end