[seam-commits] Seam SVN: r11501 - branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Sep 21 04:03:19 EDT 2009


Author: mgencur at redhat.com
Date: 2009-09-21 04:03:19 -0400 (Mon, 21 Sep 2009)
New Revision: 11501

Modified:
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
Log:
JBPAPP-2829 Numberguess test changed to work with EAP4.3 example version

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java	2009-09-21 07:30:40 UTC (rev 11500)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java	2009-09-21 08:03:19 UTC (rev 11501)
@@ -28,6 +28,7 @@
 import org.jboss.seam.example.common.test.numberguess.selenium.CommonNumberGuessTest;
 import org.testng.annotations.Test;
 
+
 /**
  * 
  * @author Jozef Hartinger
@@ -73,11 +74,28 @@
       browser.waitForPageToLoad(TIMEOUT);
       browser.click(getProperty("CHEAT_YES_BUTTON"));
       browser.waitForPageToLoad(TIMEOUT);
-      number = Integer.parseInt(browser.getText(getProperty("CHEAT_NUMBER")));
+      number = Integer.parseInt(extractNumber(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());
    }
+   
+   public String extractNumber(String str) {	    
+	    if (str == null) {
+	        return null;
+	    }
 
+	    StringBuffer strBuff = new StringBuffer();
+	    char c;
+	    
+	    for (int i = 0; i < str.length() ; i++) {
+	        c = str.charAt(i);
+	        
+	        if (Character.isDigit(c)) {
+	            strBuff.append(c);
+	        }
+	    }
+	    return strBuff.toString();
+	}
 }

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties	2009-09-21 07:30:40 UTC (rev 11500)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties	2009-09-21 08:03:19 UTC (rev 11501)
@@ -31,6 +31,6 @@
 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
+CHEAT_YES_BUTTON xpath\=//input[@type\='submit'][@value\='Yes']
+CHEAT_NUMBER xpath\=//form/text()[contains(.,'answer')]
+CHEAT_DONE_BUTTON xpath\=//input[@type\='submit'][@value\='Done']



More information about the seam-commits mailing list