Re: Replacing Test::WWW::Selenium::Catalyst with Gtk3::WebKit

On Tue, Nov 22, 2011 at 16:49, Stefan Seifert <nine detonation org> wrote:

I'm trying to replace Test::WWW::Selenium::Catalyst using Gtk3::Webkit and
Test::WWW::Mechanize::Catalyst. Main goal is to avoid the lengthy Selenium
Server and Firefox startup when running tests but it would also be nice to be
able to run tests in parallel more easily. Even with randomized port numbers,
the Selenium server fails to start up sometimes.

I got asked a few times about replacing Selenium with Gtk3::WebKit, so
your efforts will be appreciated.

A quick hack got me pretty far but now I'm stuck trying to get AJAX requests
to work. I'm able to satisfy all other requests by hooking into the 'resource-
request-starting' signal, getting the result with
Test::WWW::Mechanize::Catalyst and give it back to WebKit as a data: URI.
I think that you should be able to rewrite the contents of the soup
message or at least you should be able to do a redirect if you can to
a different URL.
For this you will need to load HTTP::Soup so that you have libsoup
bindings loaded through introspection.

Unfortunately, one cannot make AJAX requests to data: URIs. Instead I tried to
change the request to a POST to a simple HTTP Echo service, but for example I
cannot find out how to set the content-type of the HTTP request. There does
not seem to be a write accessor for that property.
Can you give me more info/input on what's happening and what your
program is trying to accomplish?

So does anyone have ideas, advice or experience in this area? I guess as a
last resort, I will fork out and answer requests in a separate process via a
real HTTP request. But doing it in-process would let us get rid of quite a few
difficulties in writing tests for asynchronous interfaces...
I think that what's needed is to play with Soup messages and to swap
their content or do a proper redirect. I believe that libsoup allows
us to do this kind of things.

Emmanuel Rodriguez

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]