Package org.seleniumhq.selenium.fluent.elements

Source Code of org.seleniumhq.selenium.fluent.elements.figure

package org.seleniumhq.selenium.fluent.elements;

import org.junit.Test;
import org.openqa.selenium.By;
import org.seleniumhq.selenium.fluent.BaseTest;
import org.seleniumhq.selenium.fluent.FluentExecutionStopped;
import org.seleniumhq.selenium.fluent.FluentWebElements;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;

public class figure extends BaseTest {

    @Test
    public void figure_functionality() {

        setupExpecations("figure");

        FluentWebElements fe = fwd.figure()
                .figure(By.xpath("@foo = 'bar'"))
                .figure(By.cssSelector("baz"))
                .figures();

        assertThat(fe, notNullValue());
        verifications("figure");
    }

    @Test
    public void figures_functionality() {

        setupExpecations2("figure");

        FluentWebElements fe = fwd.figure()
                .figures(By.name("qux"));

        assertThat(fe, notNullValue());

        verifications2("figure");

    }

    @Test
    public void figure_mismatched() {

        when(wd.findElement(By.linkText("mismatching_tag_name"))).thenReturn(we);
        when(we.getTagName()).thenReturn("boo");

        try {
            fwd.figure(By.linkText("mismatching_tag_name"))
                    .clearField();
            fail("should have barfed");
        } catch (FluentExecutionStopped e) {
            assertThat(e.getMessage(), equalTo("AssertionError during invocation of: ?.figure(By.linkText: mismatching_tag_name)"));
            assertThat(e.getCause().getMessage(), equalTo("tag was incorrect, should have been figure but was boo"));
        }

    }


}
TOP

Related Classes of org.seleniumhq.selenium.fluent.elements.figure

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.