You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GridEditorUITest.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.grid;
  17. import static org.junit.Assert.assertFalse;
  18. import static org.junit.Assert.assertTrue;
  19. import org.junit.Test;
  20. import org.openqa.selenium.Keys;
  21. import org.openqa.selenium.interactions.Actions;
  22. import com.vaadin.testbench.elements.GridElement;
  23. import com.vaadin.testbench.elements.GridElement.GridCellElement;
  24. import com.vaadin.testbench.elements.NotificationElement;
  25. import com.vaadin.testbench.elements.PasswordFieldElement;
  26. import com.vaadin.testbench.parallel.TestCategory;
  27. import com.vaadin.tests.tb3.MultiBrowserTest;
  28. @TestCategory("grid")
  29. public class GridEditorUITest extends MultiBrowserTest {
  30. @Test
  31. public void testEditor() {
  32. setDebug(true);
  33. openTestURL();
  34. assertFalse("Sanity check",
  35. isElementPresent(PasswordFieldElement.class));
  36. openEditor(5);
  37. new Actions(getDriver()).sendKeys(Keys.ESCAPE).perform();
  38. openEditor(10);
  39. assertTrue("Edtor should be opened with a password field",
  40. isElementPresent(PasswordFieldElement.class));
  41. assertFalse("Notification was present",
  42. isElementPresent(NotificationElement.class));
  43. }
  44. private void openEditor(int rowIndex) {
  45. GridElement grid = $(GridElement.class).first();
  46. GridCellElement cell = grid.getCell(rowIndex, 1);
  47. new Actions(driver).moveToElement(cell).doubleClick().build().perform();
  48. }
  49. }