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.

TableContextMenuAndIconsTest.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.vaadin.tests.components.table;
  2. import org.junit.Test;
  3. import org.openqa.selenium.interactions.Actions;
  4. import com.vaadin.testbench.TestBenchElement;
  5. import com.vaadin.testbench.elements.TableElement;
  6. import com.vaadin.tests.tb3.MultiBrowserTest;
  7. public class TableContextMenuAndIconsTest extends MultiBrowserTest {
  8. @Override
  9. protected Class<?> getUIClass() {
  10. return com.vaadin.tests.components.table.Tables.class;
  11. }
  12. @Test
  13. public void tableContextMenuWithIcons() throws Exception {
  14. openTestURL();
  15. /* Hide event log */
  16. selectMenuPath("Settings", "Show event log");
  17. /* Simple context menu */
  18. selectMenuPath("Component", "Features", "Context menu",
  19. "Item without icon");
  20. contextClickCell(1, 1);
  21. compareScreen("contextmenu-noicon");
  22. /* Two actions, without and with icon */
  23. selectMenuPath("Component", "Features", "Context menu",
  24. "With and without icon");
  25. contextClickCell(4, 2);
  26. compareScreen("caption-only-and-has-icon");
  27. /* Large icon */
  28. selectMenuPath("Component", "Features", "Context menu",
  29. "Only one large icon");
  30. contextClickCell(4, 2);
  31. compareScreen("large-icon");
  32. /*
  33. * Simple context menu again to ensure it is properly updated (icons
  34. * removed)
  35. */
  36. selectMenuPath("Component", "Features", "Context menu",
  37. "Item without icon");
  38. contextClickCell(1, 1);
  39. compareScreen("contextmenu-noicon");
  40. /* Empty context menu */
  41. selectMenuPath("Component", "Features", "Context menu", "Empty");
  42. contextClickCell(3, 3);
  43. compareScreen("contextmenu-empty");
  44. }
  45. private void contextClickCell(int row, int column) {
  46. TestBenchElement cell = $(TableElement.class).first().getCell(row,
  47. column);
  48. new Actions(driver).contextClick(cell).perform();
  49. }
  50. }