Package ru.yandex.qatools.htmlelements.matchers

Source Code of ru.yandex.qatools.htmlelements.matchers.IsElementEnabledTest

package ru.yandex.qatools.htmlelements.matchers;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import ru.yandex.qatools.htmlelements.matchers.mockfactory.MockFactory;
import ru.yandex.qatools.htmlelements.matchers.testelements.CustomBlock;
import ru.yandex.qatools.htmlelements.matchers.testpages.PageWithCustomBlock;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
import static ru.yandex.qatools.htmlelements.matchers.WebElementMatchers.isEnabled;

/**
* @author Alexander Tolmachev starlight@yandex-team.ru
*         Date: 30.09.12
*/
public class IsElementEnabledTest {
    private WebDriver driver = MockFactory.mockDriver();

    @Test
    public void isElementEnabled() {
        WebElement element = MockFactory.mockEnabledElement(By.className(CustomBlock.CLASS_NAME), driver);
        PageWithCustomBlock page = new PageWithCustomBlock(driver);

        assertThat(element, isEnabled());
        assertThat(page.getBlock(), isEnabled());
    }

    @Test
    public void isElementNotEnabled() {
        WebElement element = MockFactory.mockNotEnabledElement(By.className(CustomBlock.CLASS_NAME), driver);
        PageWithCustomBlock page = new PageWithCustomBlock(driver);

        assertThat(element, not(isEnabled()));
        assertThat(page.getBlock(), not(isEnabled()));
    }
}
TOP

Related Classes of ru.yandex.qatools.htmlelements.matchers.IsElementEnabledTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.