Cucumber, webrat mechanize testing php/drupal application on MAMP, authentication issue -
i've got cucumber testing drupal application passing tests so:
given /^i authenticated "([^"]*)" user$/ |role| visit('/user') fill_in "name", :with => "user_#{role.downcase}" fill_in "pass", :with => "password" click_button visit('/') #gets around 302 redirect issue response_body.should contain("log out") end
my env.rb so:
require 'rspec/expectations' require 'webrat' require 'test/unit/assertions' world(test::unit::assertions) webrat.configure |config| config.mode = :mechanize end world session = webrat::session.new session.extend(webrat::methods) session.extend(webrat::matchers) session.visit('http://localhost') session end
this passes fine when virtual host on mamp default localhost. when create virtual host, same document (and update session.visit use new root) test fails. seems session lost.
does know how debug this? i've looked @ html output , shows content unauthenticated user why think session being reset.
edit
checked virtual hosts , same. 1 failing tests tends order of magnitude slower.
i moved capybara. there versions of mechanize had few bugs around posting form data etc. capybara works better.
Comments
Post a Comment