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.

MenuBarTooltipTest.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.vaadin.tests.tooltip;
  2. import static org.hamcrest.MatcherAssert.assertThat;
  3. import static org.hamcrest.Matchers.greaterThan;
  4. import org.junit.Test;
  5. import org.openqa.selenium.By;
  6. import com.vaadin.testbench.elements.MenuBarElement;
  7. import com.vaadin.tests.tb3.MultiBrowserTest;
  8. import com.vaadin.ui.themes.ChameleonTheme;
  9. import com.vaadin.ui.themes.Reindeer;
  10. import com.vaadin.ui.themes.Runo;
  11. import com.vaadin.ui.themes.ValoTheme;
  12. public class MenuBarTooltipTest extends MultiBrowserTest {
  13. @Test
  14. public void toolTipShouldBeOnTopOfMenuItem() {
  15. String[] themes = new String[] {
  16. ValoTheme.THEME_NAME,
  17. Reindeer.THEME_NAME,
  18. Runo.THEME_NAME,
  19. ChameleonTheme.THEME_NAME
  20. };
  21. for(String theme : themes) {
  22. assertZIndices(theme);
  23. }
  24. }
  25. public void assertZIndices(String theme) {
  26. openTestURL("theme=" + theme);
  27. $(MenuBarElement.class).first().clickItem("Menu item");
  28. assertThat(String.format("Invalid z-index for theme %s.", theme),
  29. getZIndex("v-tooltip"), greaterThan(getZIndex("v-menubar-popup")));
  30. }
  31. private int getZIndex(String className) {
  32. return Integer.parseInt(
  33. findElement(By.className(className)).getCssValue("z-index"));
  34. }
  35. }