public static AppiumDriverLocalService buildDefaultService() { return buildService(new AppiumServiceBuilder()); }
private void setUpGetNodeJSExecutableScript() { if (getNodeJSExecutable != null) { return; } getNodeJSExecutable = Scripts.GET_NODE_JS_EXECUTABLE.getScriptFile(); }
/** * Remove all existing server output streams. * * @return true if at least one output stream has been cleared */ public boolean clearOutPutStreams() { return stream.clear(); }
@Test public void checkAbilityToStartServiceUsingNonLocalhostIP() { service = new AppiumServiceBuilder().withIPAddress(testIP).build(); service.start(); assertTrue(service.isRunning()); }
@Test public void checkAbilityToStartServiceUsingFlags() { service = new AppiumServiceBuilder() .withArgument(CALLBACK_ADDRESS, testIP) .withArgument(SESSION_OVERRIDE) .withArgument(PRE_LAUNCH) .build(); service.start(); assertTrue(service.isRunning()); }
@Test public void checkAbilityToStartServiceOnAFreePort() { service = new AppiumServiceBuilder().usingAnyFreePort().build(); service.start(); assertTrue(service.isRunning()); }
/** * Starts a local server. * * @return ip of a local host * @throws UnknownHostException when it is impossible to get ip address of a local host */ public static String startAppiumServer() throws UnknownHostException { service = new AppiumServiceBuilder() .usingPort(PORT).build(); service.start(); InetAddress inetAddress = InetAddress.getLocalHost(); return inetAddress.getHostAddress(); }
private void assertLoggerContext(Level expectedLevel, String expectedLoggerName, String logMessage) { Slf4jLogMessageContext ctx = parseSlf4jContextFromLogMessage(logMessage); assertEquals(expectedLoggerName, ctx.getName()); assertEquals(expectedLevel, ctx.getLevel()); assertEquals(getLogger(expectedLoggerName), ctx.getLogger()); } }
public AppiumDriver(HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) { this(AppiumDriverLocalService.buildDefaultService(), httpClientFactory, desiredCapabilities); }
@Override protected String perform() { service.start(); return "OK"; } };
public AppiumDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) { this(builder.build(), httpClientFactory, desiredCapabilities); }
@Override protected Boolean perform() { return service.isRunning(); } };
@Override protected String perform() { service.stop(); return "OK"; } };
@Override protected void finalize() throws Throwable { try { disposeCachedFile(npmScript); disposeCachedFile(getNodeJSExecutable); } finally { super.finalize(); } } }
@Override protected AppiumDriverLocalService createDriverService(File nodeJSExecutable, int nodeJSPort, ImmutableList<String> nodeArguments, ImmutableMap<String, String> nodeEnvironment) { try { return new AppiumDriverLocalService(ipAddress, nodeJSExecutable, nodeJSPort, nodeArguments, nodeEnvironment, startupTimeout, timeUnit); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void run() { try { result = action.perform(); } catch (Throwable t) { this.throwable = t; } } }
public AppiumDriver(Capabilities desiredCapabilities) { this(AppiumDriverLocalService.buildDefaultService(), desiredCapabilities); }
public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder) { return builder.build(); }
private void setUpNPMScript() { if (npmScript != null) { return; } if (!Platform.getCurrent().is(Platform.WINDOWS)) { npmScript = Scripts.GET_PATH_TO_DEFAULT_NODE_UNIX.getScriptFile(); } }
public AppiumDriver(AppiumServiceBuilder builder, Capabilities desiredCapabilities) { this(builder.build(), desiredCapabilities); }