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.

DisabledParentLayoutTest.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.datefield;
  17. import org.junit.Assert;
  18. import org.junit.Test;
  19. import org.openqa.selenium.WebElement;
  20. import com.vaadin.testbench.By;
  21. import com.vaadin.tests.tb3.MultiBrowserTest;
  22. /**
  23. *
  24. * @author Vaadin Ltd
  25. */
  26. public class DisabledParentLayoutTest extends MultiBrowserTest {
  27. @Test
  28. public void testEnableParentLayout() {
  29. openTestURL();
  30. WebElement button = driver.findElement(By.className("v-button"));
  31. button.click();
  32. WebElement textField = driver
  33. .findElement(By.className("v-datefield-textfield"));
  34. textField.click();
  35. Assert.assertFalse(
  36. "Date input text field shoud be disabled for disabled DateField",
  37. textField.isEnabled());
  38. WebElement dataFieldButton = driver
  39. .findElement(By.className("v-datefield-button"));
  40. dataFieldButton.click();
  41. Assert.assertFalse(
  42. "Disabled date popup is opened after click to its button",
  43. isElementPresent(By.className("v-datefield-popup")));
  44. button.click();
  45. Assert.assertTrue(
  46. "Date input text field should be enabled for enabled DateField",
  47. textField.isEnabled());
  48. textField.click();
  49. String text = "text";
  50. textField.sendKeys(text);
  51. Assert.assertEquals("Unexpected text in date text field", text,
  52. textField.getAttribute("value"));
  53. dataFieldButton.click();
  54. Assert.assertFalse("Unexpected disabled element found",
  55. isElementPresent(By.className("v-disabled")));
  56. Assert.assertTrue("Date popup is not opened after click to its button",
  57. isElementPresent(By.className("v-datefield-popup")));
  58. }
  59. }