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.

UploadImmediateButtonWidthTest.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.vaadin.tests.components.upload;
  2. import static org.hamcrest.CoreMatchers.is;
  3. import static org.hamcrest.MatcherAssert.assertThat;
  4. import org.junit.Test;
  5. import org.openqa.selenium.WebElement;
  6. import com.vaadin.testbench.By;
  7. import com.vaadin.tests.tb3.MultiBrowserTest;
  8. public abstract class UploadImmediateButtonWidthTest extends MultiBrowserTest {
  9. protected abstract String getTheme();
  10. protected double getButtonWidth(String id) {
  11. WebElement upload = driver.findElement(By.id(id));
  12. WebElement button = upload.findElement(By.className("v-button"));
  13. return button.getSize().getWidth();
  14. }
  15. @Override
  16. protected Class<?> getUIClass() {
  17. return UploadImmediateButtonWidth.class;
  18. }
  19. @Override
  20. public void setup() throws Exception {
  21. super.setup();
  22. openTestURL(String.format("theme=%s", getTheme()));
  23. }
  24. @Test
  25. public void immediateButtonWithPixelWidth() {
  26. assertThat(getButtonWidth("upload1"), is(300.0));
  27. }
  28. @Test
  29. public void immediateButtonWithPercentageWidth() {
  30. assertThat(getButtonWidth("upload2"), is(250.0));
  31. }
  32. }