You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by John Krasnay <jo...@krasnay.ca> on 2008/08/28 18:23:57 UTC

Ajax testing with Selenium

I'm testing some Ajax-y Wicket pages with Selenium. One challenge I'm
having is finding a good expression to use in Selenium's
waitForCondition. Right now I wait for the results of the Ajax call,
e.g. an appropriate element appearing, but it's sometimes difficult to
get this right, e.g. if a component is being replaced.

I think an ideal approach would be to hook into Wicket's Ajax channels
and wait for them to be empty before proceeding. I've looked into
wicket-ajax.js and it looks like I should be able to loop through
Wicket.channelManager.channels and check the busy slot on each.

Has anyone else tried this? Does it sound like a good approach? Would it
be a good idea for wicket-ajax.js to provide a method for checking this?

jk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax testing with Selenium

Posted by Johan Compagner <jc...@gmail.com>.
Noo.. completely new!? all the bugs reintroduced!

On 8/28/08, Matej Knopp <ma...@gmail.com> wrote:
> Probably not for 1.3/1.4. We could have something like that for 1.5
> (where the ajax pipeline is completely new).
>
> -Matej
>
> On Thu, Aug 28, 2008 at 6:23 PM, John Krasnay <jo...@krasnay.ca> wrote:
>> I'm testing some Ajax-y Wicket pages with Selenium. One challenge I'm
>> having is finding a good expression to use in Selenium's
>> waitForCondition. Right now I wait for the results of the Ajax call,
>> e.g. an appropriate element appearing, but it's sometimes difficult to
>> get this right, e.g. if a component is being replaced.
>>
>> I think an ideal approach would be to hook into Wicket's Ajax channels
>> and wait for them to be empty before proceeding. I've looked into
>> wicket-ajax.js and it looks like I should be able to loop through
>> Wicket.channelManager.channels and check the busy slot on each.
>>
>> Has anyone else tried this? Does it sound like a good approach? Would it
>> be a good idea for wicket-ajax.js to provide a method for checking this?
>>
>> jk
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Ajax testing with Selenium

Posted by Karen Schaper <Ka...@frontiernet.net>.
Hi,

Well sometimes just posting seems to help me get my answer.

I actually found my mistake.  Thanks for posting this great snippet.  It is
working for me now.


selenium.waitForCondition("!selenium.browserbot.getCurrentWindow().wicketAja
xBusy()",
			      "10000");


Doesn't work:

browser.waitForCondition("!browser.browserbot.getCurrentWindow().wicketAjaxB
usy()",
			      "10000");



This works..

browser.waitForCondition("!selenium.browserbot.getCurrentWindow().wicketAjax
Busy()",
			      "10000");



> -----Original Message-----
> From: schapes [mailto:Karen.Schaper@gmail.com]
> Sent: Monday, September 15, 2008 11:30 PM
> To: users@wicket.apache.org
> Subject: Re: Ajax testing with Selenium
>
>
>
> Hi,
>
> I am actually interested.  I tried the following and I can't get
> it to work.
>
> I defined this function below in a foo.js file and have included this js
> file on my page.
>
> Then I make the call below...
>
> selenium.waitForCondition("!selenium.browserbot.getCurrentWindow()
> .wicketAjaxBusy()",
> "10000");
>
>
>  but i get an object expected error.
>
> I am using IE.  Did this work on IE?
>
> Thanks
>
> Karen
>
> If anyone's interested, the following seems to work. Define the
> following script on your page:
>
> wicketAjaxBusy = function() {
>     for (var c in Wicket.channelManager.channels) {
>         if (Wicket.channelManager.channels[c].busy) {
>             Wicket.Log.info("Channel " + c + " is busy");
>             return true;
>         }
>     }
>     Wicket.Log.info("No channels are busy");
>     return false;
> }
>
> To wait for any AJAX calls to return, invoke the following Selenium API:
>
> selenium.waitForCondition("!selenium.browserbot.getCurrentWindow()
> .wicketAjaxBusy()",
> "10000");
>
> jk
>
> On Thu, Aug 28, 2008 at 06:26:09PM +0200, Matej Knopp wrote:
> > Probably not for 1.3/1.4. We could have something like that for 1.5
> > (where the ajax pipeline is completely new).
> >
> > -Matej
> >
> > On Thu, Aug 28, 2008 at 6:23 PM, John Krasnay <jo...@krasnay.ca> wrote:
> > > I'm testing some Ajax-y Wicket pages with Selenium. One challenge I'm
> > > having is finding a good expression to use in Selenium's
> > > waitForCondition. Right now I wait for the results of the Ajax call,
> > > e.g. an appropriate element appearing, but it's sometimes difficult to
> > > get this right, e.g. if a component is being replaced.
> > >
> > > I think an ideal approach would be to hook into Wicket's Ajax channels
> > > and wait for them to be empty before proceeding. I've looked into
> > > wicket-ajax.js and it looks like I should be able to loop through
> > > Wicket.channelManager.channels and check the busy slot on each.
> > >
> > > Has anyone else tried this? Does it sound like a good
> approach? Would it
> > > be a good idea for wicket-ajax.js to provide a method for
> checking this?
> > >
> > > jk
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Ajax-testing-with-Selenium-tp19204133p19504724.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax testing with Selenium

Posted by schapes <Ka...@gmail.com>.
Hi,

I am actually interested.  I tried the following and I can't get it to work.

I defined this function below in a foo.js file and have included this js
file on my page.

Then I make the call below...

selenium.waitForCondition("!selenium.browserbot.getCurrentWindow().wicketAjaxBusy()",
"10000");


 but i get an object expected error.

I am using IE.  Did this work on IE?

Thanks

Karen

If anyone's interested, the following seems to work. Define the
following script on your page:

wicketAjaxBusy = function() {
    for (var c in Wicket.channelManager.channels) {
        if (Wicket.channelManager.channels[c].busy) {
            Wicket.Log.info("Channel " + c + " is busy");
            return true; 
        }
    }
    Wicket.Log.info("No channels are busy");
    return false;
}

To wait for any AJAX calls to return, invoke the following Selenium API:

selenium.waitForCondition("!selenium.browserbot.getCurrentWindow().wicketAjaxBusy()",
"10000");

jk

On Thu, Aug 28, 2008 at 06:26:09PM +0200, Matej Knopp wrote:
> Probably not for 1.3/1.4. We could have something like that for 1.5
> (where the ajax pipeline is completely new).
> 
> -Matej
> 
> On Thu, Aug 28, 2008 at 6:23 PM, John Krasnay <jo...@krasnay.ca> wrote:
> > I'm testing some Ajax-y Wicket pages with Selenium. One challenge I'm
> > having is finding a good expression to use in Selenium's
> > waitForCondition. Right now I wait for the results of the Ajax call,
> > e.g. an appropriate element appearing, but it's sometimes difficult to
> > get this right, e.g. if a component is being replaced.
> >
> > I think an ideal approach would be to hook into Wicket's Ajax channels
> > and wait for them to be empty before proceeding. I've looked into
> > wicket-ajax.js and it looks like I should be able to loop through
> > Wicket.channelManager.channels and check the busy slot on each.
> >
> > Has anyone else tried this? Does it sound like a good approach? Would it
> > be a good idea for wicket-ajax.js to provide a method for checking this?
> >
> > jk
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org




-- 
View this message in context: http://www.nabble.com/Ajax-testing-with-Selenium-tp19204133p19504724.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax testing with Selenium

Posted by John Krasnay <jo...@krasnay.ca>.
OK, I've raised WICKET-1808 to track it.

If anyone's interested, the following seems to work. Define the
following script on your page:

wicketAjaxBusy = function() {
    for (var c in Wicket.channelManager.channels) {
        if (Wicket.channelManager.channels[c].busy) {
            Wicket.Log.info("Channel " + c + " is busy");
            return true; 
        }
    }
    Wicket.Log.info("No channels are busy");
    return false;
}

To wait for any AJAX calls to return, invoke the following Selenium API:

selenium.waitForCondition("!selenium.browserbot.getCurrentWindow().wicketAjaxBusy()",
"10000");

jk

On Thu, Aug 28, 2008 at 06:26:09PM +0200, Matej Knopp wrote:
> Probably not for 1.3/1.4. We could have something like that for 1.5
> (where the ajax pipeline is completely new).
> 
> -Matej
> 
> On Thu, Aug 28, 2008 at 6:23 PM, John Krasnay <jo...@krasnay.ca> wrote:
> > I'm testing some Ajax-y Wicket pages with Selenium. One challenge I'm
> > having is finding a good expression to use in Selenium's
> > waitForCondition. Right now I wait for the results of the Ajax call,
> > e.g. an appropriate element appearing, but it's sometimes difficult to
> > get this right, e.g. if a component is being replaced.
> >
> > I think an ideal approach would be to hook into Wicket's Ajax channels
> > and wait for them to be empty before proceeding. I've looked into
> > wicket-ajax.js and it looks like I should be able to loop through
> > Wicket.channelManager.channels and check the busy slot on each.
> >
> > Has anyone else tried this? Does it sound like a good approach? Would it
> > be a good idea for wicket-ajax.js to provide a method for checking this?
> >
> > jk
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax testing with Selenium

Posted by Matej Knopp <ma...@gmail.com>.
Probably not for 1.3/1.4. We could have something like that for 1.5
(where the ajax pipeline is completely new).

-Matej

On Thu, Aug 28, 2008 at 6:23 PM, John Krasnay <jo...@krasnay.ca> wrote:
> I'm testing some Ajax-y Wicket pages with Selenium. One challenge I'm
> having is finding a good expression to use in Selenium's
> waitForCondition. Right now I wait for the results of the Ajax call,
> e.g. an appropriate element appearing, but it's sometimes difficult to
> get this right, e.g. if a component is being replaced.
>
> I think an ideal approach would be to hook into Wicket's Ajax channels
> and wait for them to be empty before proceeding. I've looked into
> wicket-ajax.js and it looks like I should be able to loop through
> Wicket.channelManager.channels and check the busy slot on each.
>
> Has anyone else tried this? Does it sound like a good approach? Would it
> be a good idea for wicket-ajax.js to provide a method for checking this?
>
> jk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org