diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-01-08 15:39:23 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-01-08 14:30:21 +0000 |
commit | 329a24756347cdaf49441fcd9c8e96255fdb732e (patch) | |
tree | d84f0fbad58c8d61d5c16c5b52dd168caedbfb9e /uitest/src/com/vaadin/testbench/elements/GridElement.java | |
parent | d4e633d49441123bda15c90f4aa657bda31ee43c (diff) | |
download | vaadin-framework-329a24756347cdaf49441fcd9c8e96255fdb732e.tar.gz vaadin-framework-329a24756347cdaf49441fcd9c8e96255fdb732e.zip |
Fix Grid editor hanging on exception in commit (#15536)
This patch adds a minimal editor subpart support.
Change-Id: I36a81cb432f71821715cb60338a07a289bdae18d
Diffstat (limited to 'uitest/src/com/vaadin/testbench/elements/GridElement.java')
-rw-r--r-- | uitest/src/com/vaadin/testbench/elements/GridElement.java | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/testbench/elements/GridElement.java b/uitest/src/com/vaadin/testbench/elements/GridElement.java index 254acbfa2a..0c94c1dd88 100644 --- a/uitest/src/com/vaadin/testbench/elements/GridElement.java +++ b/uitest/src/com/vaadin/testbench/elements/GridElement.java @@ -62,6 +62,51 @@ public class GridElement extends AbstractComponentElement { } } + public static class GridEditorElement extends AbstractElement { + + private GridElement grid; + + private GridEditorElement setGrid(GridElement grid) { + this.grid = grid; + return this; + } + + /** + * Gets the editor field for column in given index. + * + * @param colIndex + * column index + * @return the editor field for given location + */ + public TestBenchElement getField(int colIndex) { + return grid.getSubPart("#editor[" + colIndex + "]"); + } + + /** + * Saves the fields of this editor. + * <p> + * <em>Note:</em> that this closes the editor making this element + * useless. + */ + public void save() { + getField(0); + List<WebElement> buttons = findElements(By.xpath("./button")); + buttons.get(0).click(); + } + + /** + * Cancels this editor. + * <p> + * <em>Note:</em> that this closes the editor making this element + * useless. + */ + public void cancel() { + getField(0); + List<WebElement> buttons = findElements(By.xpath("./button")); + buttons.get(1).click(); + } + } + /** * Scrolls Grid element so that wanted row is displayed * @@ -262,6 +307,11 @@ public class GridElement extends AbstractComponentElement { return rootElements.get(2); } + public GridEditorElement getEditor() { + return getSubPart("#editor").wrap(GridEditorElement.class) + .setGrid(this); + } + /** * Helper function to get Grid subparts wrapped correctly * @@ -272,5 +322,4 @@ public class GridElement extends AbstractComponentElement { private TestBenchElement getSubPart(String subPartSelector) { return (TestBenchElement) findElement(By.vaadin(subPartSelector)); } - } |