package com.sdl.selenium.web;

import com.sdl.selenium.InputData;
import com.sdl.selenium.TestBase;
import com.sdl.selenium.bootstrap.form.TextField;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;

public class WebLocatorActionsIntegrationTest extends TestBase {

    private WebLocator locator = new WebLocator().setId("loginButton");
    private TextField email = new TextField().setLabel("Email:");

    @BeforeClass
    public void startTests() {
        driver.get(InputData.LOGIN_URL);
    }

    @Test
    public void actionsTest() {
        assertThat(locator.isElementPresent(), is(true));
        assertThat(locator.getHtmlText(true), equalTo("Login"));
        startTests();
        assertThat(locator.getHtmlText(true), equalTo("Login"));
    }

    @Test
    public void getTagNameTest() {
        assertThat(locator.getTagName(), equalTo("button"));
    }

    @Test
    public void getAttributeIdTest() {
        assertThat(locator.getAttributeId(), equalTo("loginButton"));
    }

    @Test
    public void getAttributeClassTest() {
        assertThat(locator.getAttributeClass(), equalTo("btn tile-btn btn-warning"));
    }

    @Test
    public void clickAtTest() {
        assertThat(locator.clickAt(), is(true));
    }

    @Test
    public void clickTest() {
        assertThat(locator.click(), is(true));
    }

    @Test
    public void sendKeysTest() {
        String mail = "eu@fast.com";
        assertThat((TextField) email.sendKeys(mail), is(email));
        assertThat(email.getValue(), equalTo(mail));
    }

    @Test (dependsOnMethods = "sendKeysTest")
    public void clearTest() {
        assertThat(email.clear(), is(true));
        assertThat(email.getValue(), equalTo(""));
    }

    @Test
    public void mouseOverTest() {
        assertThat(email.mouseOver(), is(true));
    }
}

@@ -143,16 +143,88 @@
 tField;%0A
+import org.openqa.selenium.Dimension;%0Aimport org.openqa.selenium.Point;%0A
 import o
@@ -2024,23 +2024,1152 @@
 hat(
-email.mouseOver
+locator.mouseOver(), is(true));%0A    %7D%0A%0A    @Test%0A    public void blurTest() %7B%0A        assertThat(locator.blur(), is(true));%0A    %7D%0A%0A    @Test%0A    public void focusTest() %7B%0A        assertThat(locator.focus(), is(locator));%0A    %7D%0A%0A    @Test%0A    public void doubleClickAtTest() %7B%0A        assertThat(locator.doubleClickAt(), is(true));%0A    %7D%0A%0A    @Test%0A    public void sizeTest() %7B%0A        assertThat(locator.size(), is(1));%0A    %7D%0A%0A    @Test%0A    public void getLocationTest() %7B%0A        assertThat(locator.getLocation(), is(new Point(136, 177)));%0A    %7D%0A%0A    @Test%0A    public void getSizeTest() %7B%0A        assertThat(locator.getSize(), is(new Dimension(61, 30)));%0A    %7D%0A%0A    @Test%0A    public void existsTest() %7B%0A        assertThat(locator.exists(), is(true));%0A    %7D%0A%0A    @Test%0A    public void isVisibleTest() %7B%0A        assertThat(locator.isVisible(), is(true));%0A    %7D%0A%0A    @Test%0A    public void readyTest() %7B%0A        assertThat(locator.ready(), is(true));%0A    %7D%0A%0A    @Test%0A    public void isDisabledTest() %7B%0A        assertThat(locator.isDisabled(), is(false));%0A    %7D%0A%0A    @Test%0A    public void isDisplayedTest() %7B%0A        assertThat(locator.isDisplayed
 (), 

add more tests in WebLocatorActionsIntegrationTest