diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-03-31 09:40:27 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-03-31 09:40:27 +0000 |
commit | 6dcbca3c93a70c2cb3472e89b36750c4c8ab69cd (patch) | |
tree | 95b198571bd5bc6263dbe95bbda9fc4343091996 /uitest | |
parent | e4a50934a2cfb0e652b872376decf581bc0ab057 (diff) | |
parent | a6805ea6e96a158fda1fc5426faca543b3ba5563 (diff) | |
download | vaadin-framework-6dcbca3c93a70c2cb3472e89b36750c4c8ab69cd.tar.gz vaadin-framework-6dcbca3c93a70c2cb3472e89b36750c4c8ab69cd.zip |
Merge "Merge changes from origin/7.1"
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java index 53521ee483..f8fed28fac 100644 --- a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java +++ b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java @@ -15,9 +15,14 @@ */ package com.vaadin.tests.components.slider; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + import java.io.IOException; import org.junit.Test; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -27,11 +32,33 @@ public class SliderDisableTest extends MultiBrowserTest { @Test public void disableSlider() throws IOException { openTestURL(); + + assertSliderHandlePositionIs(38); + + // Move slider handle from 38px to 150px + moveSlider(112); + + assertSliderHandlePositionIs(150); + driver.findElement(By.id("disableButton")).click(); + + assertSliderIsDisabled(); + assertSliderHandlePositionIs(150); + } + + private void assertSliderIsDisabled() { + WebElement slider = driver.findElement(By.className("v-slider")); + assertThat(slider.getAttribute("class"), containsString("v-disabled")); + } + + private void moveSlider(int offset) { WebElement element = vaadinElement("/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]"); - new Actions(driver).dragAndDropBy(element, 112, 0).perform(); + new Actions(driver).dragAndDropBy(element, offset, 0).perform(); testBench().waitForVaadin(); - compareScreen("enabled"); - vaadinElementById("disableButton").click(); - compareScreen("disabled"); + } + + private void assertSliderHandlePositionIs(int position) { + WebElement handle = driver.findElement(By.className("v-slider-handle")); + + assertThat(handle.getCssValue("margin-left"), is(position + "px")); } }
\ No newline at end of file |