Salut Julien,
sorry, i didn't have any practise with testing javascript alerts up til now.
So this is my html-code:
</form id="javascript-alert">
<button type="button" id="alert" onclick="alert('Alert!')">alert</button>
</form>
and this is my test code:
assertTextPresent("ButtonTest");
setExpectedJavaScriptAlert("Alert!");
clickButtonWithText("alert");
and this is the result:
junit.framework.AssertionFailedError: You previously tell that alert with
message [Alert!] was expected, but nothing appeared.
at junit.framework.Assert.fail(Assert.java:47)
this looks like "minimal code for reproduction" to me ;-)
Seems like a general problem with executing javascript. At least if i didn't do
anything wrong ...
Greetings,
Dirk.
[->] Dirk Jerusalem
Quality Software Engineer & Service Engineer
Research & Development
[->] abaXX Technology AG
Forststr. 7 · 70174 Stuttgart · Germany
Phone: +49 1805 222-994
Fax: +49 1805 222-993
Mail: [EMAIL PROTECTED] <blocked::blocked::mailto:[EMAIL PROTECTED]>
Surf~In: support.abaXX.de <blocked::blocked::http://support.abaxx.de/>
Web: www.abaXX.de <blocked::blocked::http://www.abaxx.de/>
________________________________
abaXX startet "Initiative für eXXcellence":
Mit dieser Initiative stellt die abaXX Technology AG ihr Ziel, signifikante
Beiträge zur Steigerung der Leistungsfähigkeit und Wettbewerbsstärke von
Unternehmen und Institutionen zu liefern, noch deutlicher in den Mittelpunkt
ihres Handelns. Dazu dienen die innovativen BPM- und Portal-Lösungen von abaXX
und ein umfangreiches Dienstleistungsangebot ergänzt durch ein Netzwerk
spezialisierter Partner. Weitere Informationen finden Sie unter
www.abaXX.de/eXXcellence. <http://www.abaxx.de/eXXcellence>
________________________________
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese
E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail
ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
________________________________
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julien HENRY
Gesendet: Mittwoch, 24. Januar 2007 16:30
An: Usage problems for JWebUnit
Betreff: [JWebUnit-users] Re : Re : Re : stuck with <button>
JavaScript alert function don't open a window. You should test alert boxes with
setExpectedJavascriptAlert("message") before clicking the button.
----- Message d'origine ----
De : Dirk Jerusalem <[EMAIL PROTECTED]>
À : Usage problems for JWebUnit <[email protected]>
Envoyé le : Mercredi, 24 Janvier 2007, 15h37mn 43s
Objet : Re: [JWebUnit-users] Re : Re : stuck with <button>
I did do this. Because jWebUnit wasn't able to find a resulting window with all
assertWindowPresent*() i debugged it and the list of childWindows was empty.
So I think the onclick was never executed.
[->] Dirk Jerusalem
Quality Software Engineer & Service Engineer
Research & Development
[->] abaXX Technology AG
Forststr. 7 · 70174 Stuttgart · Germany
Phone: +49 1805 222-994
Fax: +49 1805 222-993
Mail: [EMAIL PROTECTED]
Surf~In: support.abaXX.de
Web: www.abaXX.de
________________________________
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julien HENRY
Gesendet: Mittwoch, 24. Januar 2007 13:48
An: Usage problems for JWebUnit
Betreff: [JWebUnit-users] Re : Re : stuck with <button>
Perhaps the Javascript in the onclick event is not executed. Could you try to
write a simple test with an alert box on the onclick event?
++
Julien
----- Message d'origine ----
De : Dirk Jerusalem <[EMAIL PROTECTED]>
À : Usage problems for JWebUnit <[email protected]>
Envoyé le : Mercredi, 24 Janvier 2007, 12h33mn 15s
Objet : Re: [JWebUnit-users] Re : stuck with <button>
Well,
generally clickButtonWithText() seems to work.
But in some important cases within my application that i have to test it
doesn't.
for example when trying to logout from this page:
<form action="/abxadmin/-" method="post" id="login-status" class="login"
name="login-status">
<script type="text/javascript">Form_hookup('login-status');</script>
You are logged in as user <b>system</b>.
<p>
<div class="buttons"><button type="button"
onclick="submitEvent('login-status', 'logout', true,
this)">Logout</button></div>
</p>
<input type="hidden" name="$part"
value="AdminCommon.Welcome.index.login-status" />
<input type="hidden" name="$event$" />
</form>
When using:
public void logout() throws Exception {
clickLinkWithText("English");
assertTextPresent("You are logged in as user");
setWorkingForm("login-status");
clickButtonWithText("Logout");
assertTextPresent("User Login");
assertFormPresent("login");
}
it seems that clickButtonWithText works because it does not throw any exception
or something else. But the logout event does not execute. I am still on the
same page.
Any suggestions?
Greetings,
Dirk.
________________________________
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julien HENRY
Gesendet: Dienstag, 23. Januar 2007 19:10
An: Usage problems for JWebUnit
Betreff: [JWebUnit-users] Re : stuck with <button> and <textarea>
Hi Dirk,
What about clickButtonWithText() ?
Concerning TextArea, I will take a look on it.
++
Julien
----- Message d'origine ----
De : Dirk Jerusalem <[EMAIL PROTECTED]>
À : Usage problems for jWebUnit <[email protected]>
Envoyé le : Mardi, 23 Janvier 2007, 17h15mn 34s
Objet : [JWebUnit-users] stuck with <button> and <textarea>
Hi jWebUnit-Users,
I'm stuck with <button>-tags. They normally have their description in the body,
and in my case they have neither attribute "id" nor "value".
So I tried with XPath.
I used this little html-code:
<html>
<body>
<h1>ButtonTest</h1><br>
<form>
<p>
<textarea id="textfeld" cols="20" rows="4" name="textfeld"></textarea>
<button type="button" id="Text1" value="Text2" name="Text1"
onclick="this.form.textfeld.value='Text 1 und rückwärts seltsam geschrieben ich
bin.'">Text1</button>
<button type="button" id="Text2" value="Text2" name="Text2"
onclick="this.form.textfeld.value='Ich bin Text 2 - ganz normal'">Text2</button>
</p>
</form>
</body>
</html>
so I could try using clickButton, clickButtonWithText and clickElementByXPath:
public void testButtonWithXPath()
{
assertTextPresent("ButtonTest");
assertElementPresentByXPath("//button[text()='Text1'");
clickElementByXPath("//button[text()='Text1'");
assertTextPresent("Text 1 und rückwärts seltsam geschrieben ich bin.");
clickElementByXPath("//button[text()='Text2'");
assertTextPresent("Ich bin Text 2 - ganz normal");
}
public void testButtonWithID()
{
assertTextPresent("ButtonTest");
clickButton("Text1");
assertTextInElement("textfeld", "Text 1 und rückwärts seltsam geschrieben ich
bin.");
clickButton("Text2");
assertTextInElement("textfeld", "Ich bin Text 2 - ganz normal");
}
public void testButtonWithValue()
{
assertTextPresent("ButtonTest");
clickButtonWithText("Text1");
assertTextInElement("textfeld", "Text 1 und rückwärts seltsam geschrieben ich
bin.");
clickButtonWithText("Text2");
assertTextInElement("textfeld", "Ich bin Text 2 - ganz normal");
}
testButtonWithXPath() can not find the button. I don't know why. I checked it
with the Firefox plugin "XPath Checker" which found it that way.
Anyway I wondered why there is no function to check the body of buttons? This
would be valuable for jWebUnit-users, or did I miss some other simple way?
But with this demo I realized that neither assertTextPresent nor
assertTextInElement or assertTextFieldEquals are able to get the text out of
the textarea ...
How can I do this?
Thanx for any help in advance,
Dirk.
[->] Dirk Jerusalem
Quality Software Engineer & Service Engineer
Research & Development
[->] abaXX Technology AG
Forststr. 7 · 70174 Stuttgart · Germany
Phone: +49 1805 222-994
Fax: +49 1805 222-993
Mail: [EMAIL PROTECTED]
Surf~In: support.abaXX.de
Web: www.abaXX.de
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur
Yahoo! Questions/Réponses
<http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com> .
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur
Yahoo! Questions/Réponses
<http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com> .
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur
Yahoo! Questions/Réponses
<http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com> .
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users