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.

SetThemeAndResponsiveLayoutTest.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package com.vaadin.tests.extensions;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import org.openqa.selenium.support.ui.ExpectedConditions;
  6. import com.vaadin.testbench.By;
  7. import com.vaadin.testbench.elements.ButtonElement;
  8. import com.vaadin.testbench.elements.CssLayoutElement;
  9. import com.vaadin.tests.tb3.MultiBrowserTest;
  10. public class SetThemeAndResponsiveLayoutTest extends MultiBrowserTest {
  11. @Before
  12. public void setUp() throws Exception {
  13. // We need this in order to ensure that the initial width-range is
  14. // width: 600px- and height: 500px-
  15. testBench().resizeViewPortTo(1024, 768);
  16. }
  17. @Test
  18. public void testWidthAndHeightRanges() throws Exception {
  19. openTestURL();
  20. // IE sometimes has trouble waiting long enough.
  21. waitUntil(ExpectedConditions.presenceOfElementLocated(
  22. By.cssSelector(".v-csslayout-width-and-height")), 30);
  23. // set the theme programmatically
  24. $(ButtonElement.class).caption("Set theme").first().click();
  25. waitUntil(ExpectedConditions
  26. .presenceOfElementLocated(By.xpath("//div[@width-range]")), 30);
  27. // Verify both width-range and height-range.
  28. assertEquals("600px-",
  29. $(CssLayoutElement.class).first().getAttribute("width-range"));
  30. assertEquals("500px-",
  31. $(CssLayoutElement.class).first().getAttribute("height-range"));
  32. // Resize
  33. testBench().resizeViewPortTo(550, 450);
  34. // Verify updated width-range and height-range.
  35. assertEquals("0-599px",
  36. $(CssLayoutElement.class).first().getAttribute("width-range"));
  37. assertEquals("0-499px",
  38. $(CssLayoutElement.class).first().getAttribute("height-range"));
  39. }
  40. }