您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

DateTimeFieldReadOnlyTest.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.vaadin.tests.components.datefield;
  2. import java.io.IOException;
  3. import org.junit.Test;
  4. import org.openqa.selenium.Keys;
  5. import com.vaadin.testbench.By;
  6. import com.vaadin.testbench.customelements.AbstractDateFieldElement;
  7. import com.vaadin.testbench.elements.ButtonElement;
  8. import com.vaadin.tests.tb3.MultiBrowserTest;
  9. public class DateTimeFieldReadOnlyTest extends MultiBrowserTest {
  10. @Test
  11. public void readOnlyDateFieldPopupShouldNotOpen()
  12. throws IOException, InterruptedException {
  13. openTestURL();
  14. compareScreen("initial-date");
  15. toggleReadOnly();
  16. openPopup();
  17. compareScreen("readwrite-popup-date");
  18. closePopup();
  19. toggleReadOnly();
  20. compareScreen("readonly-date");
  21. }
  22. private void closePopup() {
  23. findElement(By.className("v-datefield-calendarpanel"))
  24. .sendKeys(Keys.RETURN);
  25. }
  26. private void openPopup() {
  27. // waiting for openPopup() in TB4 beta1:
  28. // http://dev.vaadin.com/ticket/13766
  29. $(AbstractDateFieldElement.class).first()
  30. .findElement(By.tagName("button")).click();
  31. }
  32. private void toggleReadOnly() {
  33. $(ButtonElement.class).caption("Switch read-only").first().click();
  34. }
  35. }