/** */ public BrowserWebDriverContainer() { final WaitStrategy logWaitStrategy = new LogMessageWaitStrategy() .withRegEx(".*(RemoteWebDriver instances should connect to|Selenium Server is up and running).*\n") .withStartupTimeout(Duration.of(15, SECONDS)); this.waitStrategy = new WaitAllStrategy() .withStrategy(logWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(15, SECONDS)); this.withRecordingFileFactory(new DefaultRecordingFileFactory()); }
@Test public void simpleTest() { final WaitStrategy underTest = new WaitAllStrategy() .withStrategy(strategy1) .withStrategy(strategy2); doNothing().when(strategy1).waitUntilReady(eq(container)); doNothing().when(strategy2).waitUntilReady(eq(container)); underTest.waitUntilReady(container); InOrder inOrder = inOrder(strategy1, strategy2); inOrder.verify(strategy1).waitUntilReady(any()); inOrder.verify(strategy2).waitUntilReady(any()); }
@Test public void appliesOuterTimeout() { final WaitStrategy underTest = new WaitAllStrategy() .withStrategy(strategy1) .withStartupTimeout(Duration.ofMillis(10)); doAnswer(invocation -> { Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); return null; }).when(strategy1).waitUntilReady(eq(container)); assertThrows("The outer strategy timeout applies", TimeoutException.class, () -> { underTest.waitUntilReady(container); }); } }
/** */ public BrowserWebDriverContainer() { final WaitStrategy logWaitStrategy = new LogMessageWaitStrategy() .withRegEx(".*(RemoteWebDriver instances should connect to|Selenium Server is up and running).*\n") .withStartupTimeout(Duration.of(15, SECONDS)); this.waitStrategy = new WaitAllStrategy() .withStrategy(logWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(15, SECONDS)); this.withRecordingFileFactory(new DefaultRecordingFileFactory()); }