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.

HeaderRightClickAfterDragTest.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.vaadin.tests.components.table;
  2. import org.junit.Test;
  3. import org.openqa.selenium.By;
  4. import org.openqa.selenium.interactions.Actions;
  5. import com.vaadin.testbench.TestBenchElement;
  6. import com.vaadin.testbench.elements.TableElement;
  7. import com.vaadin.testbench.elements.WindowElement;
  8. import com.vaadin.tests.tb3.MultiBrowserTest;
  9. /**
  10. * Tests whether right-click on a column header works after the column is
  11. * dragged.
  12. *
  13. * @author Vaadin Ltd
  14. */
  15. public class HeaderRightClickAfterDragTest extends MultiBrowserTest {
  16. @Test
  17. public void dragAndRightClick() {
  18. openTestURL();
  19. waitForElementPresent(By.className("v-table"));
  20. TableElement table = $(TableElement.class).first();
  21. TestBenchElement header0 = table.getHeaderCell(0);
  22. Actions actions = new Actions(getDriver());
  23. actions.contextClick(header0).perform();
  24. // check that right-click opened a window
  25. waitForElementPresent(By.className("v-window"));
  26. closeWindow();
  27. actions.clickAndHold(header0).moveToElement(table.getHeaderCell(1))
  28. .release();
  29. actions.contextClick(header0).perform();
  30. // check that right-click still opened a window
  31. waitForElementPresent(By.className("v-window"));
  32. }
  33. private void closeWindow() {
  34. WindowElement window = $(WindowElement.class).first();
  35. window.findElement(By.className("v-window-closebox")).click();
  36. waitUntil(input -> findElements(By.className("v-window")).isEmpty());
  37. }
  38. }