Package ru.yandex.qatools.htmlelements

Source Code of ru.yandex.qatools.htmlelements.CustomElementLocatorTest

package ru.yandex.qatools.htmlelements;

import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import ru.yandex.qatools.htmlelements.loader.HtmlElementLoader;
import ru.yandex.qatools.htmlelements.pagefactory.MyElementLocator.MyException;
import ru.yandex.qatools.htmlelements.pagefactory.MyElementLocatorFactory;
import ru.yandex.qatools.htmlelements.testelements.Company;
import ru.yandex.qatools.htmlelements.testpages.SearchPage;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class CustomElementLocatorTest {
    private WebDriver webDriver;

    @Before
    public void createStubs() {
        webDriver = mock(WebDriver.class);

        WebElement wrapper = mock(WebElement.class);
        when(webDriver.findElement(By.cssSelector(ComplexStructTest.WRAPPER_CSS))).thenReturn(wrapper);
    }

    @Test(expected = MyException.class)
    public void forHtmlElement() {
        Company company = new Company();
        HtmlElementLoader.populateHtmlElement(company, new MyElementLocatorFactory(webDriver));
        company.getText();
    }

    @Test(expected = MyException.class)
    public void forPageObject() {
        SearchPage searchPage = new SearchPage(new MyElementLocatorFactory(webDriver));
        searchPage.getLogo().getText();
    }
}
TOP

Related Classes of ru.yandex.qatools.htmlelements.CustomElementLocatorTest

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.