On Mon, Feb 15, 2010 at 11:14 PM, Douglas Ferguson <[email protected]> wrote: > > On Feb 16, 2010, at 12:34 AM, Igor Vaynberg wrote: > >> On Mon, Feb 15, 2010 at 8:08 PM, Douglas Ferguson >> <[email protected]> wrote: >>> Hey, >>> >>> I'm starting to write selenium tests for my wicket app and am running into >>> issues with a couple of wicket related problems that I thought perhaps >>> somebody else may have solved. >>> >>> 1) Sometimes my repeaters don't print out consistent wicket paths, i.e. >>> sometimes it may go element_path_name_1 to element_path_name_4 if I have >>> 4 elements.. Other times it might be element_path_name_4 to >>> element_path_name_7 after some ajax calls, I'm not sure when/why this >>> happens. Need to play with it more. >> >> there is an option to output wicket:path attribute for tags. this attr >> will contain page-relative path of the component which should be more >> stable then the id. if you want to have stable ids then you should >> manage them yourself using setmarkupid() > > I am using the wicket path already. The problem is that the wicket path seems > to change.. The examples above I'm referring to the wicket path of my > repeater. > It seems to normally give the elements a number from 1 - n, tacked onto the > wicket path of the root component of the repeater. > Sometimes after some ajax calls, it seems to renumber them.. i.e. instead of > 1-4 it becomes 4-7 or something...
the path in repeaters is never stable, it depends on a lot of factors and is hard to predict. i think what may be a good way to deal with it is to use an IComponentInstantiationListener to add a behavior to Item subclasses to output their index in some attribute. install this listener only during test time or simply make it output nothing if not during the test. >>> 2) I have issues with timing which is typical, and most people call >>> "waitForPageToLoad" which works fine for normal http requests, but if It is >>> an ajax request I'm waiting for, then I have to implement a >>> waitForContition. Is there a wicket convention I could use here? i.e. how >>> can I know that a wicket ajax call has completed? >> >> there are global ajax callbacks that are invoked when an ajax request >> completes. you can search this list for what they are. i imagine you >> can write a bit of javascript to hook into those and implement >> waitForCondition. > > I'm actually using the window.wicketGlobalPreCallHandler and > window.wicketGlobalPostCallHandler in my code already. > Do you think it would be safe to use those? I.E. preHander sets a boolean > "isWaitingOnAjax" and postHander unsets it? > > Then I can do a waitForConition(!isWaitingOnAjax) yeah, that sounds like a good starting point. -igor > >> >> when you get all this working maybe you can create a wiki page about >> it to help users who will have the same questions in the future. > > Sounds good... > >> >> -igor >> >> >>> >>> Thanks, >>> >>> D/ >>> --------------------------------------------------------------------- >>> 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
