Package jp.vmi.selenium.selenese.command

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

package jp.vmi.selenium.selenese.command;

import java.io.File;
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.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 Open}
*/
public class OpenTest extends TestBase {

    /**
     * Test of command "open".
     *
     * @throws IOException exception.
     */
    @Test
    public void test() throws IOException {
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.HTMLUNIT);
        wdm.setDriverOptions(new DriverOptions());
        Runner runner = new Runner();
        runner.setDriver(wdm.get());
        CommandFactory cf = runner.getCommandFactory();

        File selenesefile = File.createTempFile("selenese", ".html");
        TestCase testCase = Binder.newTestCase(selenesefile.getPath(), "test", "http://example.co.jp");
        testCase.addCommand(cf, "store", wsr.getBaseURL(), "url");
        testCase.addCommand(cf, "open", "${url}");
        testCase.addCommand(cf, "pause", "1000");
        runner.execute(testCase);
        assertThat(runner.getWrappedDriver().getCurrentUrl(), is(wsr.getBaseURL()));
    }
}
TOP

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

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.