From b049c8bceadc0240de029036239d6a030f1c342c Mon Sep 17 00:00:00 2001 From: Guille Date: Tue, 5 Mar 2019 18:22:51 +0200 Subject: [PATCH] Update platform (#744) * Update to stable platform * Fix failing tests Workaround for issue reported in https://github.com/vaadin/vaadin-crud-flow/issues/78 --- pom.xml | 18 +-------------- .../bakery/testbench/ProductsViewIT.java | 23 +++++++++++-------- .../starter/bakery/testbench/UsersViewIT.java | 13 ++++------- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 62f2bcfc2..cef18b3e8 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ UTF-8 false - 13.0.0.beta2 + 13.0.0 false @@ -59,24 +59,8 @@ false - - - vaadin-prereleases - https://maven.vaadin.com/vaadin-prereleases/ - - - vaadin-snapshots - http://oss.sonatype.org/content/repositories/vaadin-snapshots/ - - - - vaadin-prereleases - https://maven.vaadin.com/vaadin-prereleases - - - diff --git a/src/test/java/com/vaadin/starter/bakery/testbench/ProductsViewIT.java b/src/test/java/com/vaadin/starter/bakery/testbench/ProductsViewIT.java index d3baca9ef..bb982a9fc 100644 --- a/src/test/java/com/vaadin/starter/bakery/testbench/ProductsViewIT.java +++ b/src/test/java/com/vaadin/starter/bakery/testbench/ProductsViewIT.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openqa.selenium.Keys; import org.openqa.selenium.support.ui.ExpectedCondition; import com.vaadin.flow.component.grid.testbench.GridElement; @@ -33,7 +34,10 @@ public void editProductTwice() { Assert.assertTrue(productsPage.isEditorOpen()); String newValue = "New " + uniqueName; - productsPage.getProductName().setValue(newValue); + TextFieldElement nameField = productsPage.getProductName(); + nameField.setValue(""); + nameField.sendKeys(newValue, Keys.TAB); + productsPage.getEditorSaveButton().click(); Assert.assertFalse(productsPage.isEditorOpen()); GridElement grid = productsPage.getGrid(); @@ -41,7 +45,10 @@ public void editProductTwice() { productsPage.openRowForEditing(rowNum); newValue = "The " + newValue; - productsPage.getProductName().setValue(newValue); + nameField = productsPage.getProductName(); + nameField.setValue(""); + nameField.sendKeys(newValue, Keys.TAB); + productsPage.getEditorSaveButton().click(); Assert.assertFalse(productsPage.isEditorOpen()); Assert.assertEquals(rowNum, grid.getCell(newValue).getRow()); @@ -65,8 +72,8 @@ public void editProduct() { TextFieldElement price = productsPage.getPrice(); Assert.assertEquals(initialPrice, price.getValue()); - price.focus(); - price.setValue("123.45"); + price.setValue(""); + price.sendKeys("123.45", Keys.TAB); productsPage.getEditorSaveButton().click(); @@ -80,8 +87,8 @@ public void editProduct() { Assert.assertEquals("123.45", price.getValue()); // Return initial value - price.focus(); - price.setValue(initialPrice); + price.setValue(""); + price.sendKeys(initialPrice, Keys.TAB); productsPage.getEditorSaveButton().click(); Assert.assertFalse(productsPage.isEditorOpen()); @@ -110,11 +117,9 @@ private int createProduct(ProductsViewElement productsPage, String name, String TextFieldElement nameField = productsPage.getProductName(); TextFieldElement priceField = productsPage.getPrice(); - nameField.focus(); nameField.setValue(name); - priceField.focus(); - priceField.setValue(price); + priceField.sendKeys(price, Keys.TAB); productsPage.getEditorSaveButton().click(); Assert.assertFalse(productsPage.isEditorOpen()); diff --git a/src/test/java/com/vaadin/starter/bakery/testbench/UsersViewIT.java b/src/test/java/com/vaadin/starter/bakery/testbench/UsersViewIT.java index 1273ff88f..83c548935 100644 --- a/src/test/java/com/vaadin/starter/bakery/testbench/UsersViewIT.java +++ b/src/test/java/com/vaadin/starter/bakery/testbench/UsersViewIT.java @@ -49,7 +49,8 @@ public void updatePassword() { // Saving any field without changing password should save and close TextFieldElement emailField = usersView.getEmailField(); String newEmail = "foo" + r.nextInt() + "@bar.com"; - emailField.setValue(newEmail); + emailField.setValue(""); + emailField.sendKeys(newEmail, Keys.TAB); usersView.getEditorSaveButton().click(); Assert.assertFalse(usersView.isEditorOpen()); @@ -71,9 +72,7 @@ public void updatePassword() { password = usersView.getPasswordField(); // Requery password field. // Good password - password.focus(); - password.setValue("Abc123"); - password.sendKeys(Keys.TAB); + password.sendKeys("Abc123", Keys.TAB); usersView.getEditorSaveButton().click(); Assert.assertFalse(usersView.isEditorOpen()); @@ -96,11 +95,7 @@ private void createUser( usersView.getLastName().setValue(lastName); usersView.getPasswordField().setValue(password); - // TODO: Fix combo selection as soon as API updated - // https://github.com/vaadin/vaadin-components-testbench/issues/60 - usersView.getRole().openPopup(); - usersView.getRole().setFilter(role); - usersView.getRole().sendKeys(Keys.ENTER); + usersView.getRole().selectByText(role); usersView.getEditorSaveButton().click(); Assert.assertFalse(usersView.isEditorOpen());