@@ -125,7 +125,9 @@ public class TestLayoutClickListeners extends AbstractReindeerTestUIWithLog { | |||
gl.addComponent(l); | |||
} | |||
for (int i = nr; i < nr * 2; i++) { | |||
gl.addComponent(new TextField("This is tf" + i, "this is tf " + i)); | |||
TextField tf = new TextField("This is tf" + i, "this is tf " + i); | |||
tf.setWidth("130px"); | |||
gl.addComponent(tf); | |||
} | |||
} | |||
@@ -29,10 +29,9 @@ public class DateTimeFieldEventOrderTest extends SingleBrowserTest { | |||
.findElements(By.tagName("select")); | |||
Select select = new Select(timeSelects.get(0)); | |||
// select two different times to ensure a value change happens | |||
select.selectByValue("09"); | |||
// selecting is flaky, try index selection too to ensure selection | |||
// actually happens | |||
select.selectByIndex(9); | |||
select.selectByValue("08"); | |||
findElement(By.id("test-button")).click(); | |||
waitUntil(new ExpectedCondition<Boolean>() { |
@@ -52,8 +52,9 @@ public class GridEditRowTest extends MultiBrowserTest { | |||
private void assertEditorWithinGrid() { | |||
GridEditorElement editor = grid.getEditor(); | |||
assertThat(editor.getLocation().y + editor.getSize().height, | |||
not(greaterThan(grid.getLocation().y + grid.getSize().height))); | |||
// allow 1px leeway | |||
assertThat(editor.getLocation().y + editor.getSize().height, not( | |||
greaterThan(grid.getLocation().y + grid.getSize().height + 1))); | |||
} | |||
@Test |
@@ -23,9 +23,10 @@ public class UpdateComponentWithinExpandRatioTest extends MultiBrowserTest { | |||
button.click(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
// allow small discrepancies | |||
assertEquals("Button's position changed unexpectedly", initialX, | |||
button.getLocation().getX()); | |||
button.getLocation().getX(), 5); | |||
assertEquals("ProgressBar's width changed unexpectedly", initialWidth, | |||
pb.getSize().getWidth()); | |||
pb.getSize().getWidth(), 5); | |||
} | |||
} |
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import com.vaadin.testbench.elements.CheckBoxElement; | |||
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest; | |||
@@ -23,7 +23,9 @@ public class GridLayoutRegErrorTest extends BaseLayoutRegErrorTest { | |||
assertEquals(3, checkBoxes.size()); | |||
CheckBoxElement lastCheckBox = checkBoxes.get(2); | |||
new Actions(driver).moveToElement(lastCheckBox).build().perform(); | |||
// moveToElement fails on Firefox since the component is out of viewport | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastCheckBox); | |||
compareScreen("RegError-Scrolled"); | |||
} |
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import com.vaadin.testbench.elements.HorizontalLayoutElement; | |||
import com.vaadin.tests.layouts.layouttester.BaseIconTest; | |||
@@ -25,9 +25,12 @@ public class HIconTest extends BaseIconTest { | |||
HorizontalLayoutElement lastOfRow1 = layouts.get(3); | |||
HorizontalLayoutElement lastOfRow2 = layouts.get(7); | |||
// scroll to both to ensure both contents are fully in view | |||
new Actions(driver).moveToElement(lastOfRow1).build().perform(); | |||
new Actions(driver).moveToElement(lastOfRow2).build().perform(); | |||
// scroll to both to ensure both contents are fully in view, | |||
// moveToElement fails on Firefox since the component is out of viewport | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastOfRow1); | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastOfRow2); | |||
compareScreen("icon-scrolled"); | |||
} |
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import com.vaadin.testbench.elements.HorizontalLayoutElement; | |||
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest; | |||
@@ -29,18 +29,25 @@ public class HLayoutRegErrorTest extends BaseLayoutRegErrorTest { | |||
HorizontalLayoutElement lastOfRow1 = layouts.get(4); | |||
HorizontalLayoutElement lastOfRow2 = layouts.get(9); | |||
// scroll to both to ensure both contents are fully in view | |||
new Actions(driver).moveToElement(group3row1).build().perform(); | |||
new Actions(driver).moveToElement(group3row2).build().perform(); | |||
// scroll to both to ensure both contents are fully in view, | |||
// moveToElement fails on Firefox since the component is out of viewport | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", group3row1); | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", group3row2); | |||
// scroll back to get the previous group at the left edge | |||
new Actions(driver).moveToElement(group2row1).build().perform(); | |||
new Actions(driver).moveToElement(group2row2).build().perform(); | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", group2row1); | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", group2row2); | |||
compareScreen("RegError-Scrolled-Middle"); | |||
// scroll to last ones | |||
new Actions(driver).moveToElement(lastOfRow1).build().perform(); | |||
new Actions(driver).moveToElement(lastOfRow2).build().perform(); | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastOfRow1); | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastOfRow2); | |||
compareScreen("RegError-Scrolled-End"); | |||
} |
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import com.vaadin.testbench.elements.TextFieldElement; | |||
import com.vaadin.tests.layouts.layouttester.BaseAlignmentTest; | |||
@@ -23,7 +23,9 @@ public class VAlignmentTest extends BaseAlignmentTest { | |||
assertEquals(9, textFields.size()); | |||
TextFieldElement lastTextField = textFields.get(8); | |||
new Actions(driver).moveToElement(lastTextField).build().perform(); | |||
// moveToElement fails on Firefox since the component is out of viewport | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastTextField); | |||
compareScreen("alignment-scrolled"); | |||
} |
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import com.vaadin.testbench.elements.CheckBoxElement; | |||
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest; | |||
@@ -23,7 +23,9 @@ public class VLayoutRegErrorTest extends BaseLayoutRegErrorTest { | |||
assertEquals(3, checkBoxes.size()); | |||
CheckBoxElement lastCheckBox = checkBoxes.get(2); | |||
new Actions(driver).moveToElement(lastCheckBox).build().perform(); | |||
// moveToElement fails on Firefox since the component is out of viewport | |||
((JavascriptExecutor) driver).executeScript( | |||
"arguments[0].scrollIntoView(true);", lastCheckBox); | |||
compareScreen("RegError-Scrolled"); | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.vaadin.tests.themes.valo; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.hamcrest.Matchers.closeTo; | |||
import static org.hamcrest.Matchers.equalTo; | |||
import java.util.List; | |||
@@ -51,7 +52,7 @@ public class ResponsiveStylesTest extends MultiBrowserTest { | |||
WebElement wideMenu = menus.get(WIDE_ELEMENT_INDEX); | |||
int wideWidth = wideMenu.getSize().width; | |||
assertThat(wideWidth, equalTo(WIDE_WIDTH)); | |||
assertThat((double) wideWidth, closeTo(WIDE_WIDTH, 1)); | |||
sleep(300); | |||
compareScreen("defaultMenuWidths"); |
@@ -147,7 +147,7 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
// Test initial renderering with contentVisible = False | |||
TestBenchElement cell = getGrid().getCell(51, 1); | |||
String backgroundColor = cell.getCssValue("backgroundColor"); | |||
String backgroundColor = cell.getCssValue("background-color"); | |||
assertEquals("Background color was not red.", colorRed, | |||
backgroundColor); | |||
@@ -156,7 +156,7 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
// Content becomes visible | |||
cell = getGrid().getCell(51, 1); | |||
backgroundColor = cell.getCssValue("backgroundColor"); | |||
backgroundColor = cell.getCssValue("background-color"); | |||
assertNotEquals("Background color was red.", colorRed, backgroundColor); | |||
// scroll down, new cells becomes contentVisible = False | |||
@@ -164,7 +164,7 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
// Cell should be red (setContentVisible set cell red) | |||
cell = getGrid().getCell(55, 1); | |||
backgroundColor = cell.getCssValue("backgroundColor"); | |||
backgroundColor = cell.getCssValue("background-color"); | |||
assertEquals("Background color was not red.", colorRed, | |||
backgroundColor); | |||
@@ -172,7 +172,7 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
sleep((int) (latency * SLEEP_MULTIPLIER)); | |||
// Cell should no longer be red | |||
backgroundColor = cell.getCssValue("backgroundColor"); | |||
backgroundColor = cell.getCssValue("background-color"); | |||
assertTrue("Background color was not reset: " + backgroundColor, | |||
backgroundColor.equals(colorWhite) | |||
|| backgroundColor.equals(colorDark)); |
@@ -223,7 +223,8 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { | |||
if (dragHeaderCell.findElements(By.className("gwt-HTML")).isEmpty()) { | |||
// no selectable header caption, drag freely | |||
new Actions(getDriver()).clickAndHold(dragHeaderCell) | |||
.moveToElement(targetHeaderCell, horizontalOffset, 0) | |||
.moveToElement(targetHeaderCell, | |||
getXOffset(targetHeaderCell, horizontalOffset), 0) | |||
.release().perform(); | |||
} else { | |||
// avoid clicking on the caption or the text gets selected and the | |||
@@ -234,7 +235,8 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { | |||
.moveToElement(dragHeaderCaption, | |||
dragHeaderCaption.getSize().getWidth() + 5, 5) | |||
.clickAndHold() | |||
.moveToElement(targetHeaderCell, horizontalOffset, 0) | |||
.moveToElement(targetHeaderCell, | |||
getXOffset(targetHeaderCell, horizontalOffset), 0) | |||
.release().perform(); | |||
} | |||
} |
@@ -342,7 +342,10 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest { | |||
GridCellElement draggedHeaderCell = getGridElement().getHeaderCell(0, | |||
1); | |||
final int xOffset = 500; | |||
new Actions(getDriver()).moveToElement(draggedHeaderCell, 20, 10) | |||
new Actions(getDriver()) | |||
.moveToElement(draggedHeaderCell, | |||
getXOffset(draggedHeaderCell, 20), | |||
getYOffset(draggedHeaderCell, 10)) | |||
.clickAndHold().moveByOffset(xOffset, 0).build().perform(); | |||
WebElement floatingDragElement = findElement( |
@@ -49,7 +49,8 @@ public class TreeItemDoubleClickTest extends MultiBrowserTest { | |||
} | |||
private void doubleClick(WebElement element) { | |||
new Actions(getDriver()).doubleClick(element).build().perform(); | |||
new Actions(getDriver()).moveToElement(element).doubleClick().build() | |||
.perform(); | |||
sleep(100); | |||
} | |||