Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

GridReorderColumnsTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.vaadin.tests.components.grid;
  2. import static org.hamcrest.CoreMatchers.is;
  3. import static org.hamcrest.CoreMatchers.not;
  4. import static org.junit.Assert.assertThat;
  5. import org.junit.Test;
  6. import org.openqa.selenium.By;
  7. import org.openqa.selenium.interactions.Actions;
  8. import com.vaadin.testbench.elements.GridElement;
  9. import com.vaadin.testbench.elements.GridElement.GridCellElement;
  10. import com.vaadin.tests.tb3.MultiBrowserTest;
  11. public class GridReorderColumnsTest extends MultiBrowserTest {
  12. @Test
  13. public void testEmptyGrid() {
  14. openTestURL();
  15. testReordering("emptyGrid");
  16. }
  17. @Test
  18. public void testContentGrid() {
  19. openTestURL();
  20. testReordering("contentGrid");
  21. }
  22. private void testReordering(String id) {
  23. GridElement grid = $(GridElement.class).id(id);
  24. GridCellElement headerCell1 = grid.getHeaderCellByCaption("caption1");
  25. GridCellElement headerCell3 = grid.getHeaderCellByCaption("caption3");
  26. assertThat(grid.getHeaderCell(0, 0), is(headerCell1));
  27. new Actions(getDriver()).clickAndHold(headerCell1)
  28. .moveToElement(headerCell3, 5, 0).release().perform();
  29. waitForElementNotPresent(By.className("dragged-column-header"));
  30. assertThat(grid.getHeaderCell(0, 0), not(is(headerCell1)));
  31. }
  32. }