package integration;

import com.codeborne.selenide.*;
import org.junit.*;
import org.openqa.selenium.*;

import static com.codeborne.selenide.Selenide.*;
import static org.hamcrest.CoreMatchers.*;

/**
 * Created by vinogradov on 11.01.16.
 */

public class InputFieldTest extends IntegrationTest {


  @Test
  public void selenideClearTest(){
    open("/html5_input.html");
    SelenideElement input=$(By.id("id1"));
    input.toWebElement().clear();
    input.toWebElement().sendKeys(",.123");
    input.toWebElement().clear();
    input.toWebElement().sendKeys("456");
    Assert.assertThat(input.getAttribute("value"),is(equalTo("456")));
  }

  @Test
  public void selenideClearTest2(){
    open("/html5_input.html");
    WebElement input=$(By.id("id1")).toWebElement();
    input.clear();
    input.sendKeys(",.123");
    input.clear();
    input.sendKeys("456");
    Assert.assertThat(input.getAttribute("value"),is(equalTo("456")));
  }

  @Test
  public void seleniumClearTest(){
    open("/html5_input.html");
    WebElement input=WebDriverRunner.getWebDriver().findElement(By.id("id1"));
    input.clear();
    input.sendKeys(",.123");
    input.clear();
    input.sendKeys("456");
    Assert.assertThat(input.getAttribute("value"),is(equalTo("456")));
  }
}

@@ -294,16 +294,204 @@
 Test %7B%0A%0A
+  @Before%0A  public void setup()%7B%0A    open(%22/html5_input.html?%22+System.currentTimeMillis());%0A  %7D%0A%0A  @Ignore (value = %22fails - Bug in Selenium should be fixed in 2.49 http://bit.ly/1JKT4AE%22)
 %0A  @Test
@@ -530,39 +530,8 @@
 ()%7B%0A
-    open(%22/html5_input.html%22);%0A
     
@@ -573,162 +573,8 @@
 ));%0A
-    input.toWebElement().clear();%0A    input.toWebElement().sendKeys(%22,.123%22);%0A    input.toWebElement().clear();%0A    input.toWebElement().sendKeys(%22456%22);%0A
     
@@ -597,36 +597,20 @@
 t(input.
-getAttribute(%22value%22
+val(
 ),is(equ
@@ -619,150 +619,14 @@
 To(%22
-456
 %22)));%0A
-  %7D%0A%0A  @Test%0A  public void selenideClearTest2()%7B%0A    open(%22/html5_input.html%22);%0A    WebElement input=$(By.id(%22id1%22)).toWebElement();%0A
     
@@ -644,38 +644,38 @@
 ();%0A    input.se
-ndKeys
+tValue
 (%22,.123%22);%0A    i
@@ -692,38 +692,38 @@
 ();%0A    input.se
-ndKeys
+tValue
 (%22456%22);%0A    Ass
@@ -743,36 +743,20 @@
 t(input.
-getAttribute(%22value%22
+val(
 ),is(equ
@@ -774,166 +774,8 @@
 ));%0A
-  %7D%0A%0A  @Test%0A  public void seleniumClearTest()%7B%0A    open(%22/html5_input.html%22);%0A    WebElement input=WebDriverRunner.getWebDriver().findElement(By.id(%22id1%22));%0A
     
@@ -801,22 +801,22 @@
 input.se
-ndKeys
+tValue
 (%22,.123%22
@@ -853,14 +853,14 @@
 t.se
-ndKeys
+tValue
 (%2245
@@ -896,28 +896,12 @@
 put.
-getAttribute(%22value%22
+val(
 ),is
@@ -923,10 +923,12 @@
 ));%0A  %7D%0A
+%0A%0A
 %7D%0A

test updated & set ignore due to new fact