Package jp.vmi.selenium.selenese.command

Source Code of jp.vmi.selenium.selenese.command.AssertionTest

package jp.vmi.selenium.selenese.command;

import java.io.IOException;

import org.junit.Test;

import jp.vmi.selenium.selenese.Runner;
import jp.vmi.selenium.selenese.TestCase;
import jp.vmi.selenium.selenese.inject.Binder;
import jp.vmi.selenium.selenese.result.Result;
import jp.vmi.selenium.testutils.TestBase;
import jp.vmi.selenium.webdriver.DriverOptions;
import jp.vmi.selenium.webdriver.WebDriverManager;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

/**
* test for {@link Assertion}.
*/
public class AssertionTest extends TestBase {

    /**
     * test of user friendly assertion message.
     *
     * @throws IOException exception.
     */
    @Test
    public void userFriendlyAssertionMessage() throws IOException {
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.HTMLUNIT);
        wdm.setDriverOptions(new DriverOptions());
        Runner runner = new Runner();
        runner.setDriver(wdm.get());
        runner.setOverridingBaseURL(wsr.getBaseURL());
        CommandFactory cf = runner.getCommandFactory();

        TestCase testCase = Binder.newTestCase("dummy", "dummy", wsr.getBaseURL());
        testCase.addCommand(cf, "open", "/assertion.html");
        testCase.addCommand(cf, "assertTitle", "title", "title");
        Result result = runner.execute(testCase);
        assertThat(result.getMessage(), is("Failure: Assertion failed (Result: [assertion test] / Expected: [title])"));
    }
}
TOP

Related Classes of jp.vmi.selenium.selenese.command.AssertionTest

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.