[seam-commits] Seam SVN: r9903 - in trunk: examples/numberguess/view and 23 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Jan 9 09:34:27 EST 2009
Author: jharting
Date: 2009-01-09 09:34:27 -0500 (Fri, 09 Jan 2009)
New Revision: 9903
Added:
trunk/src/test/ftest/examples/drools/
trunk/src/test/ftest/examples/drools/build.xml
trunk/src/test/ftest/examples/drools/jboss.xml
trunk/src/test/ftest/examples/drools/src/
trunk/src/test/ftest/examples/drools/src/org/
trunk/src/test/ftest/examples/drools/src/org/jboss/
trunk/src/test/ftest/examples/drools/src/org/jboss/seam/
trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/
trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/
trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/
trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/selenium/
trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/selenium/drools.properties
trunk/src/test/ftest/examples/numberguess/
trunk/src/test/ftest/examples/numberguess/build.xml
trunk/src/test/ftest/examples/numberguess/jboss-embedded.xml
trunk/src/test/ftest/examples/numberguess/jboss.xml
trunk/src/test/ftest/examples/numberguess/src/
trunk/src/test/ftest/examples/numberguess/src/org/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/
trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/selenium/
trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/selenium/CommonNumberGuessTest.java
Modified:
trunk/examples/drools/view/numberGuess.jsp
trunk/examples/numberguess/view/numberGuess.jspx
trunk/src/test/ftest/build.xml
Log:
JBSEAM-3690 Added tests for drools and numberguess examples.
Modified: trunk/examples/drools/view/numberGuess.jsp
===================================================================
--- trunk/examples/drools/view/numberGuess.jsp 2009-01-09 11:58:06 UTC (rev 9902)
+++ trunk/examples/drools/view/numberGuess.jsp 2009-01-09 14:34:27 UTC (rev 9903)
@@ -7,20 +7,20 @@
<body>
<h1>Guess a number...</h1>
<f:view>
- <h:form>
+ <h:form id="NumberGuessMain">
<h:outputText value="Higher!" rendered="#{randomNumber>guess.value}" />
<h:outputText value="Lower!" rendered="#{randomNumber<guess.value}" />
<br />
- I'm thinking of a number between <h:outputText value="#{game.smallest}" /> and
- <h:outputText value="#{game.biggest}" />.
+ I'm thinking of a number between <h:outputText id="Smallest" value="#{game.smallest}" /> and
+ <h:outputText id="Biggest" value="#{game.biggest}" />.
<br />
Your guess:
- <h:inputText value="#{guess.value}" id="guess" required="true">
+ <h:inputText value="#{guess.value}" id="inputGuess" required="true">
<f:validateLongRange
maximum="#{game.biggest}"
minimum="#{game.smallest}"/>
</h:inputText>
- <h:commandButton type="submit" value="Guess" action="guess" />
+ <h:commandButton id="GuessButton" type="submit" value="Guess" action="guess" />
<br/>
<h:message for="guess" style="color: red"/>
</h:form>
Modified: trunk/examples/numberguess/view/numberGuess.jspx
===================================================================
--- trunk/examples/numberguess/view/numberGuess.jspx 2009-01-09 11:58:06 UTC (rev 9902)
+++ trunk/examples/numberguess/view/numberGuess.jspx 2009-01-09 14:34:27 UTC (rev 9903)
@@ -31,7 +31,7 @@
</div>
<div>
- I'm thinking of a number between <h:outputText id="Smalles" value="#{numberGuess.smallest}"/> and
+ I'm thinking of a number between <h:outputText id="Smallest" value="#{numberGuess.smallest}"/> and
<h:outputText id="Biggest" value="#{numberGuess.biggest}"/>. You have
<h:outputText id="RemainingGuesses" value="#{numberGuess.remainingGuesses}"/> guesses.
</div>
Modified: trunk/src/test/ftest/build.xml
===================================================================
--- trunk/src/test/ftest/build.xml 2009-01-09 11:58:06 UTC (rev 9902)
+++ trunk/src/test/ftest/build.xml 2009-01-09 14:34:27 UTC (rev 9903)
@@ -52,6 +52,7 @@
<!-- Execute tests for all examples jboss-->
<testexample name="blog" />
<testexample name="booking" />
+ <testexample name="drools" />
<testexample name="dvdstore" />
<testexample name="contactlist" />
<testexample name="groovybooking" />
@@ -59,6 +60,7 @@
<testexample name="icefaces" />
<testexample name="jpa" />
<testexample name="nestedbooking" />
+ <testexample name="numberguess" />
<testexample name="quartz" />
<testexample name="seampay" />
<testexample name="spring" />
@@ -72,6 +74,7 @@
<!-- Execute tests for all examples on jboss-embedded -->
<testexample name="blog" />
<testexample name="dvdstore" />
+ <testexample name="numberguess" />
<testexample name="seampay" />
<testexample name="booking" />
<testexample name="jpa" />
@@ -121,6 +124,7 @@
<target name="cleanall">
<cleanexample name="blog" />
<cleanexample name="booking" />
+ <cleanexample name="drools" />
<cleanexample name="dvdstore" />
<cleanexample name="contactlist" />
<cleanexample name="groovybooking" />
@@ -128,6 +132,7 @@
<cleanexample name="icefaces" />
<cleanexample name="jpa" />
<cleanexample name="nestedbooking" />
+ <cleanexample name="numberguess" />
<cleanexample name="quartz" />
<cleanexample name="seampay" />
<cleanexample name="spring" />
@@ -137,6 +142,7 @@
<target name="undeployall">
<undeployexample name="blog" />
<undeployexample name="booking" />
+ <undeployexample name="drools" />
<undeployexample name="dvdstore" />
<undeployexample name="contactlist" />
<undeployexample name="groovybooking" />
@@ -144,6 +150,7 @@
<undeployexample name="icefaces" />
<undeployexample name="jpa" />
<undeployexample name="nestedbooking" />
+ <undeployexample name="numberguess" />
<undeployexample name="quartz" />
<undeployexample name="seampay" />
<undeployexample name="spring" />
Added: trunk/src/test/ftest/examples/drools/build.xml
===================================================================
--- trunk/src/test/ftest/examples/drools/build.xml (rev 0)
+++ trunk/src/test/ftest/examples/drools/build.xml 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="drools.ftest.build" basedir="." default="build">
+ <property name="example.name" value="drools"/>
+ <property name="jboss.deploy.target" value="deploy"/>
+ <property name="jboss.undeploy.target" value="undeploy"/>
+ <property name="jboss.example.ready.check.url" value="seam-drools/numberGuess.seam"/>
+
+ <import file="../build.xml" />
+</project>
Property changes on: trunk/src/test/ftest/examples/drools/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/drools/jboss.xml
===================================================================
--- trunk/src/test/ftest/examples/drools/jboss.xml (rev 0)
+++ trunk/src/test/ftest/examples/drools/jboss.xml 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,32 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Drools example" verbose="2" parallel="false">
+ <test name="drools_jboss">
+ <parameter name="PROPERTY_FILE" value="/org/jboss/seam/example/drools/test/selenium/drools.properties" />
+ <parameter name="CONTEXT_PATH" value="/seam-drools" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.common.test.numberguess.selenium.CommonNumberGuessTest" />
+ </classes>
+ </test>
+</suite>
\ No newline at end of file
Property changes on: trunk/src/test/ftest/examples/drools/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/selenium/drools.properties
===================================================================
--- trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/selenium/drools.properties (rev 0)
+++ trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/selenium/drools.properties 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,29 @@
+ #
+ # JBoss, Home of Professional Open Source
+ # Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ # by the @authors tag. See the copyright.txt in the distribution for a
+ # full listing of individual contributors.
+ #
+ # This is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU Lesser General Public License as
+ # published by the Free Software Foundation; either version 2.1 of
+ # the License, or (at your option) any later version.
+ #
+ # This software is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ # Lesser General Public License for more details.
+ #
+ # You should have received a copy of the GNU Lesser General Public
+ # License along with this software; if not, write to the Free
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ #
+MAIN_PAGE /numberGuess.seam
+GUESS_LOCATION numberGuess.seam
+WIN_LOCATION win.seam
+LOSE_LOCATION lose.seam
+GUESS_MAX_VALUE NumberGuessMain:Biggest
+GUESS_MIN_VALUE NumberGuessMain:Smallest
+GUESS_FIELD NumberGuessMain:inputGuess
+GUESS_SUBMIT NumberGuessMain\:GuessButton
\ No newline at end of file
Property changes on: trunk/src/test/ftest/examples/drools/src/org/jboss/seam/example/drools/test/selenium/drools.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/numberguess/build.xml
===================================================================
--- trunk/src/test/ftest/examples/numberguess/build.xml (rev 0)
+++ trunk/src/test/ftest/examples/numberguess/build.xml 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="numberguess.ftest.build" basedir="." default="build">
+ <property name="example.name" value="numberguess"/>
+ <property name="jboss.deploy.target" value="deploy"/>
+ <property name="jboss.undeploy.target" value="undeploy"/>
+ <property name="jboss.example.ready.check.url" value="seam-numberguess/numberGuess.seam"/>
+ <property name="jboss-embedded.deploy.target" value="tomcat.deploy"/>
+ <property name="jboss-embedded.undeploy.target" value="tomcat.undeploy"/>
+ <property name="jboss-embedded.example.ready.check.url" value="jboss-seam-numberguess/numberGuess.seam"/>
+
+ <import file="../build.xml" />
+</project>
Property changes on: trunk/src/test/ftest/examples/numberguess/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/numberguess/jboss-embedded.xml
===================================================================
--- trunk/src/test/ftest/examples/numberguess/jboss-embedded.xml (rev 0)
+++ trunk/src/test/ftest/examples/numberguess/jboss-embedded.xml 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,32 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Numberguess example" verbose="2" parallel="false">
+ <test name="numberguess_jboss-embedded">
+ <parameter name="PROPERTY_FILE" value="/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties" />
+ <parameter name="CONTEXT_PATH" value="/jboss-seam-numberguess" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.numberguess.test.selenium.NumberGuessTest" />
+ </classes>
+ </test>
+</suite>
\ No newline at end of file
Property changes on: trunk/src/test/ftest/examples/numberguess/jboss-embedded.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/numberguess/jboss.xml
===================================================================
--- trunk/src/test/ftest/examples/numberguess/jboss.xml (rev 0)
+++ trunk/src/test/ftest/examples/numberguess/jboss.xml 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,32 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Numberguess example" verbose="2" parallel="false">
+ <test name="numberguess_jboss">
+ <parameter name="PROPERTY_FILE" value="/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties" />
+ <parameter name="CONTEXT_PATH" value="/seam-numberguess" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.numberguess.test.selenium.NumberGuessTest" />
+ </classes>
+ </test>
+</suite>
\ No newline at end of file
Property changes on: trunk/src/test/ftest/examples/numberguess/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
===================================================================
--- trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java (rev 0)
+++ trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.numberguess.test.selenium;
+
+import java.text.MessageFormat;
+import static org.testng.AssertJUnit.fail;
+import static org.testng.AssertJUnit.assertTrue;
+
+import org.jboss.seam.example.common.test.numberguess.selenium.CommonNumberGuessTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class NumberGuessTest extends CommonNumberGuessTest
+{
+
+ @Override
+ protected void enterGuess(int guess)
+ {
+ if (browser.isElementPresent(getProperty("GUESS_FIELD")))
+ {
+ // using input text field
+ super.enterGuess(guess);
+ }
+ else
+ {
+ if (browser.isElementPresent(getProperty("GUESS_MENU")))
+ {
+ // using menu
+ browser.select(getProperty("GUESS_MENU"), String.valueOf(guess));
+ }
+ else if (browser.isElementPresent(getProperty("GUESS_RADIO")))
+ {
+ // using radio buttons
+ int min = Integer.parseInt(browser.getText(getProperty("GUESS_MIN_VALUE")));
+ int radio = guess - min;
+ browser.check(MessageFormat.format(getProperty("GUESS_RADIO_ITEM"), radio));
+ } else {
+ fail("Unable to enter guess. No input found.");
+ }
+ browser.click(getProperty("GUESS_SUBMIT"));
+ browser.waitForPageToLoad(TIMEOUT);
+ }
+ }
+
+ @Test
+ public void cheatingTest() {
+ int number;
+
+ browser.click(getProperty("CHEAT_BUTTON"));
+ browser.waitForPageToLoad(TIMEOUT);
+ browser.click(getProperty("CHEAT_YES_BUTTON"));
+ browser.waitForPageToLoad(TIMEOUT);
+ number = Integer.parseInt(browser.getText(getProperty("CHEAT_NUMBER")));
+ browser.click(getProperty("CHEAT_DONE_BUTTON"));
+ browser.waitForPageToLoad(TIMEOUT);
+ enterGuess(number);
+ assertTrue("User should win when cheating. Random number was " + number, isOnWinPage());
+ }
+
+}
Property changes on: trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
===================================================================
--- trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties (rev 0)
+++ trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,36 @@
+ #
+ # JBoss, Home of Professional Open Source
+ # Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ # by the @authors tag. See the copyright.txt in the distribution for a
+ # full listing of individual contributors.
+ #
+ # This is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU Lesser General Public License as
+ # published by the Free Software Foundation; either version 2.1 of
+ # the License, or (at your option) any later version.
+ #
+ # This software is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ # Lesser General Public License for more details.
+ #
+ # You should have received a copy of the GNU Lesser General Public
+ # License along with this software; if not, write to the Free
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ #
+MAIN_PAGE /numberGuess.seam
+GUESS_LOCATION numberGuess.seam
+WIN_LOCATION win.seam
+LOSE_LOCATION lose.seam
+GUESS_MAX_VALUE NumberGuessMain:Biggest
+GUESS_MIN_VALUE NumberGuessMain:Smallest
+GUESS_FIELD NumberGuessMain:inputGuess
+GUESS_MENU NumberGuessMain:selectGuessMenu
+GUESS_RADIO NumberGuessMain:selectGuessRadio
+GUESS_RADIO_ITEM NumberGuessMain:selectGuessRadio:{0}
+GUESS_SUBMIT NumberGuessMain:GuessButton
+CHEAT_BUTTON NumberGuessMain:CheatButton
+CHEAT_YES_BUTTON confirm:YesButton
+CHEAT_NUMBER cheat:RandomNumber
+CHEAT_DONE_BUTTON cheat\:DoneButton
\ No newline at end of file
Property changes on: trunk/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/selenium/CommonNumberGuessTest.java
===================================================================
--- trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/selenium/CommonNumberGuessTest.java (rev 0)
+++ trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/selenium/CommonNumberGuessTest.java 2009-01-09 14:34:27 UTC (rev 9903)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.common.test.numberguess.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.*;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class CommonNumberGuessTest extends SeamSeleniumTest
+{
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + getProperty("MAIN_PAGE"));
+ browser.waitForPageToLoad(TIMEOUT);
+ }
+
+ @Test
+ public void smartTest()
+ {
+
+ int min;
+ int max;
+ int guess;
+ int i = 0;
+
+ while (browser.getLocation().contains(getProperty("GUESS_LOCATION")))
+ {
+ if (i > 9)
+ {
+ fail("Game should not be longer than 10 guesses");
+ }
+ min = Integer.parseInt(browser.getText(getProperty("GUESS_MIN_VALUE")));
+ max = Integer.parseInt(browser.getText(getProperty("GUESS_MAX_VALUE")));
+ guess = min + ((max - min) / 2);
+ enterGuess(guess);
+ i++;
+ }
+ assertTrue("Win page expected after playing smart.", isOnWinPage());
+ }
+
+ @Test
+ public void linearTest()
+ {
+ int guess = 0;
+
+ while (browser.getLocation().contains(getProperty("GUESS_LOCATION")))
+ {
+ enterGuess(++guess);
+ assertTrue("Guess count exceeded.", guess <= 10);
+ }
+ if (guess < 10)
+ {
+ assertTrue("Player should not lose before 10th guess.", isOnWinPage());
+ }
+ else
+ {
+ assertTrue("After 10th guess player should lose or win.", isOnLosePage() || isOnWinPage());
+ }
+
+ }
+
+ protected void enterGuess(int guess)
+ {
+ browser.type(getProperty("GUESS_FIELD"), String.valueOf(guess));
+ browser.click(getProperty("GUESS_SUBMIT"));
+ browser.waitForPageToLoad(TIMEOUT);
+ }
+
+ protected boolean isOnWinPage()
+ {
+ return browser.getLocation().contains(getProperty("WIN_LOCATION"));
+ }
+
+ protected boolean isOnLosePage()
+ {
+ return browser.getLocation().contains(getProperty("LOSE_LOCATION"));
+ }
+
+}
Property changes on: trunk/src/test/ftest/src/main/org/jboss/seam/example/common/test/numberguess/selenium/CommonNumberGuessTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the seam-commits
mailing list