Am 22.08.2011 13:27, schrieb Mike Mander:
Am 22.08.2011 09:45, schrieb Mathilde Pellerin:
Hi all,

thanks for your answers.
So, Ajax can be a problem with tagTester. Ok, so I don't use Ajax response
anymore to render my page :

public void testStory23_TA21_VerificationInitialisationBoutonsRadio(){
         Questionnaire questionnaire =
serviceQuestionnaire.findBytitre("Questionnaire pour Femme").get(0);
         CreationQuestionnairePage creationQuestionnairePage = new
CreationQuestionnairePage(
                 new PageParameters("p=2"), questionnaire);
         tester.startPage(creationQuestionnairePage);
         tester.assertRenderedPage(CreationQuestionnairePage.class);

then, I checked my markup by tester.dumpPage() :
<h2>Questionnaires</h2>
<p>
<a href="#" wicket:id="retourRecapitulatif"
id="retourRecapitulatif3" onclick="var
wcall=wicketAjaxGet('?wicket:interface=:0:retourRecapitulatif::IBehaviorListener:0:',function()
{ }.bind(this),function() { }.bind(this), function() {return
Wicket.$('retourRecapitulatif3') != null;}.bind(this));return
!wcall;">Retour à la liste
                     des questionnaires</a>
</p>
<h3>Création d'un nouveau questionnaire :</h3>
<div>
<form wicket:id="formCreationQuestionnaire" method="post"
id="formCreationQuestionnaire4"
action="?wicket:interface=:0:formCreationQuestionnaire::IFormSubmitListener::"
enctype="multipart/form-data"><div
style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input
type="hidden" name="formCreationQuestionnaire4_hf_0"
id="formCreationQuestionnaire4_hf_0" /></div>
<table>
<tr>
<td colspan="2" style="border-bottom:
none;"><span wicket:id="feedback" id="feedback5"><wicket:panel>

</wicket:panel></span>
</td>
</tr>
<tr>
<td><h4>Titre du nouveau questionnaire
:</h4></td>
<td><input type="text" wicket:id="titre"
style="width: 100%;" value="Questionnaire pour Femme" name="titre"/>
</td>
</tr>
<tr>
<td><h4>Numéro :</h4></td>
<td><input type="text" wicket:id="numero"
style="width: 100px;" value="Q2" name="numero"/>
</td>
</tr>
<tr>
<td><h4>Genre des destinataires :</h4></td>
<td>
&nbsp;&nbsp;<input type="radio"
wicket:id="femme" id="femme6" name="genre" value="radio0" checked="checked"
class="wicket-genre7"/>&nbsp; Femme
&nbsp;&nbsp;<input type="radio"
wicket:id="homme" id="homme8" name="genre" value="radio1"
class="wicket-genre7"/>&nbsp; Homme
&nbsp;&nbsp;<input type="radio"
wicket:id="mixte" id="mixte9" name="genre" value="radio2"
class="wicket-genre7"/>&nbsp; Mixte

</td>
</tr>

we can see that radio button with wicket:id="femme" have tag "checked".
But in my test :
         TagTester tagFemme =
tester.getTagByWicketId("formCreationQuestionnaire:genre:femme");
         TagTester tagHomme =
tester.getTagByWicketId("formCreationQuestionnaire:genre:homme");
         TagTester tagMixte =
tester.getTagByWicketId("formCreationQuestionnaire:genre:mixte");
         //tester.debugComponentTrees();
         tester.dumpPage();
         Assert.assertNotNull(tagFemme);

tagFemme is still null.

I checked my path for this radio button with tester.debugComponentTrees() : INFO - BaseWicketTester - path formCreationQuestionnaire:genre
     org.apache.wicket.markup.html.form.RadioGroup     [f]
INFO  - BaseWicketTester           - path
formCreationQuestionnaire:genre:femme
org.apache.wicket.markup.html.form.Radio     [f]
INFO  - BaseWicketTester           - path
formCreationQuestionnaire:genre:homme
org.apache.wicket.markup.html.form.Radio     [h]
INFO  - BaseWicketTester           - path
formCreationQuestionnaire:genre:mixte
org.apache.wicket.markup.html.form.Radio     [b]

I really don't understand what am I doing wrong...

Where is genre? Try

formCreationQuestionnaire:homme

. Did that help?
Mike

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


Ähm sorry for my stupidity but i didn't used this for a long time.
Try to use homme (and other radios) only!!! TagTester is searching for the wicket:id. Parent components are not relevant. So you don't have to provide the complete path.

Sorry,
Mike

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

Reply via email to