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 testOpen() throws IOException { setWebDriverFactory(WebDriverManager.HTMLUNIT, new DriverOptions()); Runner runner = new Runner(); runner.setDriver(manager.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, "open", wsr.getBaseURL()); testCase.addCommand(cf, "pause", "1000"); runner.execute(testCase); assertThat(runner.getWrappedDriver().getCurrentUrl(), is(wsr.getBaseURL())); } }