Hi Francois

I found a better way

Tapestry.Initializer.zoneRefresh = function(params)
{
   //  Ensure a valid period. Not required as PeriodicalUpdater already
takes care of it
   // but will will skip unnecessary steps
   if(params.period <= 0)
   {
      return;
   }

   // Function to be called for each refresh
   var keepUpdatingZone = function(e)
   {
      var zoneObject = Tapestry.findZoneManagerForZone($(params.id));
      Tapestry.purgeChildren($(params.id));

      if (!zoneObject)
         return;

      zoneObject.updateFromURL(params.URL);
      e.stop();
   };

   // Create and store the executor
   timer = new PeriodicalExecuter(keepUpdatingZone, params.period);
};

Will send you the full patch with new tests. Thanks for your patience

regards
Taha


2011/7/3 françois facon <[email protected]>

> Thank you Taha,
>
> I would be fine to check the current state of the client pool of ajax
> connections.
> But I'am afraid the condition depend on the way Prototype manage his pool.
> I guess it will failed when T5.ajax (TAP5-999) will be ready to call.
> Gasp!
>
>
> 2011/7/2 Taha Hafeez <[email protected]>:
> > Hi Francois
> > I googled about waitFor... methods and found
> > this http://agilesoftwaretesting.com/?p=111
> > The waitFor methods get messed up as the page that three zones which were
> > refreshing. So, I created two separate tests
> > also i replaced the checkZoneValues() method to
> >    private void checkZoneValues(String zone, int times) throws Exception
> >    {
> >       for(int i = 1; i <= times; ++i)
> >       {
> >          //Wait for ajax call to begin
> >
> >
>  
> waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
> > != 0", "20000");
> >
> >          //Wait for ajax call from end
> >
> >
>  
> waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
> > == 0", "20000");
> >
> >          //Check the value changed
> >          assertText(zone, String.valueOf(i));
> >       }
> >    }
> > It first waits for a ajax call to begin and then waits for it to end and
> > then checks the value. So it will be good enough for even a slow server
> (20
> > seconds wait)
> > Thanks Igor for pointing it out and very very thanks Francois for adding
> > this patch
> > regards
> > Taha
> >
> > 2011/7/2 françois facon <[email protected]>
> >>
> >> Thanks for your advise Igor.
> >> I will change that test.
> >> Regards
> >> François
> >>
> >> 2011/7/2 Igor Drobiazko <[email protected]>:
> >> > It's highly likely that this wait condition will break the build once
> >> > the
> >> > build machine is busy. You should make use of Selenium's wait
> >> > conditions.
> >> > Check out the wait methods like waitForElementToAppear, etc.
> >> >
> >> > On Sat, Jul 2, 2011 at 12:14 PM, <[email protected]> wrote:
> >> >>
> >> >> +
> >> >> +
> >> >> +   private void checkZoneValues(String zone, int times) throws
> >> >> Exception
> >> >> +   {
> >> >> +      Thread.sleep(300);
> >> >> +      for(int i = 0; i < times; ++i)
> >> >> +      {
> >> >> +         assertText(zone, String.valueOf(i));
> >> >> +         Thread.sleep(1000);
> >> >> +      }
> >> >> +   }
> >> >> +
> >> >> +}
> >> >
> >> >
> >> >
> >> > --
> >> > Best regards,
> >> >
> >> > Igor Drobiazko
> >> > http://tapestry5.de
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to