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.

UploadHtmlCaptionTest.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package com.vaadin.tests.components.upload;
  2. import static org.junit.Assert.assertFalse;
  3. import static org.junit.Assert.assertTrue;
  4. import org.junit.Test;
  5. import org.openqa.selenium.By;
  6. import org.openqa.selenium.WebElement;
  7. import com.vaadin.testbench.elements.ButtonElement;
  8. import com.vaadin.testbench.elements.UploadElement;
  9. import com.vaadin.tests.tb3.MultiBrowserTest;
  10. public class UploadHtmlCaptionTest extends MultiBrowserTest {
  11. @Test
  12. public void htmlCaptionToggle() {
  13. openTestURL();
  14. UploadElement upload = $(UploadElement.class).first();
  15. WebElement submitButtonCaption = upload
  16. .findElement(By.className("v-button-caption"));
  17. WebElement componentCaption = findElement(By.className("v-caption"));
  18. ButtonElement toggleButtonCaption = $(ButtonElement.class)
  19. .id("toggleButtonCaption");
  20. ButtonElement toggleComponentCaption = $(ButtonElement.class)
  21. .id("toggleComponentCaption");
  22. assertTrue(
  23. "Unexpected submit button caption: "
  24. + submitButtonCaption.getText(),
  25. submitButtonCaption.getText().contains("<b>"));
  26. assertTrue(
  27. "Unexpected component caption: " + componentCaption.getText(),
  28. componentCaption.getText().contains("<b>"));
  29. toggleButtonCaption.click();
  30. assertFalse(
  31. "Unexpected submit button caption: "
  32. + submitButtonCaption.getText(),
  33. submitButtonCaption.getText().contains("<b>"));
  34. assertTrue(
  35. "Unexpected component caption: " + componentCaption.getText(),
  36. componentCaption.getText().contains("<b>"));
  37. toggleComponentCaption.click();
  38. assertFalse(
  39. "Unexpected submit button caption: "
  40. + submitButtonCaption.getText(),
  41. submitButtonCaption.getText().contains("<b>"));
  42. assertFalse(
  43. "Unexpected component caption: " + componentCaption.getText(),
  44. componentCaption.getText().contains("<b>"));
  45. toggleButtonCaption.click();
  46. assertTrue(
  47. "Unexpected submit button caption: "
  48. + submitButtonCaption.getText(),
  49. submitButtonCaption.getText().contains("<b>"));
  50. assertFalse(
  51. "Unexpected component caption: " + componentCaption.getText(),
  52. componentCaption.getText().contains("<b>"));
  53. }
  54. }