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.

GridColumnResizeModeTest.java 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright 2000-2016 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.v7.tests.components.grid.basicfeatures;
  17. import java.util.List;
  18. import org.junit.Assert;
  19. import org.junit.Before;
  20. import org.junit.Test;
  21. import org.openqa.selenium.WebElement;
  22. import org.openqa.selenium.interactions.Actions;
  23. import com.vaadin.testbench.By;
  24. import com.vaadin.testbench.customelements.GridElement;
  25. import com.vaadin.testbench.parallel.TestCategory;
  26. @TestCategory("grid")
  27. public class GridColumnResizeModeTest extends GridBasicFeaturesTest {
  28. @Before
  29. public void before() {
  30. openTestURL();
  31. }
  32. @Test
  33. public void testSimpleResizeModeToggle() throws Exception {
  34. GridElement grid = getGridElement();
  35. List<WebElement> handles = grid
  36. .findElements(By.className("v-grid-column-resize-handle"));
  37. WebElement handle = handles.get(1);
  38. Actions drag1 = new Actions(getDriver()).moveToElement(handle)
  39. .clickAndHold();
  40. Actions drag2 = new Actions(getDriver()).moveByOffset(-50, 0);
  41. Actions drag3 = new Actions(getDriver()).moveByOffset(100, 0);
  42. Actions dragEndAction = new Actions(getDriver()).release()
  43. .moveToElement(grid);
  44. selectMenuPath("Component", "Columns", "Simple resize mode");
  45. sleep(250);
  46. drag1.perform();
  47. sleep(500);
  48. drag2.perform();
  49. sleep(500);
  50. drag3.perform();
  51. sleep(500);
  52. // Make sure we find at least one simple resize mode splitter
  53. assertElementPresent(
  54. By.className("v-grid-column-resize-simple-indicator"));
  55. dragEndAction.perform();
  56. // Make sure it went away
  57. assertElementNotPresent(
  58. By.className("v-grid-column-resize-simple-indicator"));
  59. // See that we got a resize event
  60. sleep(500);
  61. Assert.assertEquals("Log shows resize event", getLogRow(0),
  62. "3. ColumnResizeEvent: isUserOriginated? true");
  63. }
  64. }