Commit Graph

643 Commits

Author SHA1 Message Date
Simon Rozet 0a2b77c9c4 Require rack in lib/webrat.rb 2009-06-26 01:42:51 +02:00
Simon Rozet 6cda9c79b4 Implement Webrat::MIME on top of Rack::Mime 2009-06-26 01:39:22 +02:00
Simon Rozet 3760867d0f Implement file uploading for :rack 2009-06-25 23:41:51 +02:00
Simon Rozet f2882ef8b2 Deprecate :rack_test 2009-06-25 22:41:05 +02:00
Simon Rozet a5a91b32e9 Deprecate the :sinatra mode
* I took the conservative approach here: the sinatra code could
  be removed but that'd cause a regression. (using Sinatra::Application
  when `app` is not defined)

* I left the sinatra tests for now; they should be removed
  once we're fully confident with rack session ones.
2009-06-25 00:38:39 +02:00
Simon Rozet 042268c6a6 Simplify Methods#webrat_adapter
It is unecessary to have a special case for the :rack mode.
2009-06-25 00:07:38 +02:00
Simon Rozet f2b3b9891b Refactor Webrat::Session
* Webrat::Session.new now take a session adapter class as it's argument and
  delegates methods such as #response_body and #response_code to an instance
  of it.

* Some of these methods will go away in the future. However, *a lot*
  of specs depends on them so I've left them for now. The plan is to
  strip down the session adapter API to these three methods:

    * request
    * response_code
    * response_body

* I had to mark a spec as pending: spec/private/rails/rails_session_spec.rb
2009-06-25 00:07:30 +02:00
Damian Janowski cbc447223c Fix form fields being double-escaped with :rack
Signed-off-by: Simon Rozet <simon@rozet.name>
2009-06-24 18:57:55 +02:00
Simon Rozet 8cda77318c Fix wrong HTTP_HOST in rack session
Webrat relies on www.example.com while Rack::Test expects example.org
2009-06-24 18:57:38 +02:00
Simon Rozet 92ec1c3d92 Require rack/test in rack session 2009-06-24 15:14:08 +02:00
Simon Rozet 0a3b979772 Rename :rack_test mode to :rack 2009-06-24 15:13:27 +02:00
Simon Rozet 3e7886ecab Get rid of RackSession
Looks like dead code
2009-06-24 15:13:16 +02:00
Bryan Helmkamp 5eeceff9e8 Removing some vestigial code from Merb session 2009-06-17 00:19:26 -04:00
Ryan Carver c11f4868a9 Don't require merb-core/two-oh for multipart support. Instead, copy the code into Webrat 2009-06-17 00:06:32 -04:00
Bryan Helmkamp 28f19616d6 Wait for app server to boot on 0.0.0.0 instead of application_address
application_address is used to know where Selenium should navitate to,
but we always are booting app servers on 0.0.0.0 so that's where we
should verify they exist
2009-06-16 17:44:42 -04:00
Mike Gaffney 0c9944c4d8 Merge commit 'eddd97936'
Conflicts:
	spec/integration/rails/test/integration/webrat_test.rb
2009-06-15 22:40:02 -05:00
Bryan Helmkamp 9a42304513 Revert "make label location strategy work with unescaped strings"
This reverts commit 4daf037146.

This was causing failures in the Weplay selenium suite, where we
we're using partial matches. For example:

  fill_in "Write a message", ...

When the markup was:

  <label>Write a message to Bryan ...</label>
2009-06-15 17:59:13 -04:00
Bryan Helmkamp 9b971a15c0 Require English so we can use $LAST_MATCH_INFO instead of $~ 2009-06-15 00:08:25 -04:00
Bryan Helmkamp 45e19867d6 Merge commit 'manveru/dev' into ruby19
Conflicts:
	lib/webrat/core/elements/field.rb
2009-06-14 23:31:42 -04:00
Bryan Helmkamp 6231e6e4d1 Merge commit 'pdcawley/master' 2009-06-14 21:58:18 -04:00
Bryan Helmkamp d620e66bd8 Use Launchy to handle opening pages in the browser with cross-platform compatibility 2009-06-14 21:38:04 -04:00
Bryan Helmkamp 3bc2d4d1b8 Merge commit 'rcarver/merb-uploads' 2009-06-14 21:18:47 -04:00
Jakub Kuźma 8b98540aef Ruby 1.9 compatibility: Avoid calling #to_s on Arrays
[#249 state:resolved]
2009-06-14 21:05:38 -04:00
Erin Staniland b75ff6221b Added missing quote from rewrite_css_and_image_references and added support for single quotes 2009-06-14 21:01:06 -04:00
Bryan Helmkamp 78a23abb6e Merge commit 'dchelimsky/rspec-fix' 2009-06-14 20:54:02 -04:00
Michael Fellinger 8d2c027089 Fix replacing of &nbsp;, aka &#160; so it works on 1.9 2009-06-07 17:03:13 +09:00
Michael Fellinger 520081c93e Don't use $LAST_MATCH_INFO since we don't require English.rb, use $~ instead 2009-06-07 17:02:32 +09:00
Michael Fellinger 48a4ec905e Make sure Field#escaped_value also works when @value is an Array on 1.9 2009-06-07 16:45:19 +09:00
Michael Fellinger 9134b09b87 Make mechanize_session_spec pass on 1.9 2009-06-07 16:34:35 +09:00
Mike Gaffney 6bfdcc54cc Fixed Spec in Test Unit more thoroghly 2009-06-05 13:51:55 -05:00
Mike Gaffney dd8688f371 moved application_server to appservers/base 2009-06-04 15:19:05 -05:00
Mike Gaffney 1910204974 refactor>moved the app servers to a directory 2009-06-04 15:13:54 -05:00
Mike Gaffney 6d74cd935e [#246 state:resolved] added external application server if you have your own started 2009-06-04 15:03:00 -05:00
Mike Gaffney a6a4a7cfd9 moving app server lookup out into a factory 2009-06-04 14:44:06 -05:00
Mike Gaffney f3a12adaa9 whitespace changes 2009-06-04 12:18:31 -05:00
Mike Gaffney 977f643dca catches spec failed exception again 2009-06-03 18:49:32 -05:00
Mike Gaffney abac2023bc removed reference to Rspec from common code 2009-06-03 17:53:19 -05:00
mike.gaffney b2c423c49c [#50 state:resolved] added deprecation warning 2009-06-03 10:01:27 -05:00
Thomas Jack 4daf037146 make label location strategy work with unescaped strings 2009-06-02 18:31:33 -05:00
Thomas Jack 57326e5846 Merge branch 'master' of git://github.com/brynary/webrat 2009-06-02 17:52:14 -05:00
mike.gaffney f8f254d517 [#257 state:resolved] fixed issue with rails encodd fields in webrat 2009-06-02 17:35:29 -05:00
mike.gaffney 2704609224 added clicking link by title in selenium mode 2009-06-01 12:26:37 -05:00
mike.gaffney b85aacae1c From larrytheliquid
Merge commit '4d05a2cf2b2de34dda0a3e805ab11b60540578df'
2009-06-01 11:59:21 -05:00
Matthias Marschall 6cd734aec9 made selenium integration tests run applying larrytheliquid's patch: 627913708c 2009-05-29 17:05:35 -05:00
Matthias Marschall 73dc59cc29 click_button in selenium works now same as in headless mode 2009-05-29 17:05:34 -05:00
Josh Lubaway 846a90e561 Passing TextField values as plaintext to Mechanize.
Mechanize takes input as plaintext and escapes field values on its own.
If the values are escaped before they are passed to Mechanize, the values will be escaped twice.

These doubly-escaped values will result in incorrect behavior on the server side.
2009-05-29 10:42:30 -07:00
Larry Diehl 4d05a2cf2b click_link matches anchor id's with Selenium 2009-05-28 23:23:09 -07:00
Larry Diehl 627913708c Made Selenium Rails integration tests at least runnable, although
there are failures.
2009-05-28 22:40:52 -07:00
mike.gaffney f6b0a763a0 Merge branch 'lh_194_delegate_field_named' of git://github.com/pivotal/webrat into lh194
Conflicts:
	lib/webrat/core/methods.rb
2009-05-28 18:01:53 -05:00
Piers Cawley 58601c4653 Make Webrat::Core::Session#redirect? work in the face of rational maths.
Such as when someone uses `ruby-units' and suddenly 302/100 becomes 151/50.
2009-05-27 12:35:36 +01:00
Thomas Jack 956b43d72c Merge branch 'master' of git://github.com/brynary/webrat 2009-05-19 14:24:41 -05:00
mike.gaffney fd431f2ce8 [#242 state:resolved]
allowed changing the default timeout for browser startup in selenium
2009-05-18 16:37:45 -05:00
Mike Gaffney f342142a71 Merge commit 'snusnu/master' 2009-05-13 23:12:32 -05:00
Luke Amdor 7f13a70b4b Added current_url to SeleniumSession to have the same api for both sessions 2009-05-13 22:33:20 -05:00
Thomas Jack db9c5bdc77 Merge branch 'master' of git://github.com/brynary/webrat 2009-05-13 14:34:16 -05:00
snusnu 77168fd29d only require silence_stream if active_support hasn't already defined it 2009-05-13 05:01:19 +02:00
snusnu 926bcc6c66 extracted silence_stream into its own file under webrat/selenium
I don't think silence_stream.rb should be stored under
core_extensions, because the way it's implemented, it simply is
no core extension. Also, a grep through webrat source shows that
silence_stream is only used inside the selenium support. This is
why I added webrat/selenium/silence_stream.rb and require it
*before* all other selenium related files in webrat/selenium.rb.
It's necessary to include it this early, because if mode is set
to :selenium, webrat/selenium.rb is required, which in turn
requires webrat/selenium/selenium_session.rb and silence_stream
must be available before selenium_session gets required because
selenium_session already wants to silence the stream.
2009-05-13 03:35:32 +02:00
snusnu bfa250e7af Provide an implementation for silence_stream inside webrat.
I added the implementation to webrat/core/configuration.rb because
it seems to me that this always gets read first. I decided to put
it inside a util module Webrat::SilentStream and include this where
appropriate, instead of altering Kernel.
2009-05-12 18:32:30 +02:00
Bryan Helmkamp b439d7f807 Revert "Canonicalize all URLs (Shalon Wood)"
This reverts commit 755cf6e508.
2009-05-11 16:48:28 -04:00
Thomas Jack 8bedf2235d Merge branch 'master' of git://github.com/brynary/webrat 2009-05-11 00:29:49 -05:00
Bryan Helmkamp 453cb4b3eb Stripping whitespace 2009-05-11 01:27:04 -04:00
Bryan Helmkamp 35cbfd9643 Use Nokogiri on JRuby -- ~2x faster than REXML on JRuby for me 2009-05-11 00:13:00 -04:00
Bryan Helmkamp b5254109f1 Start on Rack::Test integration 2009-05-11 00:12:27 -04:00
Bryan Helmkamp 755cf6e508 Canonicalize all URLs (Shalon Wood) 2009-05-11 00:12:27 -04:00
Thomas Jack 9a3668be92 match descendents in have_selector/have_xpath blocks 2009-04-29 01:33:26 -05:00
David Chelimsky ffb56aab90 config for rspec in one line 2009-04-27 11:54:46 -05:00
Mutwin Kraus eddd979361 Fixed following of internal redirects when using a custom Host header
Webrat didn't properly follow internal redirects when using the Host
  header, this lets Webrat check the Host header before falling back
  to www.example.com as the current_host.
2009-04-24 23:49:11 -07:00
Ryan Carver 1a110fe908 Improve forward and backward compatibility for Merb uploads 2009-04-24 14:23:00 -07:00
Ryan Carver 09509025c3 Allow Merb to do file uploads 2009-04-24 13:56:28 -07:00
Zach Dennis 7c08390bb8 Updated regex for LabelLocator and FieldLabeledLocator to work with labels whose text ends in a non-word character like \? or # 2009-04-16 12:25:45 -05:00
Noah Davis ff42db076f Select fields with duplicate selected options sent an incorrect value 2009-04-11 13:19:59 -04:00
Bryan Helmkamp 03914fd293 Whitespace 2009-04-07 20:30:12 -04:00
Bryan Helmkamp 6697ecd2d3 Prep for 0.4.4 release 2009-04-06 14:03:58 -04:00
Bryan Helmkamp 996484c890 Refactoring selenium RC and app server boot code 2009-04-06 14:02:09 -04:00
Bryan Helmkamp 644478f6f0 Merge commit 'MarkMenard/master' 2009-04-06 12:39:31 -04:00
Bryan Helmkamp 91ea8cfa54 Make selenium process management code more robust and informative 2009-04-06 12:33:24 -04:00
Bryan Helmkamp 304baeb754 Change default app environment from "selenium" to "test" 2009-04-06 12:33:24 -04:00
Bryan Helmkamp aa9049953d Bump selenium-client dependency to 1.2.14 2009-03-29 16:35:27 -04:00
Balint Erdi cd49c2d939 bugfix: selenium's wait_for_element method takes the number of seconds before timing out from an option hash
Signed-off-by: Balint Erdi <balint.erdi@gmail.com>
2009-03-29 15:57:14 -04:00
pivotal 0fe3998f64 field_named correctly delegated 2009-03-17 18:21:06 -04:00
Bryan Helmkamp e2a672a767 Prep 0.4.3 release 2009-03-17 01:26:38 -04:00
Mark Menard 0c2261d869 Add support for Rails javascript post links. 2009-03-12 15:42:20 -04:00
Mark Menard 73f4c441c1 Merge commit 'upstream/master' 2009-03-12 15:41:37 -04:00
Bryan Helmkamp d1a2c80ab8 Merge commit 'sr/sinatra' into sr_sinatra 2009-03-08 18:54:21 -04:00
Simon Rozet 90baf3311c Sinatra now provides sensible options for testing
In the lastest release, 0.9.1:

* Set sensible defaults on Default for test env [1]
  5a33a9586f

* Set :environment to :test in TestHarness
  9af37724e0

* Set :environment to :test when Sinatra::Test is included
  93b19a3492

[1] Only Sinatra::Default provides special options for testing. If you subclass
    Sinatra::Base, you'll have to set them yourself.

foo
2009-03-08 23:41:34 +01:00
Bryan Helmkamp 5dc24c613e Merge branch 'master' into sr_sinatra 2009-03-08 14:59:54 -04:00
Mark Menard c647ae98bb Memoize WWW::Mechanize instance. 2009-03-05 17:45:56 -05:00
Luke Melia 72123c1cec When faced with a label with no for attribute, that contains a hidden field and another field, as can be the case in Rails 2.3's checkbox view, webrat now locates the non-hidden field. 2009-03-01 01:44:35 -05:00
Matthew Ford 740bb293e3 Fix for #161 When using Rails 2.3 it uses Rack::Utils to parse params 2009-02-28 23:08:07 -05:00
Simon Rozet 4e07f5b654 Fix following of absolute redirect URL in Sinatra
What's going on when the app redirects to an absolute URL?

* Sinatra relies on Rack::MockSession which sets SERVER_NAME to
  "example.org" [1] on request it makes. However, Webrat expects
  it to be "www.example.com"

* In MyClassyApp, the redirect URL is made out of Rack::Request#url [2]
  which uses  SERVER_NAME, which is set to "example.org" by Rack::MockSession.
  As a result, Webrat see it as an external redirect and don't follow it.

NOTE:

* SERVER_NAME is stricly equivalent to HTTP_HOST [3]
* This could have been fixed in Webrat::Session too. I'am not sure
  that it won't affect other frameworks so I left it intact.

      def request_page(url, http_method, data) #:nodoc:
         h = headers
         h['HTTP_REFERER'] = @current_url if @current_url
  +      h['HTTP_HOST']    = 'www.example.com'

[1] 5c00dd698e/lib/rack/mock.rb (L79)
[2] 5c00dd698e/lib/rack/request.rb (L201)
[3] 5c00dd698e/lib/rack/request.rb (L72)
2009-02-28 03:30:26 +01:00
Simon Rozet 7d7c32256d Support for "modular" Sinatra app style
Since Sinatra 0.9, apps can be ancapsulated in a class ("modular" style)
or be on the top level, just like before ("classic" style)

* http://wiki.github.com/brynary/webrat/sinatra
* http://www.sinatrarb.com/extensions.html
2009-02-28 03:30:25 +01:00
Bryan Helmkamp 4115c99c9b Merge branch 'master' into atmos 2009-02-27 20:41:05 -05:00
Bryan Helmkamp b7e0d6f8e6 Prep for 0.4.2 release 2009-02-24 12:29:05 -05:00
Bryan Helmkamp e32a208b7f Fix warning caused by Nokogiri deprecating CSS::Parser.parse (Aaron Patterson) [#176 state:resolved] 2009-02-23 22:19:02 -05:00
Bryan Helmkamp aec889a14d Always deal with one query selector (a String, not an Array) 2009-02-23 22:14:58 -05:00
Bryan Helmkamp 18c60f4e51 Refactoring XPath manipulation 2009-02-23 20:52:17 -05:00
Bryan Helmkamp 29c40bd73c Pulling attribute conditions up from have_selector to have_xpath 2009-02-23 20:47:02 -05:00
Bryan Helmkamp 1625e3e9ba Pulling :content functionality up from have_selector into have_xpath 2009-02-23 20:22:36 -05:00
Bryan Helmkamp a688c28b19 Extracting xpath_escape method 2009-02-23 20:21:23 -05:00
Bryan Helmkamp 9761b64b60 Pulling :count option up from have_selector to have_xpath 2009-02-23 20:18:36 -05:00