Author: ppitonak(a)redhat.com
Date: 2011-01-27 09:52:21 -0500 (Thu, 27 Jan 2011)
New Revision: 21279
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPopupPanel/TestRichPopupPanel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java
Log:
* failing tests fixed
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2011-01-27
14:08:35 UTC (rev 21278)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2011-01-27
14:52:21 UTC (rev 21279)
@@ -231,7 +231,7 @@
}
@Test
- @Use(field = "delay", ints = {600, 1250, 3700})
+ @Use(field = "delay", ints = {800, 1250, 3700})
public void testDelay() {
selenium.type(pjq("input[type=text][id$=delayInput]"),
delay.toString());
selenium.waitForPageToLoad();
@@ -290,6 +290,7 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10048")
public void testImmediate() {
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
@@ -671,7 +672,7 @@
selenium.mouseDown(arrow);
- for (int i = 0; i < 12; i++) {
+ for (int i = 0; i < 14; i++) {
timesSet.add(selenium.getText(time));
waitFor(delta);
}
@@ -686,10 +687,17 @@
}
delta = (long) (delay * 0.5);
- for (int i = 1; i < timesArray.length - 1; i++) {
- long diff = timesArray[i + 1].getTime() - timesArray[i].getTime();
- assertTrue(Math.abs(diff - delay) < delta, "Delay " + diff +
" is too far from set value (" + delay + ")");
+ long average = countAverage(timesArray);
+ assertTrue(Math.abs(average - delay) < delta, "Average delay " +
average + " is too far from set value (" + delay + ")");
+ assertFalse(average < delay, "Average interval " + average + "
cannot be smaller than set value (" + delay + ")");
+ }
+
+ private long countAverage(Date[] times) {
+ long total = 0L;
+ for (int i = 1; i < times.length - 1; i++) {
+ total += (times[i].getTime() - times[i + 1].getTime());
}
+ return Math.abs(total / (times.length - 2));
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java 2011-01-27
14:08:35 UTC (rev 21278)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuGroup/TestRichMenuGroup.java 2011-01-27
14:52:21 UTC (rev 21279)
@@ -49,6 +49,7 @@
public class TestRichMenuGroup extends AbstractMetamerTest {
private JQueryLocator fileMenu = pjq("div[id$=menu1]");
+ private JQueryLocator fileMenuLabel = pjq("div[id$=menu1_label]");
private JQueryLocator fileMenuList = pjq("div[id$=menu1_list]");
private JQueryLocator group = pjq("div[id$=menuGroup4]");
private JQueryLocator groupList = pjq("div[id$=menuGroup4_list]");
@@ -71,7 +72,7 @@
assertFalse(selenium.isVisible(group), "Menu group \"Save As...\"
should not be visible on the page.");
assertFalse(selenium.isDisplayed(fileMenuList), "Menu should not be
expanded.");
- guardNoRequest(selenium).mouseOver(fileMenu);
+ guardNoRequest(selenium).mouseOver(fileMenuLabel);
assertTrue(selenium.isDisplayed(fileMenuList), "Menu should be
expanded.");
assertTrue(selenium.isElementPresent(group), "Menu group \"Save
As...\" should be present on the page.");
@@ -193,7 +194,7 @@
selenium.type(pjq("input[id$=onhideInput]"), "metamerEvents +=
\"hide \"");
selenium.waitForPageToLoad(TIMEOUT);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
waitGui.failWith("Menu was not
open.").until(isDisplayed.locator(fileMenuList));
selenium.mouseOver(group);
waitGui.failWith("Submenu was not
open").until(isDisplayed.locator(groupList));
@@ -247,7 +248,7 @@
selenium.type(pjq("input[id$=onshowInput]"), "metamerEvents +=
\"show \"");
selenium.waitForPageToLoad(TIMEOUT);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
waitGui.failWith("Menu was not
open.").until(isDisplayed.locator(fileMenuList));
selenium.mouseOver(group);
waitGui.failWith("Submenu was not
open").until(isDisplayed.locator(groupList));
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java 2011-01-27
14:08:35 UTC (rev 21278)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java 2011-01-27
14:52:21 UTC (rev 21279)
@@ -55,6 +55,7 @@
public class TestRichMenuItem extends AbstractMetamerTest {
private JQueryLocator fileMenu = pjq("div[id$=menu1]");
+ private JQueryLocator fileMenuLabel = pjq("div[id$=menu1_label]");
private JQueryLocator menuItem1 = pjq("div[id$=menuItem1]");
private JQueryLocator image = menuItem1.getDescendant(jq("img"));
private JQueryLocator label =
menuItem1.getDescendant(jq("span.rf-ddm-itm-lbl"));
@@ -74,7 +75,7 @@
assertTrue(selenium.isElementPresent(menuItem1), "Menu item
\"New\" should be present on the page.");
assertFalse(selenium.isVisible(menuItem1), "Menu item \"New\"
should not be visible on the page.");
- guardNoRequest(selenium).mouseOver(fileMenu);
+ guardNoRequest(selenium).mouseOver(fileMenuLabel);
assertTrue(selenium.isElementPresent(menuItem1), "Menu item
\"New\" should be present on the page.");
assertTrue(selenium.isVisible(menuItem1), "Menu item \"New\"
should be visible on the page.");
@@ -110,7 +111,7 @@
@Test
public void testActionListener() {
String reqTime = selenium.getText(time);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
@@ -124,7 +125,7 @@
selenium.waitForPageToLoad();
String reqTime = selenium.getText(time);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
@@ -146,7 +147,7 @@
selenium.waitForPageToLoad();
String reqTime = selenium.getText(time);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
@@ -175,7 +176,7 @@
selenium.waitForPageToLoad();
String reqTime = selenium.getText(time);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
@@ -232,7 +233,7 @@
selenium.waitForPageToLoad();
String reqTime = selenium.getText(time);
- selenium.mouseOver(fileMenu);
+ selenium.mouseOver(fileMenuLabel);
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPopupPanel/TestRichPopupPanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPopupPanel/TestRichPopupPanel.java 2011-01-27
14:08:35 UTC (rev 21278)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPopupPanel/TestRichPopupPanel.java 2011-01-27
14:52:21 UTC (rev 21279)
@@ -237,7 +237,7 @@
@Test
public void testLeft() {
- double width = Integer.parseInt(selenium.getEval(new
JavaScript("window.document.body.clientWidth")));
+ double width = Integer.parseInt(selenium.getEval(new
JavaScript("window.innerWidth")));
width = (width - 500) / 2;
selenium.click(openButton);
waitGui.failWith("Panel was not
opened.").until(isDisplayed.locator(panel));
@@ -479,10 +479,11 @@
@Test
public void testTop() {
- double top = Integer.parseInt(selenium.getEval(new
JavaScript("window.document.body.clientHeight")));
+ double top = Integer.parseInt(selenium.getEval(new
JavaScript("window.innerHeight")));
top = (top - 300) / 2;
selenium.click(openButton);
waitGui.failWith("Panel was not
opened.").until(isDisplayed.locator(panel));
+ waitFor(6000);
assertEquals(selenium.getElementPositionTop(panelContainer), Math.round(top),
"Top margin of the panel");
selenium.type(pjq("input[id$=topInput]"), "200");
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java 2011-01-27
14:08:35 UTC (rev 21278)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richSelect/TestRichSelect.java 2011-01-27
14:52:21 UTC (rev 21279)
@@ -400,6 +400,7 @@
selenium.focus(input);
selenium.keyPressNative("40"); // arrow down
selenium.keyPressNative("40"); // arrow down
+ waitModel.withDelay(true).failWith("Popup did not
show").until(isDisplayed.locator(popup));
assertTrue(selenium.belongsClass(options.format(0),
"metamer-ftest-class"), "Selected item does not contain defined
class.");
for (int i = 1; i < 50; i++) {