From 3688133b20f55174774191ee434c30465eb1a1b0 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Thu, 3 Sep 2015 22:21:40 +0300 Subject: Reset sort indicator when saving editor. (#17428) Change-Id: Idaaf707bdb4178ff4ff5dfc7af853f08d5690b5e --- .../tests/components/grid/GridEditorUITest.java | 46 ++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java index 3d0b3bb071..708c3a827d 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java @@ -15,6 +15,9 @@ */ package com.vaadin.tests.components.grid; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -22,6 +25,7 @@ import org.junit.Test; import org.openqa.selenium.Keys; import org.openqa.selenium.interactions.Actions; +import com.vaadin.testbench.By; import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.NotificationElement; @@ -32,11 +36,36 @@ import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("grid") public class GridEditorUITest extends MultiBrowserTest { - @Test - public void testEditor() { + @Override + public void setup() throws Exception { + super.setup(); + setDebug(true); openTestURL(); + } + + private void openEditor(int rowIndex) { + GridElement grid = $(GridElement.class).first(); + + GridCellElement cell = grid.getCell(rowIndex, 1); + + new Actions(driver).moveToElement(cell).doubleClick().build().perform(); + } + + private void saveEditor() { + findElement(By.cssSelector(".v-grid-editor-save")).click(); + } + private GridCellElement getHeaderCell(int rowIndex, int colIndex) { + GridElement grid = $(GridElement.class).first(); + + GridCellElement headerCell = grid.getHeaderCell(rowIndex, colIndex); + + return headerCell; + } + + @Test + public void testEditor() { assertFalse("Sanity check", isElementPresent(PasswordFieldElement.class)); @@ -52,12 +81,15 @@ public class GridEditorUITest extends MultiBrowserTest { isElementPresent(NotificationElement.class)); } - private void openEditor(int rowIndex) { - GridElement grid = $(GridElement.class).first(); + @Test + public void savingResetsSortingIndicator() { + GridCellElement headerCell = getHeaderCell(0, 0); + headerCell.click(); - GridCellElement cell = grid.getCell(rowIndex, 1); + openEditor(1); - new Actions(driver).moveToElement(cell).doubleClick().build().perform(); - } + saveEditor(); + assertThat(headerCell.getAttribute("class"), not(containsString("sort"))); + } } -- cgit v1.2.3