Well, what I have seems to be working, though I'm still testing and fiddling :
$wnd.gwt_active_calls = {};
$wnd.gwt_active_call_count = 0;
function __on_statevent(statinfo) {
var key = { moduleName: statinfo.moduleName,
subsystem: statinfo.subSystem,
evtGroup: statinfo.evtGroup }
if ($wnd.gwt_active_calls[key]) {
if (statinfo.type == "end") {
$wnd.gwt_active_calls[key] = null;
$wnd.gwt_active_call_count -= 1;
}
}
else {
$wnd.gwt_active_calls[key] = statinfo;
$wnd.gwt_active_call_count += 1;
}
}
$wnd.__gwtStatsEvent =
$wnd.__gwtStatsEvent ? function(a) {
$wnd.gwt_on_statevent(a);
return $wnd.__gwtStatsEvent(a);
}
: function(a) {$wnd.gwt_on_statevent(a);};
Then my selenium code can do stuff like:
def wait_for_ajax
wait_for_condition("selenium.browserbot.getCurrentWindow().wmt_active_call_count
== 0")
end
Hope this helps others. And thanks for all the assistance. :-]
- Korny
On Mon, Feb 23, 2009 at 5:13 PM, Korny Sietsma <[email protected]> wrote:
> Still hoping for help on this!
>
> At the moment my best bet seems to be to implement a version of
> window.__gwtstatsevent() and track all stats events (probably useful
> anyway!) keeping a count of events that have started but not finished.
>
> Though if anyone has any other suggestions they'd be most appreciated
> - I'd prefer to work out a way to hook into the rpc/callback
> mechanism, but it's a pretty complex area to sort out, and as it's all
> coded to interfaces, no obvious place seems to exist to add hooks into
> the actual ajax request/response...
>
> - Korny
>
> On Sat, Feb 21, 2009 at 5:52 PM, Korny Sietsma <[email protected]> wrote:
>> bump - anyone?
>>
>> I've dug through the online docs, but my gwt-fu is limited at this
>> stage. I'd like to get selenium tests up and running as soon as we
>> start writing code... I can always go digging through the javascript,
>> but strangely, the idea doesn't thrill me :)
>>
>> - Korny
>>
>> On Fri, Feb 20, 2009 at 9:05 PM, Korny Sietsma <[email protected]> wrote:
>>> Hi folks!
>>>
>>> My team are starting working in GWT (migrating parts of an old Dojo-based
>>> app)
>>> And while we are looking forward to doing the bulk of our tests in
>>> JUnit, we still want to have high-level specs written in Selenium
>>> (driven from Cucumber, though that's not particularly relevant to my
>>> problem!)
>>>
>>> Is there any way, in Javascript, to detect that all GWT asynchronous
>>> activity has completed? We have hooks for this in Dojo, using code
>>> like:
>>> SeleniumBrowserHelper.getCurrentBrowser().waitForCondition(
>>> "selenium.browserbot.getCurrentWindow().dojo.io.XMLHTTPTransport.inFlight.length
>>> == 0;");
>>>
>>> And there is a similar technique available for Prototype in the latest
>>> Selenium version. But I'm not aware of any way to do this in GWT.
>>>
>>> Note, I know you can test by waiting for specific responses, or
>>> elements becoming visible, or just putting sleeps in - but these tests
>>> can easily get very slow and fragile and hard to write - really, I
>>> want to be able to write tests like:
>>> * click the element named "foo"
>>> * wait for any responses to be delivered from the server
>>> * assert that the element now has a child called "bar"
>>>
>>> Any suggestions?
>>>
>>> Thanks,
>>> - Korny
>>>
>>> --
>>> Kornelis Sietsma korny at my surname dot com
>>>
>>
>>
>>
>> --
>> Kornelis Sietsma korny at my surname dot com
>> kornys on gmail, twitter, facebook, etc.
>> "Every jumbled pile of person has a thinking part
>> that wonders what the part that isn't thinking
>> isn't thinking of"
>>
>
>
>
> --
> Kornelis Sietsma korny at my surname dot com
> kornys on gmail, twitter, facebook, etc.
> "Every jumbled pile of person has a thinking part
> that wonders what the part that isn't thinking
> isn't thinking of"
>
--
Kornelis Sietsma korny at my surname dot com
kornys on gmail, twitter, facebook, etc.
"Every jumbled pile of person has a thinking part
that wonders what the part that isn't thinking
isn't thinking of"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---