Author: lfryc(a)redhat.com
Date: 2009-09-09 04:46:24 -0400 (Wed, 09 Sep 2009)
New Revision: 15502
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java
Log:
* AbstractSeleniumRichFacesTestCase - add protected Waiting waitForGuiInteraction()
* extendedDataTable/SelectingTestCase - add waiting for GUI rerender when selecting rows
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-09-09
07:45:43 UTC (rev 15501)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-09-09
08:46:24 UTC (rev 15502)
@@ -51,6 +51,8 @@
* predefined waitings to use in inheritors
*/
protected Waiting waitModelUpdate = Wait.interval(100).timeout(10000);
+ protected Waiting waitGuiInteraction = Wait.interval(100).timeout(500);
+
/**
* Initializes context before each class run.
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java 2009-09-09
07:45:43 UTC (rev 15501)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java 2009-09-09
08:46:24 UTC (rev 15502)
@@ -1,26 +1,25 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
-* by the @authors tag. All rights reserved.
-* See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-* This copyrighted material is made available to anyone wishing to use,
-* modify, copy, or redistribute it subject to the terms and conditions
-* of the GNU Lesser General Public License, v. 2.1.
-* This program is distributed in the hope that it will be useful, but WITHOUT A
-* 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,
-* v.2.1 along with this distribution; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-* MA 02110-1301, USA.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
package org.jboss.richfaces.integrationTest.extendedDataTable;
-import static org.testng.Assert.*;
-
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
+import org.jboss.test.selenium.waiting.Condition;
import org.testng.annotations.Test;
/**
@@ -143,19 +142,27 @@
}
private void checkSelection(int[] rows, boolean positiveComparison) {
- String comparison = (positiveComparison) ? "position()=" :
"position()!=";
- String conjuction = (positiveComparison) ? " or " : " and ";
- String condition = " and (" + comparison +
StringUtils.join(ArrayUtils.toObject(rows), conjuction + comparison)
- + ")";
+ final String condition;
if (rows.length == 0) {
condition = "";
+ } else {
+ String comparison = (positiveComparison) ? "position()=" :
"position()!=";
+ String conjuction = (positiveComparison) ? " or " : " and ";
+ condition = " and (" + comparison +
StringUtils.join(ArrayUtils.toObject(rows), conjuction + comparison)
+ + ")";
}
- int count = selenium.getXpathCount(format(LOC_TR_SELECTED, condition)).intValue();
+ final int expectedCount = (positiveComparison) ? rows.length : 0;
- assertTrue(positiveComparison ? count == rows.length : count == 0);
+ waitGuiInteraction.timeout(2000).failWith(
+ "In spite of waiting for GUI rendering finish there is wrong number of selected
rows").until(
+ new Condition() {
+ public boolean isTrue() {
+ return expectedCount == selenium.getXpathCount(format(LOC_TR_SELECTED,
condition)).intValue();
+ }
+ });
}
private int[] getRowSelection(String message) {
Show replies by date