diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2014-03-31 08:24:34 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-03-31 10:56:22 +0300 |
commit | 7a47febb2fdb03a743cca60409426ff70cc463a2 (patch) | |
tree | f8b3c808df67c9ce2859d7dafbd4d15418fc3fa8 /uitest/src/com/vaadin | |
parent | 3612ce1c294208dd85405c5e5956eca49e636d75 (diff) | |
download | vaadin-framework-7a47febb2fdb03a743cca60409426ff70cc463a2.tar.gz vaadin-framework-7a47febb2fdb03a743cca60409426ff70cc463a2.zip |
Refactored slider disable test.
Change-Id: I800c66399f32ca671d41425b11bd059def1fa9c9
Diffstat (limited to 'uitest/src/com/vaadin')
-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 |