Hi Stephen,
On Fri, May 30, 2014 at 6:54 PM, Stephen Maina < [email protected]> wrote: > Hi, > > I'm hoping that by sending this email, I will set off a process that will > lead me to the right answer or the right person that can address my > concerns. > > I am trying to work around wicket's magic and be able to have a fully > functional website, running in QA, and be able to expect some level of > sanity or predictability on what wicket will do when it generates the next > set of ids or names or any other markup attribute. > > Wicket works great the way it does (I'm not an authoritative figure in that > respect). The problem that manifests most conspicuously is when you need to > regression test a site. With every refresh of the page, wicket magic > figures out new ids/names. Again, not going into much details, that aspect > alone throws off any recorded script from playing back successfully on a > wicket-backed site. > > I'm sure there's a way that, for testing purposes, this behavior of wicket > can be mitigated. Of course unfortunately, I don't know if it's possible. > So what I'm trying to dig around for is: > > 1. Is there a way that you can configure wicket to behave more "static" if > required to for testing purposes ( static in the sense that it doesn't > change ids and names all the time, or if it doses, it can be in a > predictable manner)? > Yes. See org.apache.wicket.settings.IDebugSettings#setOutputComponentPath(true) Having this enabled Wicket will render an additional attribute to every HTML element that is associated to a Java component. The name of the attribute is 'wicketpath' and the value is the component's path in the current page. If you don't like either the key or the value then you can use custom IComponentInstantiationListener to add a custom Behavior to each component and in this behavior's #onComponent() you can do "tag.put("myKey", generateStableValue(component)); Yet another way is to use 6.16.0-SNAPSHOT that provides API to setup custom IMarkupIdGenerator - https://issues.apache.org/jira/browse/WICKET-5577. > > 2. Would the wicket-magic be impacted by this mitigation, so that a QA site > will behave differently from a PROD site? > You can enable the debug facilities only for the QA system, e.g. by using custom init-param, a config/jvm property, ... > > That for me is a starting point. I would appreciate to hear back from you. > > Regards > > Stephen Maina > > -- > > > IMPORTANT: This e-mail (including any attachments) is intended for the use > of the individual or entity to which it is addressed and may contain > information that is classified, private, or confidential. If the reader of > this message is not the intended recipient, or the employee or agent > responsible for delivering the message to the intended recipient, you are > hereby notified that any dissemination, distribution, or copying of this > communication is prohibited. If you have received this communication in > error, please notify us immediately by replying to this e-mail. Thank you. >
