Commit Graph

24 Commits

Author SHA1 Message Date
Joe Ferris 79088c2282 Fix reset crash when replies are destroyed
We attempted to track in-progress replies and abort them in 1.5.1.
However, sometimes these replies are destroyed unexpectedly, so
attempting to abort them raises errors.

This commit tracks when replies are destroyed and removes them from the
queue of in-progress replies.
2015-06-05 13:29:26 -04:00
Joe Ferris f8f2048500 Fix native alerts from Ajax requests
If an Ajax request finished after a `reset` triggered an alert, a native
alert pops up. Additionally, the next request to the driver after the
native alert will crash the webkit process.
2015-04-23 10:15:37 -04:00
Joe Ferris 3804dd5406 Introduce allowed, blocked URL filters
* Adds `allow_url`, `block_url`, and `block_unknown_url` methods.
* Both allow_url and block_url accept wildcards.
* Any requests to blocked URLs will be blocked immediately.
* Blocked URLs take precedence over allowed URLs.
* By default, any requests to localhost and 127.0.0.1 are allowed.
* By default, any requests to unknown hosts will print a warning.
* `block_unknown_urls` causes unknown hosts to be silently blocked.
* `blacklisted_urls=` is deprecated in favor of `block_url`.
2014-12-05 12:48:03 -05:00
Joe Ferris 82d0d6fcc9 Extract handle classes from NetworkAccessManager
NetworkAccessManager was getting pretty complex, and adding something
that modifies or intercepts requests is becoming a common change.

This change introduces a chain of handlers which can modify a request or
return a response of their own.

To start with, this extracts the concerns of fixing missing content
types, setting custom headers, and intercepting blacklisted requests.
2014-11-24 09:52:34 -05:00
Joe Ferris e0172bfcd9 Update for Capybara 2.3.0
This adds support for the full Capybara 2.3.0 API. There are two known
incompatibilities:

* Selenium supports outerWidth and outerHeight, which we cannot, because we
  dont' have an actual OS window.
* Selenium raises errors after interacting with a closed window. We focus the
  next available window after closing.

This commit adds the following:

* Implement Driver#close_window
* Implement Driver#current_window_handle
* Implement Driver#maximize_window
* Implement Driver#open_new_window
* Implement Driver#no_such_window_error
* Implement Driver#resize_window_to
* Implement Driver#switch_to_window
* Implement Driver#window_size
* Implement Driver#go_back
* Implement Driver#go_forward
* Support change events when clearing a text input
* Support setting contentEditable elements
* Support window.close() in JavaScript
* Don't return text from hidden elements
* Skip Capybara specs which use outerWidth, outerHeight
* Don't use Qt object ownership to manage windows
2014-07-01 20:36:42 -04:00
Matthew Horan be22bfe244 Share the NetworkAccessManager across WebPages
Destroying the NetworkAccessManager seems to result in "terminate called
without an active exception" segfaults. The documentation states that an
application requires only a single single NetworkAccessManager.
2013-03-18 08:14:35 -04:00
Matthew Horan 91a18aef1f Back the logger with a QFile
Previously all messages were written to a string which grew unbounded
when logging was disabled.
2013-01-15 22:40:20 -05:00
Matthew Horan b28452e8ac Emit loadStarted and pageFinished on WebPage state change
Instead of emitting loadStarted when a reply is created and pageFinished
when all pending replies have finished, emit these signals when the
corresponding WebPage events fire.
2012-12-05 21:05:11 -05:00
Matthew Horan 5bef33624c Don't wait for finished replies
Synchronous requests will have emitted the finished signal by the time
we connect to it.
2012-12-04 00:24:43 -05:00
Matthew Horan cbb58d05f1 Revert "Revert "Add configurable timeouts to commands.""
This reverts commit b1b3a4c390.
2012-10-24 07:55:29 -04:00
Matthew Horan b1b3a4c390 Revert "Add configurable timeouts to commands."
This reverts commit da93136a9c.

Conflicts:
	src/TimeoutCommand.cpp
2012-10-23 23:24:42 -04:00
Joe Ferris cae5119eef Fix issues with Qt 4.8 2012-10-23 21:00:50 -04:00
Sean Geoghegan da93136a9c Add configurable timeouts to commands.
Timeouts can be set using browser.timeout = <seconds>.
When a command or page load takes longer the specified
timeout a Capybara::TimeoutError will be raised. Calls
to reset! will reset the timeout. You can also clear
the timeout by setting it to -1.

The timeout is implemented as a Command decorator.
2012-07-18 20:27:44 -07:00
Joe Ferris d9b18985e1 Command to enable a more useful debug log 2012-07-08 09:01:26 -07:00
Matthew Mongeau 784b9b7f63 Setup multi-window sync. 2012-06-29 10:43:50 -04:00
Matthew Horan 58e6a25398 Shared cookie jar for all windows 2012-06-21 23:34:51 -04:00
Matthew Horan 126411337e Close new windows on reset 2012-05-29 22:23:02 -04:00
Matthew Horan d154a65fe8 Use the foreach macro to iterate through pages 2012-05-29 22:23:02 -04:00
Matthew Horan 8f8c95d980 New windows should respect ignore_ssl_errors 2012-05-29 22:23:02 -04:00
Matthew Horan bfbda84141 Move window change handling into WebPageManager 2012-05-29 22:23:02 -04:00
Matthew Horan 82f84fbde1 WebPageManager is no longer a singleton 2012-05-29 22:23:02 -04:00
Matthew Horan fe46eaf50d Implement window_handles and window_handle for proper window switching 2012-05-29 22:20:10 -04:00
Matthew Horan 468bec886f Return to the first window after yield 2012-05-25 21:09:41 -04:00
Matthew Horan efa577c3f0 First pass at within_window support 2012-05-25 21:09:41 -04:00